Simple Setup Problem

219 views
Skip to first unread message

dastig...@gmail.com

unread,
May 16, 2017, 6:29:00 AM5/16/17
to syzkaller
Hello!

I was trying to reproduce the Wiki page here .
The first problem I have, appears here: sudo chroot wheezy /bin/bash -c "cd /tmp/ktsan/tools/perf/; make"
ktsan was not found as a directory in the copied kernel...so I cloned ktsan into the wheezy image and compiled perf.
Now that I wanted to run qemu, I needed to compile a bzImage (make CC='$GCC/install/bin/gcc' bzImage), which resulted in the following error(s):

  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CHK     include/generated/bounds.h
  CHK     include/generated/timeconst.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CHK     scripts/mod/devicetable-offsets.h
  CHK     include/generated/compile.h
  CC      drivers/gpu/drm/i915/i915_gem_request.o
In file included from ./include/uapi/linux/stddef.h:1:0,
                 from ./include/linux/stddef.h:4,
                 from ./include/uapi/linux/posix_types.h:4,
                 from ./include/uapi/linux/types.h:13,
                 from ./include/linux/types.h:5,
                 from ./include/linux/prefetch.h:13,
                 from drivers/gpu/drm/i915/i915_gem_request.c:25:
drivers/gpu/drm/i915/i915_gem_request.c: In function ‘reserve_seqno’:
drivers/gpu/drm/i915/i915_utils.h:48:2: error: implicit declaration of function ‘__builtin_add_overflow_p’ [-Werror=implicit-function-declaration]
  __builtin_add_overflow_p((A), (B), (typeof((A) + (B)))0)
  ^
./include/linux/compiler.h:178:40: note: in definition of macro ‘likely’
 # define likely(x) __builtin_expect(!!(x), 1)
                                        ^
drivers/gpu/drm/i915/i915_gem_request.c:250:14: note: in expansion of macro ‘add_overflows’
  if (likely(!add_overflows(seqno, active)))
              ^~~~~~~~~~~~~
cc1: some warnings being treated as errors
scripts/Makefile.build:302: recipe for target 'drivers/gpu/drm/i915/i915_gem_request.o' failed
make[4]: *** [drivers/gpu/drm/i915/i915_gem_request.o] Error 1
scripts/Makefile.build:561: recipe for target 'drivers/gpu/drm/i915' failed
make[3]: *** [drivers/gpu/drm/i915] Error 2
scripts/Makefile.build:561: recipe for target 'drivers/gpu/drm' failed
make[2]: *** [drivers/gpu/drm] Error 2
scripts/Makefile.build:561: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
Makefile:1016: recipe for target 'drivers' failed
make: *** [drivers] Error 2

The exact GCC version is gcc (GCC) 7.0.0 20160427.
Sorry for the very basic question, but it is driving me nuts :)

Thanks,
Hermann

Dmitry Vyukov

unread,
May 16, 2017, 2:42:17 PM5/16/17
to dastig...@gmail.com, syzkaller
On Tue, May 16, 2017 at 3:28 AM, <dastig...@gmail.com> wrote:
> Hello!
>
> I was trying to reproduce the Wiki page here .
> The first problem I have, appears here: sudo chroot wheezy /bin/bash -c "cd
> /tmp/ktsan/tools/perf/; make"
> ktsan was not found as a directory in the copied kernel...so I cloned ktsan
> into the wheezy image and compiled perf.


Hi Hermann,

Andrey has updated the instructions several hours ago. Please check
the updated version.

First, that step is optional. It is now marked as "not required to run
syzkaller".
Then, The dir should be "linux" (i.e. linux kernel checkout, it
contains tools/perf subdir), not "ktsan".
drivers/gpu/drm/i915/i915_utils.h contains the following code:

#if GCC_VERSION >= 70000
#define add_overflows(A, B) \
__builtin_add_overflow_p((A), (B), (typeof((A) + (B)))0)
#else
#define add_overflows(A, B) ({ \
typeof(A) a = (A); \
typeof(B) b = (B); \
a + b < a; \
})
#endif

I think the "GCC_VERSION >= 70000" condition is slightly wrong. It
works with gcc 6.0 and I think it worked for us with gcc 7.1.

I can suggest 2 options:
1. patch drivers/gpu/drm/i915/i915_utils.h to use 70100, so that you
will get the version that does not use the builtin.
2. Update gcc to 7.1 and check if it works.

Ideally we also fix upstream kernel code, but I can't understand at
what exactly gcc version the builtin was introduced.

dastig...@gmail.com

unread,
May 16, 2017, 4:24:51 PM5/16/17
to syzkaller, dastig...@gmail.com
Hi Dmitry,

thanks a lot for answering all of my mails. Andrey was so kind and fixed the wiki, yes :)

Well, my solution was to revert to the 4.11.1 stable kernel, which also compiled.
When starting qemu, I had an instant kernel panic.
This was solved by reverting to the latest GCC6.

Now I can at least boot the virtual machien :)

Thanks for your help. Very much appreciated, Dmitry!

Dmitry Vyukov

unread,
May 16, 2017, 4:29:29 PM5/16/17
to dastig...@gmail.com, syzkaller
On Tue, May 16, 2017 at 1:24 PM, <dastig...@gmail.com> wrote:
> Hi Dmitry,
>
> thanks a lot for answering all of my mails. Andrey was so kind and fixed the
> wiki, yes :)
>
> Well, my solution was to revert to the 4.11.1 stable kernel, which also
> compiled.
> When starting qemu, I had an instant kernel panic.
> This was solved by reverting to the latest GCC6.

We've seen some issues with KASAN and gcc 7.0. Updating to 7.1 fixed
these. But gcc 6 is good enough.

> Now I can at least boot the virtual machien :)
>
> Thanks for your help. Very much appreciated, Dmitry!

You are welcome.
> --
> You received this message because you are subscribed to the Google Groups
> "syzkaller" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to syzkaller+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages