[PATCH] D27238: [libFuzzer] Diff 7 - Improve Signal Handler interface.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 12 08:55:47 PST 2016


I think making the assumption proposed by kcc@ is fine.  This kind of
pattern of declaring a "global" in main and passing it through an entire
application is common enough that don't think it would confuse anyone.
That said, if you think a little extra documentation would be helpful, a
comment in main where it's declared wouldn't hurt.

On Mon, Dec 12, 2016 at 8:24 AM Marcos Pividori via Phabricator <
reviews at reviews.llvm.org> wrote:

> mpividori added inline comments.
>
>
> ================
> Comment at: lib/Fuzzer/FuzzerUtilWindows.cpp:30
>
> -LONG WINAPI SEGVHandler(PEXCEPTION_POINTERS ExceptionInfo) {
> +static struct {
> +   bool HandleAbrt = false;
> ----------------
> mpividori wrote:
> > kcc wrote:
> > > mpividori wrote:
> > > > kcc wrote:
> > > > > mpividori wrote:
> > > > > > kcc wrote:
> > > > > > > Why do you need a copy of the flags?
> > > > > > @kcc,
> > > > > > We can't save a reference to Options, because we don't know when
> it will be destroyed. The ExceptionHandler() function must access to
> Handler option the entire life of the program.
> > > > > you can rely on this FuzzingOptions object to be live throughout
> the process.
> > > > @kcc I wanted to avoid that kind of assumptions. But if you prefer I
> can do that.....
> > > the options is a global scope object. It's not an assumption, it's a
> contract, all of the rest of the code rely on it.
> > @kcc , it is not strictly global, it is defined inside `FuzzerDriver()`.
> It will work fine now because we don't do anything after returning from
> `FuzzerDriver()`. In the future, if we change the code and do something
> else after executing `FuzzerDriver()` which generates an exception, we are
> in troubles. We must remember this assumption ....
> > Thanks,
> @zturner What is your opinion on this?
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D27238
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161212/1c854c49/attachment.html>


More information about the llvm-commits mailing list