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

Add libtpms project #2266

Merged
merged 1 commit into from
Mar 28, 2019
Merged

Add libtpms project #2266

merged 1 commit into from
Mar 28, 2019

Conversation

elmarco
Copy link
Contributor

@elmarco elmarco commented Mar 27, 2019

This requires stefanberger/libtpms#37

Then hopefully, it should work.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

Signed-off-by: Marc-André Lureau <mlureau@redhat.com>
@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@inferno-chromium inferno-chromium merged commit 1c590dc into google:master Mar 28, 2019
@inferno-chromium
Copy link
Collaborator

@elmarco - seeing some weird failures. Any ideas ?

I  ERROR: build step 20 "gcr.io/oss-fuzz/libtpms" failed: exit status 2 
I  ERROR 
I  Finished Step #20 
I  Step #20: make: Leaving directory '/work/build/tests' 
I  Step #20: Makefile:654: recipe for target 'fuzz' failed 
I  Step #20: make: *** [fuzz] Error 1 
I  Step #20: clang-9: error: linker command failed with exit code 1 (use -v to see invocation) 
I  Step #20: `.text.sancov.module_ctor.8' referenced in section `.init_array.2[sancov.module_ctor.8]' of /work/build/src/.libs/libtpms.a(libtpms_tpm2_la-PropertyCap.o): defined in discarded section `.text.sancov.module_ctor.8[sancov.module_ctor]' of /work/build/src/.libs/libtpms.a(libtpms_tpm2_la-PropertyCap.o) 
I  Step #20: `.text.sancov.module_ctor.18' referenced in section `.init_array.2[sancov.module_ctor.18]' of /work/build/src/.libs/libtpms.a(libtpms_tpm2_la-AsymmetricCommands.o): defined in discarded section `.text.sancov.module_ctor.18[sancov.module_ctor]' of /work/build/src/.libs/libtpms.a(libtpms_tpm2_la-AsymmetricCommands.o) 
I  Step #20: `.text.sancov.module_ctor.43' referenced in section `.init_array.2[sancov.module_ctor.43]' of /work/build/src/.libs/libtpms.a(libtpms_tpm2_la-NVCommands.o): defined in discarded section `.text.sancov.module_ctor.43[sancov.module_ctor]' of /work/build/src/.libs/libtpms.a(libtpms_tpm2_la-NVCommands.o) 
I  Step #20: `.text.sancov.module_ctor.41' referenced in section `.init_array.2[sancov.module_ctor.41]' of /work/build/src/.libs/libtpms.a(libtpms_tpm2_la-CryptEccSignature.o): defined in discarded section `.text.sancov.module_ctor.41[sancov.module_ctor]' of /work/build/src/.libs/libtpms.a(libtpms_tpm2_la-CryptEccSignature.o) 
I  Step #20: `.text.sancov.module_ctor.10' referenced in section `.init_array.2[sancov.module_ctor.10]' of /work/build/src/.libs/libtpms.a(libtpms_tpm2_la-CryptCmac.o): defined in discarded section `.text.sancov.module_ctor.10[sancov.module_ctor]' of /work/build/src/.libs/libtpms.a(libtpms_tpm2_la-CryptCmac.o) 
I  Step #20: `.text.sancov.module_ctor.66' referenced in section `.init_array.2[sancov.module_ctor.66]' of /work/build/src/.libs/libtpms.a(libtpms_tpm2_la-BnMath.o): defined in discarded section `.text.sancov.module_ctor.66[sancov.module_ctor]' of /work/build/src/.libs/libtpms.a(libtpms_tpm2_la-BnMath.o) 
I  Step #20: `.text.sancov.module_ctor.55' referenced in section `.init_array.2[sancov.module_ctor.55]' of /work/build/src/.libs/libtpms.a(libtpms_tpm2_la-AlgorithmTests.o): defined in discarded section `.text.sancov.module_ctor.55[sancov.module_ctor]' of /work/build/src/.libs/libtpms.a(libtpms_tpm2_la-AlgorithmTests.o) 

I also see

I  Step #20: grep: tpm2/PP.c: No such file or directory 
I  Step #20: grep: tpm2/PowerPlat.c: No such file or directory 
I  Step #20: grep: tpm2/Power.c: No such file or directory 

I think something on builder is different from infra/helper.py. @oliverchang can help but is OOO this week.

@elmarco
Copy link
Contributor Author

elmarco commented Mar 28, 2019

@inferno-chromium thanks for the report, I have no idea why the link fails. Is there a full build log I can access? It would be nice if I can have a reproducer with infra/helper.py.

The grep errors are from upstream, and can be ignored for now (we should solve them eventually)

thanks

@inferno-chromium
Copy link
Collaborator

inferno-chromium commented Mar 29, 2019

Actually my last comment was wrong. Firstly logs are unavailable/not updated due #2263 (should be fixed end of week).
And secondly fuzzing build is all ok, so fuzzing is happening. What is broken is the coverage build (wont block fuzzing)

weirdly python infra/helper.py build_fuzzers --sanitizer coverage libtpms
is not reproducing this. @Dor1s - any ideas why flags show up trace-pc-guard

Step #20: /bin/bash ../libtool --tag=CC --mode=link clang -fsanitize=fuzzer -I/src/libtpms/include -O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize-address-use-after-scope -fsanitize-coverage=trace-pc-guard -Wall -Werror -Wreturn-type -Wsign-compare -Wno-self-assign -fsanitize=fuzzer -ltpms -L../src/.libs -o fuzz fuzz-fuzz.o -lcrypto

@Dor1s
Copy link
Contributor

Dor1s commented Mar 31, 2019

It's not coverage build, I believe. The compilation flags look totally wrong, e.g. -fsanitize=fuzzer -- where it comes from? We don't use it, we use -fsanitize=fuzzer-no-link. I think it's AFL + AddressSanitizer configuration. There's where -fsanitize-coverage=trace-pc-guard is used. Should be reproducible locally via:

python infra/helper.py build_fuzzers --engine afl --sanitizer address $project_name

@Dor1s
Copy link
Contributor

Dor1s commented Mar 31, 2019

-fsanitize=fuzzer likely comes from here: https://github.com/stefanberger/libtpms/blob/db5af633925097284ded2b00907bdd6818390de2/tests/Makefile.am#L28

When building on OSS-Fuzz, the projects should use the provided CFLAGS and CXXFLAGS and don't append any extra sanitization / fuzzing flags.

@inferno-chromium
Copy link
Collaborator

Thanks a lot @Dor1s for awesome debugging. I missed the AFL fact, so this is a AFL build failure and not coverage one. @elmarco can you please remove the -fsanitize=fuzzer override as per @Dor1s last comment and recheck that AFL build works. Thanks!

@elmarco
Copy link
Contributor Author

elmarco commented Apr 2, 2019

@Dor1s @inferno-chromium stefanberger/libtpms@b214dab should fix the issues.

@Dor1s
Copy link
Contributor

Dor1s commented Apr 2, 2019

Awesome! I see that two recent builds have succeeded. Thank you, @elmarco,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants