Message ID | 20230917214220.637721-2-jinghao7@illinois.edu (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | BPF |
Headers | show |
Series | samples/bpf: syscall_tp_user: Refactor and fix array index out-of-bounds bug | expand |
On Sun, Sep 17, 2023 at 2:43 PM Jinghao Jia <jinghao7@illinois.edu> wrote: > > From: Jinghao Jia <jinghao@linux.ibm.com> > > The sanitizer flag, which is supported by both clang and gcc, would make > it easier to debug array index out-of-bounds problems in these programs. > > Suggested-by: Mimi Zohar <zohar@linux.ibm.com> > Signed-off-by: Jinghao Jia <jinghao@linux.ibm.com> > Signed-off-by: Ruowen Qin <ruowenq2@illinois.edu> > Signed-off-by: Jinghao Jia <jinghao7@illinois.edu> > --- > samples/bpf/Makefile | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile > index 4ccf4236031c..21d2edffce3c 100644 > --- a/samples/bpf/Makefile > +++ b/samples/bpf/Makefile > @@ -169,6 +169,7 @@ endif > TPROGS_CFLAGS += -Wall -O2 > TPROGS_CFLAGS += -Wmissing-prototypes > TPROGS_CFLAGS += -Wstrict-prototypes > +TPROGS_CFLAGS += -fsanitize=bounds Patches 2 and 3 look great. Thanks for the fixes, but this one is too aggressive to force on developers. I think ubsan doesn't come by default in fedora gcc. Could you make the makefile smarter and detect the presence of ubsan in the compiler at build time? I've applied patches 2 and 3 in the meantime.
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 4ccf4236031c..21d2edffce3c 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -169,6 +169,7 @@ endif TPROGS_CFLAGS += -Wall -O2 TPROGS_CFLAGS += -Wmissing-prototypes TPROGS_CFLAGS += -Wstrict-prototypes +TPROGS_CFLAGS += -fsanitize=bounds TPROGS_CFLAGS += -I$(objtree)/usr/include TPROGS_CFLAGS += -I$(srctree)/tools/testing/selftests/bpf/