I'm way behind, so this is really just to let you know I haven't
forgotten and will get to this when I can (possibly after the release in
mid-August).  Sorry about the delay.

On Fri, Aug 03, 2018 at 10:51:39AM +0200, Bhargava Shastry wrote:
> Hello,
> 
> Gentle reminder to check if the proposed patch works :-)
> 
> Thanks,
> Bhargava
> 
> On 07/30/2018 11:58 AM, Bhargava Shastry wrote:
> > Any updates on the proposed patch? :-)
> > 
> > On 07/16/2018 02:07 PM, Bhargava Shastry wrote:
> >> Update: I fixed these errors in the attached patch that supersedes the
> >> patch here (https://patchwork.ozlabs.org/patch/942118/)
> >>
> >> The major change is that I add the following line for each fuzz target
> >> binary in the tests/oss-fuzz/automake.mk file:
> >>
> >> e.g.,
> >> tests_oss_fuzz_flow_extract_target_LDFLAGS = $(LIB_FUZZING_ENGINE) \
> >>                                             -lc++
> >>
> >> Regards,
> >> Bhargava
> >>
> >> On 07/16/2018 11:45 AM, Bhargava Shastry wrote:
> >>> Oops, here's the link failure log:
> >>>
> >>> ```
> >>> /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crt1.o: In
> >>> function `_start':
> >>> (.text+0x20): undefined reference to `main'
> >>> clang-7: error: linker command failed with exit code 1 (use -v to see
> >>> invocation)
> >>> Makefile:4159: recipe for target 'tests/oss-fuzz/flow_extract_target' 
> >>> failed
> >>> make: *** [tests/oss-fuzz/flow_extract_target] Error 1
> >>> fuzzers build failed.
> >>> ```
> >>>
> >>> The main symbol is provided by libfuzzer (clang++ -lFuzzingEngine)
> >>>
> >>> Regards,
> >>> Bhargava
> >>>
> >>> On 07/16/2018 11:36 AM, Bhargava Shastry wrote:
> >>>> Hi Ben,
> >>>>
> >>>>> Never mind that one, I failed to check in some of that.
> >>>>>
> >>>>> I sent it formally:
> >>>>>         https://patchwork.ozlabs.org/patch/942118/
> >>>>
> >>>> Thanks for the patch. This fixes the previous error. Now, there are some
> >>>> new errors during the compilation/linking process. I think most of this
> >>>> can be fixed if I figure out how automake works. In a nutshell, here's
> >>>> the problem:
> >>>>
> >>>> - oss-fuzz provides compilation flags that can be plugged in like so
> >>>> ```
> >>>> CC=clang
> >>>> CXX=clang++
> >>>> CFLAGS=-O1 -fno-omit-frame-pointer -gline-tables-only
> >>>> -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address
> >>>> -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link
> >>>> CXXFLAGS=-O1 -fno-omit-frame-pointer -gline-tables-only
> >>>> -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address
> >>>> -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link 
> >>>> -stdlib=libc++
> >>>> ```
> >>>>
> >>>> And here's what I used to do before
> >>>>
> >>>> - Use clang and CFLAGS above plus some additional includes to compile
> >>>> each of the fuzzer tests
> >>>> - Use clang++ and additional linker flags to link these into a fuzzer 
> >>>> binary
> >>>>
> >>>> Now, I see that the compilation works
> >>>> ```
> >>>> depbase=`echo tests/oss-fuzz/flow_extract_target.o | sed
> >>>> 's|[^/]*$|.deps/&|;s|\.o$||'`;\
> >>>> clang -DHAVE_CONFIG_H -I.    -I ./include -I ./include -I ./lib -I ./lib
> >>>> -I/usr/include   -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare
> >>>> -Wpointer-arith -Wformat -Wformat-security -Wswitch-enum
> >>>> -Wunused-parameter -Wbad-function-cast -Wcast-align -Wstrict-prototypes
> >>>> -Wold-style-definition -Wmissing-prototypes -Wmissing-field-initializers
> >>>> -Wthread-safety -fno-strict-aliasing -Wswitch-bool
> >>>> -Wlogical-not-parentheses -Wsizeof-array-argument -Wshift-negative-value
> >>>> -Qunused-arguments -Wshadow -Wno-null-pointer-arithmetic    -O1
> >>>> -fno-omit-frame-pointer -gline-tables-only
> >>>> -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address
> >>>> -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link -MT
> >>>> tests/oss-fuzz/flow_extract_target.o -MD -MP -MF $depbase.Tpo -c -o
> >>>> tests/oss-fuzz/flow_extract_target.o
> >>>> tests/oss-fuzz/flow_extract_target.c &&\
> >>>> mv -f $depbase.Tpo $depbase.Po
> >>>> ```
> >>>>
> >>>> However, the linking fails
> >>>> ```
> >>>> libtool: link: clang -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare
> >>>> -Wpointer-arith -Wformat -Wformat-security -Wswitch-enum
> >>>> -Wunused-parameter -Wbad-function-cast -Wcast-align -Wstrict-prototypes
> >>>> -Wold-style-definition -Wmissing-prototypes -Wmissing-field-initializers
> >>>> -Wthread-safety -fno-strict-aliasing -Wswitch-bool
> >>>> -Wlogical-not-parentheses -Wsizeof-array-argument -Wshift-negative-value
> >>>> -Qunused-arguments -Wshadow -Wno-null-pointer-arithmetic -O1
> >>>> -fno-omit-frame-pointer -gline-tables-only
> >>>> -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address
> >>>> -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link -o
> >>>> tests/oss-fuzz/flow_extract_target tests/oss-fuzz/flow_extract_target.o
> >>>> -L/usr/lib lib/.libs/libopenvswitch.a -lssl -lcrypto -latomic
> >>>> ```
> >>>>
> >>>> I think adding -lFuzzingEngine should fix this but another variable
> >>>> between my build script and automake is the use of clang++ for linking.
> >>>>
> >>>> Do you know how I can experiment with different linker flags and
> >>>> compiler/linker in automake?
> >>>>
> >>>> Regards,
> >>>> Bhargava
> >>>>
> >>>>
> >>>
> >>
> > 
> 
> -- 
> Bhargava Shastry <[email protected]>
> Security in Telecommunications
> TU Berlin / Telekom Innovation Laboratories
> Ernst-Reuter-Platz 7, Sekr TEL 17 / D - 10587 Berlin, Germany
> phone: +49 30 8353 58235
> Keybase: https://keybase.io/bshastry
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to