On Thu, 21 Nov 2019 at 19:43, Marco Elver <elver@xxxxxxxxxx> wrote: > > On Thu, 21 Nov 2019 at 19:37, Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote: > > > > On Wed, Nov 20, 2019 at 08:48:41PM +0100, Marco Elver wrote: > > > On Wed, 20 Nov 2019 at 17:18, Randy Dunlap <rdunlap@xxxxxxxxxxxxx> wrote: > > > > > > > > On 11/20/19 1:34 AM, Stephen Rothwell wrote: > > > > > Hi all, > > > > > > > > > > Changes since 20191119: > > > > > > > > > > > > > on x86_64: > > > > > > > > kernel/kcsan/core.o: warning: objtool: kcsan_found_watchpoint()+0xa: call to kcsan_is_enabled() with UACCESS enabled > > > > kernel/kcsan/core.o: warning: objtool: __tsan_read1()+0x13: call to find_watchpoint() with UACCESS enabled > > > > kernel/kcsan/core.o: warning: objtool: __tsan_write1()+0x10: call to find_watchpoint() with UACCESS enabled > > > > kernel/kcsan/core.o: warning: objtool: __tsan_read2()+0x13: call to find_watchpoint() with UACCESS enabled > > > > kernel/kcsan/core.o: warning: objtool: __tsan_write2()+0x10: call to find_watchpoint() with UACCESS enabled > > > > kernel/kcsan/core.o: warning: objtool: __tsan_read4()+0x13: call to find_watchpoint() with UACCESS enabled > > > > kernel/kcsan/core.o: warning: objtool: __tsan_write4()+0x10: call to find_watchpoint() with UACCESS enabled > > > > kernel/kcsan/core.o: warning: objtool: __tsan_read8()+0x13: call to find_watchpoint() with UACCESS enabled > > > > kernel/kcsan/core.o: warning: objtool: __tsan_write8()+0x10: call to find_watchpoint() with UACCESS enabled > > > > kernel/kcsan/core.o: warning: objtool: __tsan_read16()+0x13: call to find_watchpoint() with UACCESS enabled > > > > kernel/kcsan/core.o: warning: objtool: __tsan_write16()+0x10: call to find_watchpoint() with UACCESS enabled > > > > kernel/kcsan/core.o: warning: objtool: __tsan_read_range()+0x13: call to find_watchpoint() with UACCESS enabled > > > > kernel/kcsan/core.o: warning: objtool: __tsan_write_range()+0x10: call to find_watchpoint() with UACCESS enabled > > > > > > > > kernel/trace/trace_branch.o: warning: objtool: ftrace_likely_update()+0x361: call to __stack_chk_fail() with UACCESS enabled > > > > > > > > > > > > Full randconfig file is attached. > > > > > > Thanks. > > > > > > This is due to CONFIG_CC_OPTIMIZE_FOR_SIZE=y. It seems the compiler > > > decides to not even inline small static inline functions. I tried to > > > make this go away by adding __always_inline, but then we're also left > > > with atomic64_try_cmpxchg which never gets inlined. > > > > > > The optimized build simply inlines the small static inline functions. > > > We certainly do not want to add more functions to the objtool > > > whitelist, especially those that are private to KCSAN. > > > > > > We could fix it by either: > > > > > > 1. Adding __always_inline to every function used by the KCSAN runtime > > > outside user_access_save + also fix atomic64_try_cmpxchg > > > (atomic-instrumented.h). > > > > > > 2. Just not compile KCSAN with -Os, i.e. have the Makefile strip -Os > > > and replace it with -O2 for kcsan/core.c. #2 is the simpler option, > > > and would probably make KCSAN more effective even with -Os. Although > > > it might violate the assumption of whoever decided they want both > > > CC_OPTIMIZE_FOR_SIZE and KCSAN. It might also mean that future > > > compilers that have a new inlining algorithm will have the same > > > problem. > > > > > > What do people think is better? > > > > I haven't had a chance to look at this yet, and probably won't be able > > to do so until at least Monday... > > > > Adding PeterZ who's the objtool uaccess expert. > > Thanks. I have a patch which does #1, since it's probably cleaner. I > will send it out soon. > > If there is a better way to resolve this, any suggestions welcome. I have sent a patch which addresses the issue: http://lkml.kernel.org/r/20191122154221.247680-1-elver@xxxxxxxxxx It is currently based on the locking/kcsan branch of the tip tree. Thanks, -- Marco