8

extractor: Make extraction errors fatal by woodruffw · Pull Request #37 · SRI-CS...

 2 years ago
source link: https://github.com/SRI-CSL/gllvm/pull/37
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Conversation

Copy link

Contributor

woodruffw commented on Aug 3, 2020

Prior to this, running get-bc on a binary with no .llvm_bc (or corresponding Mach-O section) would print an error message but exit with 0.

This turns those errors into true failures, making it easier to diagnose when get-bc has been run on an incorrect or mis-generated binary.

In progress.

Copy link

Member

ianamason commented on Aug 3, 2020

@woodruffw seems like a reasonable improvement, but the CI is still complaining about shadowing.
Are you gonna fix that or should I?

Copy link

Contributor

Author

woodruffw commented on Aug 3, 2020

I can fix it tomorrow ET! Feel free to take over if you’d like it merged before then, though.

Sent from mobile. Please excuse my brevity.

Copy link

Member

ianamason commented on Aug 4, 2020

I can wait. There is no rush. How is the other issue coming along? Weren't you guys working on issue #34 ?

Copy link

Contributor

Author

woodruffw commented on Aug 4, 2020

How is the other issue coming along? Weren't you guys working on issue #34 ?

Yep, we were. We ended up taking another approach for capturing the command-line flags, so we haven't made a ton of progress on building it into gllvm itself. It's something that I can take another look at when I have some free time, though.

Copy link

Contributor

Author

woodruffw commented on Aug 4, 2020

Fixed the shadowing warnings; will try to debug this:

cd libtecla; get-bc enhance; mv enhance.bc ../
mv: cannot stat ‘enhance.bc’: No such file or directory
make: *** [enhance.bc] Error 1
The command "./.travis/test.sh" exited with 2.

woodruffw

changed the title [WIP] extractor: Make extraction errors fatal

extractor: Make extraction errors fatal

on Aug 4, 2020

woodruffw

marked this pull request as ready for review

17 months ago

Copy link

Contributor

Author

woodruffw commented on Aug 4, 2020

Alright, this should be good for review now (apologies for the churn, I'm not much of a Go programmer...).

The CI is failing with this error:

get-bc -b ./lib/libc.a
ERROR:Error reading the .llvm_bc section of ELF file clone.o.

...but this is to be expected, since clone.o comes from an assembly translation unit for which there can be no bitcode:

gclang -std=c99 -nostdinc -ffreestanding -Wa,--noexecstack -D_XOPEN_SOURCE=700 -I./arch/LLVM -I./arch/generic -Iobj/src/internal -I./src/include -I./src/internal -Iobj/include -I./include  -Os -pipe -fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -Werror=implicit-function-declaration -Werror=implicit-int -Werror=pointer-sign -Werror=pointer-arith -Qunused-arguments  -c -o obj/src/thread/LLVM/clone.o src/thread/LLVM/clone.s

So this is more of a design question: should gllvm fail when the extracted/combined bitcode can't accurately reflect the original build?

Copy link

Member

ianamason commented on Aug 4, 2020

I think this is why we just warn when a segment is not found, because there is not much we can do, but we can
still forge ahead, letting the user know about the missing stuff.

"Don't let perfect be the enemy of good" is the design principle I think.

Now your version will no longer produce a final (less than perfect) bitcode result? Maybe this strictness would better be enabled by a command line switch? The default would then be the relaxed mode?

What is your motivation for this "strict" mode?

Copy link

Contributor

Author

woodruffw commented on Aug 4, 2020

Now your version will no longer produce a final (less than perfect) bitcode result? Maybe this strictness would better be enabled by a command line switch? The default would then be the relaxed mode?

What is your motivation for this "strict" mode?

Yep, exactly. It currently bails out instead of producing an (incomplete) unified bitcode module. Enabling this via a command-line switch sounds good to me. I can do that in a bit.

My motivation is a static analysis ecosystem that does semi-automated builds of target programs. This strict mode makes it easier to catch eventual problems with (re)compiling the bitcode due to missing symbols (i.e. the ones present in assembly TUs).

Copy link

Member

ianamason commented on Aug 4, 2020

Yes it makes sense in the semi automated setting. Our other design principle is to be a drop in replacement for wllvm.
Warts and all.

Copy link

Member

ianamason commented on Aug 4, 2020

Thanks. If you can I would like to hear more about the "We ended up taking another approach for capturing the command-line flags" saga. Doesn't have to be here, could be there: [email protected]

ianamason

merged commit 165d336 into

SRI-CSL:master on Aug 4, 2020

1 check passed

woodruffw

deleted the ww/make-extraction-errors-fatal branch

17 months ago

Copy link

Contributor

Author

woodruffw commented on Aug 4, 2020

Thanks for the merge! I'll see what I can share about the command-line flag capturing.

Would it be possible to get a quick release cut for these changes?

Copy link

Member

ianamason commented on Aug 4, 2020

Sure I will make a release this morning.

Copy link

Member

ianamason commented on Aug 4, 2020

v1.2.7 is live.

Copy link

Contributor

Author

woodruffw commented on Aug 4, 2020

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels
None yet
Projects

None yet

Milestone

No milestone

Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK