[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87jzoein41.ffs@tglx>
Date: Fri, 12 Jan 2024 16:32:14 +0100
From: Thomas Gleixner <tglx@...utronix.de>
To: kernel test robot <lkp@...el.com>, Thadeu Lima de Souza Cascardo
<cascardo@...onical.com>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org, "Paul E.
McKenney" <paulmck@...nel.org>, Christian Brauner <brauner@...nel.org>
Subject: Re: fs/exec.c:1307:26: sparse: sparse: incorrect type in argument 1
(different address spaces)
On Thu, Jan 11 2024 at 10:44, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: acc657692aed438e9931438f8c923b2b107aebf9
> commit: e362359ace6f87c201531872486ff295df306d13 posix-cpu-timers: Cleanup CPU timers before freeing them during exec
> date: 1 year, 5 months ago
I'm amused that it took 17 month ....
>>> fs/exec.c:1307:26: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
> 1305
> 1306 #ifdef CONFIG_POSIX_TIMERS
>> 1307 spin_lock_irq(&me->sighand->siglock);
> 1308 posix_cpu_timers_exit(me);
> 1309 spin_unlock_irq(&me->sighand->siglock);
> 1310 exit_itimers(me);
> 1311 flush_itimer_signals();
> 1312 #endif
So this warning is clearly wrong because 'current->sighand->siglock' is
safe to dereference w/o RCU protection for 'current'.
The real issue is this commit:
913292c97d75 ("sched.h: Annotate sighand_struct with __rcu")
which blindly 'fixed' a sparse warning in signal.c w/o even trying to
look at the consequences. There are 170+ instances of spin_[un]lock()
variants which should emit exactly the same warning...
I think the right fix is to annotate this legit case of derefencing
current->sighand->siglock so sparse knows that this is safe.
Thanks,
tglx
Powered by blists - more mailing lists