Re: [PATCH] kernel.h: Disable -Wreturn-stack-address for _THIS_IP_

From: Nick Desaulniers
Date: Tue Jul 31 2018 - 12:47:13 EST


I think this is the v1 of this patch, also reported by Nathan
Chancellor? Hard to tell as the github link is dead. Does 0-day
delete its branches if there's a v2?
On Mon, Jul 30, 2018 at 11:50 PM kbuild test robot <lkp@xxxxxxxxx> wrote:
>
> Hi Nick,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on linus/master]
> [also build test WARNING on v4.18-rc7 next-20180727]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url: https://github.com/0day-ci/linux/commits/Nick-Desaulniers/kernel-h-Disable-Wreturn-stack-address-for-_THIS_IP_/20180731-135818
> config: i386-tinyconfig (attached as .config)
> compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=i386
>
> All warnings (new ones prefixed by >>):
>
> In file included from include/linux/spinlock.h:58:0,
> from include/linux/mmzone.h:8,
> from include/linux/gfp.h:6,
> from include/linux/slab.h:15,
> from include/linux/crypto.h:24,
> from arch/x86/kernel/asm-offsets.c:9:
> include/linux/bottom_half.h: In function 'local_bh_disable':
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
>
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/bottom_half.h: In function 'local_bh_enable':
> include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
>
> include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> In file included from include/linux/mmzone.h:8:0,
> from include/linux/gfp.h:6,
> from include/linux/slab.h:15,
> from include/linux/crypto.h:24,
> from arch/x86/kernel/asm-offsets.c:9:
> include/linux/spinlock.h: In function 'spin_lock_bh':
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> raw_spin_lock_bh(&lock->rlock);
>
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/spinlock.h: In function 'spin_unlock_bh':
> include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> raw_spin_unlock_bh(&lock->rlock);
>
> include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/spinlock.h: In function 'spin_trylock_bh':
> include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> return raw_spin_trylock_bh(&lock->rlock);
>
> include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> --
> In file included from include/linux/rcupdate.h:41:0,
> from include/linux/rculist.h:11,
> from include/linux/pid.h:5,
> from include/linux/sched.h:14,
> from kernel//sched/sched.h:5,
> from kernel//sched/core.c:8:
> include/linux/bottom_half.h: In function 'local_bh_disable':
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
>
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/bottom_half.h: In function 'local_bh_enable':
> include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
>
> include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> In file included from include/linux/seqlock.h:36:0,
> from include/linux/time.h:6,
> from include/linux/ktime.h:24,
> from include/linux/rcutiny.h:28,
> from include/linux/rcupdate.h:210,
> from include/linux/rculist.h:11,
> from include/linux/pid.h:5,
> from include/linux/sched.h:14,
> from kernel//sched/sched.h:5,
> from kernel//sched/core.c:8:
> include/linux/spinlock.h: In function 'spin_lock_bh':
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> raw_spin_lock_bh(&lock->rlock);
>
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/spinlock.h: In function 'spin_unlock_bh':
> include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> raw_spin_unlock_bh(&lock->rlock);
>
> include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/spinlock.h: In function 'spin_trylock_bh':
> include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> return raw_spin_trylock_bh(&lock->rlock);
>
> include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> kernel//sched/core.c: In function 'prepare_lock_switch':
> >> kernel//sched/core.c:2590:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> spin_release(&rq->lock.dep_map, 1, _THIS_IP_);
>
> >> kernel//sched/core.c:2590:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> >> kernel//sched/core.c:2590:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> kernel//sched/core.c: In function 'finish_lock_switch':
> kernel//sched/core.c:2604:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> spin_acquire(&rq->lock.dep_map, 0, 0, _THIS_IP_);
>
> kernel//sched/core.c:2604:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> kernel//sched/core.c:2604:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> --
> In file included from include/linux/spinlock.h:58:0,
> from include/linux/irq.h:14,
> from arch/x86/include/asm/hardirq.h:6,
> from include/linux/hardirq.h:9,
> from include/linux/interrupt.h:11,
> from include/linux/kernel_stat.h:9,
> from kernel//time/timer.c:22:
> include/linux/bottom_half.h: In function 'local_bh_disable':
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
>
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/bottom_half.h: In function 'local_bh_enable':
> include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
>
> include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> In file included from include/linux/irq.h:14:0,
> from arch/x86/include/asm/hardirq.h:6,
> from include/linux/hardirq.h:9,
> from include/linux/interrupt.h:11,
> from include/linux/kernel_stat.h:9,
> from kernel//time/timer.c:22:
> include/linux/spinlock.h: In function 'spin_lock_bh':
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> raw_spin_lock_bh(&lock->rlock);
>
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/spinlock.h: In function 'spin_unlock_bh':
> include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> raw_spin_unlock_bh(&lock->rlock);
>
> include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/spinlock.h: In function 'spin_trylock_bh':
> include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> return raw_spin_trylock_bh(&lock->rlock);
>
> include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> kernel//time/timer.c: In function 'call_timer_fn':
> >> kernel//time/timer.c:1323:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> lock_map_acquire(&lockdep_map);
>
> >> kernel//time/timer.c:1323:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> >> kernel//time/timer.c:1323:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> --
> In file included from include/linux/rcupdate.h:41:0,
> from include/linux/rculist.h:11,
> from include/linux/pid.h:5,
> from include/linux/sched.h:14,
> from kernel///sched/sched.h:5,
> from kernel///sched/core.c:8:
> include/linux/bottom_half.h: In function 'local_bh_disable':
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
>
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/bottom_half.h: In function 'local_bh_enable':
> include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
>
> include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> In file included from include/linux/seqlock.h:36:0,
> from include/linux/time.h:6,
> from include/linux/ktime.h:24,
> from include/linux/rcutiny.h:28,
> from include/linux/rcupdate.h:210,
> from include/linux/rculist.h:11,
> from include/linux/pid.h:5,
> from include/linux/sched.h:14,
> from kernel///sched/sched.h:5,
> from kernel///sched/core.c:8:
> include/linux/spinlock.h: In function 'spin_lock_bh':
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> raw_spin_lock_bh(&lock->rlock);
>
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/spinlock.h: In function 'spin_unlock_bh':
> include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> raw_spin_unlock_bh(&lock->rlock);
>
> include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/spinlock.h: In function 'spin_trylock_bh':
> include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> return raw_spin_trylock_bh(&lock->rlock);
>
> include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> kernel///sched/core.c: In function 'prepare_lock_switch':
> kernel///sched/core.c:2590:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> spin_release(&rq->lock.dep_map, 1, _THIS_IP_);
>
> kernel///sched/core.c:2590:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> kernel///sched/core.c:2590:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> kernel///sched/core.c: In function 'finish_lock_switch':
> kernel///sched/core.c:2604:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> spin_acquire(&rq->lock.dep_map, 0, 0, _THIS_IP_);
>
> kernel///sched/core.c:2604:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> kernel///sched/core.c:2604:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> --
> In file included from include/linux/spinlock.h:58:0,
> from include/linux/irq.h:14,
> from arch/x86/include/asm/hardirq.h:6,
> from include/linux/hardirq.h:9,
> from include/linux/interrupt.h:11,
> from include/linux/kernel_stat.h:9,
> from kernel///time/timer.c:22:
> include/linux/bottom_half.h: In function 'local_bh_disable':
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
>
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/bottom_half.h: In function 'local_bh_enable':
> include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
>
> include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> In file included from include/linux/irq.h:14:0,
> from arch/x86/include/asm/hardirq.h:6,
> from include/linux/hardirq.h:9,
> from include/linux/interrupt.h:11,
> from include/linux/kernel_stat.h:9,
> from kernel///time/timer.c:22:
> include/linux/spinlock.h: In function 'spin_lock_bh':
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> raw_spin_lock_bh(&lock->rlock);
>
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/spinlock.h: In function 'spin_unlock_bh':
> include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> raw_spin_unlock_bh(&lock->rlock);
>
> include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/spinlock.h: In function 'spin_trylock_bh':
> include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> return raw_spin_trylock_bh(&lock->rlock);
>
> include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> kernel///time/timer.c: In function 'call_timer_fn':
> kernel///time/timer.c:1323:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> lock_map_acquire(&lockdep_map);
>
> kernel///time/timer.c:1323:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> kernel///time/timer.c:1323:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>
> vim +19 include/linux/bottom_half.h
>
> 0bd3a173 Peter Zijlstra 2013-11-19 16
> 0bd3a173 Peter Zijlstra 2013-11-19 17 static inline void local_bh_disable(void)
> 0bd3a173 Peter Zijlstra 2013-11-19 18 {
> 0bd3a173 Peter Zijlstra 2013-11-19 @19 __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
> 0bd3a173 Peter Zijlstra 2013-11-19 20 }
> 0bd3a173 Peter Zijlstra 2013-11-19 21
>
> :::::: The code at line 19 was first introduced by commit
> :::::: 0bd3a173d711857fc9f583eb5825386cc08f3948 sched/preempt, locking: Rework local_bh_{dis,en}able()
>
> :::::: TO: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> :::::: CC: Ingo Molnar <mingo@xxxxxxxxxx>
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation



--
Thanks,
~Nick Desaulniers