Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIPS module in build with -z defs #8735

Closed
kroeckx opened this issue Apr 12, 2019 · 25 comments
Closed

FIPS module in build with -z defs #8735

kroeckx opened this issue Apr 12, 2019 · 25 comments

Comments

@kroeckx
Copy link
Member

kroeckx commented Apr 12, 2019

It seems that when you configure with no-shared, it's still creating a fips.so file.

@kroeckx
Copy link
Member Author

kroeckx commented Apr 12, 2019

There is also a p_test.so and legacy.so

@mattcaswell
Copy link
Member

Well, its a design decision that the fips module will only ever be in a .so form. And I'm also not sure it follows that just because you want the static libraries for libcrypto/libssl that you don't want to use fips. You can of course independently turn off building of the fips module with "no-fips". The legacy library is another issue - I suppose you may want the option for that to be static and just part of libcrypto - although that's not possible right at the moment.

@kroeckx
Copy link
Member Author

kroeckx commented Apr 12, 2019

So the issue is not that we generate the shared library itself. It seems that when making the shared library, but that we pass -z defs, and that that works with gcc but not with clang. We don't pass it for the other shared libraries.

@kroeckx kroeckx changed the title FIPS module in made in a static build FIPS module in build with -z defs Apr 12, 2019
@kroeckx
Copy link
Member Author

kroeckx commented Apr 12, 2019

So it seems that gcc properly links in the asan library, clang doesn't.

@kroeckx
Copy link
Member Author

kroeckx commented Apr 12, 2019

It seems we can fix this with adding -lasan

@paulidale
Copy link
Contributor

I think it would be sensible to allow any provider (except FIPS) to be statically linked into libcrypto.

kroeckx added a commit to kroeckx/openssl that referenced this issue Apr 14, 2019
…r .so file"

This reverts commit 0be2cc5.

This breaks all builds using a clang sanitizer.

Fixes: openssl#8735

[extended tests]
levitte added a commit to levitte/openssl that referenced this issue Apr 15, 2019
The clang documentation in all sanitizers we currently use says this:

    When linking shared libraries, the {flavor}Sanitizer run-time is
    not linked, so -Wl,-z,defs may cause link errors (don’t use it
    with {flavor}Sanitizer)

(in our case, {flavor} is one of Address, Memory, or UndefinedBehavior)

Therefore, we turn off that particular flag specifically when using
the sanitizers.

Fixes openssl#8735
@levitte
Copy link
Member

levitte commented Apr 15, 2019

Alternative fix in #8749

@kroeckx kroeckx reopened this Apr 16, 2019
@kroeckx
Copy link
Member Author

kroeckx commented Apr 16, 2019

This issue is not fixed. OSS-Fuzz doesn't use the enable-asan option and things like that, it just adds it to the CFLAGS.

@levitte
Copy link
Member

levitte commented Apr 17, 2019

Can OSS-Fuzz be changed to use the enable-asan option?

@kroeckx
Copy link
Member Author

kroeckx commented Apr 17, 2019 via email

@levitte
Copy link
Member

levitte commented Apr 17, 2019

So let me see if I get this right, they configure in a way that makes it harder for us to detect that they enable asan, when there's an option for them to use that makes everyone happy (I assume), and now you're hinting that we should kinda piggy-back enable-asan on a different, unrelated option?

This is screwed up...

@levitte
Copy link
Member

levitte commented Apr 17, 2019

I went looking, and yeah, I get how that's hard to fix. Meh...

@levitte
Copy link
Member

levitte commented Apr 17, 2019

#8778 is my attempt to fix this

@kroeckx
Copy link
Member Author

kroeckx commented Apr 17, 2019 via email

@levitte
Copy link
Member

levitte commented Apr 17, 2019

You can turn that into enable-msan if you really want to, but I don't see the point. If you want we can add some additional config arument that disables the -z defs.

That's exactly the purpose with my translating -fsanitize=memory to enable-msan. Note this:

dso_ldflags =>
$disabled{asan} && $disabled{msan} && $disabled{ubsan}
? '-z defs'
: '',

In other words, the addition of -z defs is only made if msan hasn't been enabled.

@kroeckx
Copy link
Member Author

kroeckx commented Apr 24, 2019 via email

@levitte
Copy link
Member

levitte commented Apr 25, 2019

Please show me an actual configuration so I have a chance to try and reproduce.

@kroeckx
Copy link
Member Author

kroeckx commented Apr 26, 2019

@levitte
Copy link
Member

levitte commented Apr 26, 2019

Ah, yeah I see what happens, the processing order in Configure isn't quite right, the shared-info.pl data is processed too early, before the state of asan, msan and ubsan has been determined.

I'll fix when I'm more awake

@levitte
Copy link
Member

levitte commented Apr 30, 2019

I hope that #8846 fixed things well enough... I forgot to place a "Fixes #8735" in that one, unfortunately.

@kroeckx
Copy link
Member Author

kroeckx commented May 4, 2019

Just in case it wasn't clear, this is still a problem.

@levitte
Copy link
Member

levitte commented May 7, 2019

Okie, I see step 21 in today's, and wow that's a load of sanitizer checks I can't even find the docs for!

It seems like the sanest is really to not use -z defs if -fsanitize is present, period.

levitte added a commit to levitte/openssl that referenced this issue May 7, 2019
There are quite a number of sanitizers for clang that aren't
documented in the clang user documentation.  This makes it impossible
to be selective about what sanitizers to look at to determine if
'-z defs' should be used of not.

Under these circumstances, the sane thing to do is to just look for
any sanitizer specification and not use '-z defs' if there's one
present.

Fixes openssl#8735
@levitte
Copy link
Member

levitte commented May 7, 2019

I hope #8892 finally fixes this mess

@levitte levitte closed this as completed in ad37edc May 9, 2019
@kroeckx
Copy link
Member Author

kroeckx commented May 9, 2019

It doesn't.

@kroeckx kroeckx reopened this May 9, 2019
@kroeckx
Copy link
Member Author

kroeckx commented May 9, 2019

Never mind, that's still a log that didn't have that commit.

@kroeckx kroeckx closed this as completed May 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment