All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: kernel test robot <lkp@intel.com>,
	Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Christian Brauner <brauner@kernel.org>
Subject: Re: fs/exec.c:1307:26: sparse: sparse: incorrect type in argument 1 (different address spaces)
Date: Fri, 12 Jan 2024 16:32:14 +0100	[thread overview]
Message-ID: <87jzoein41.ffs@tglx> (raw)
In-Reply-To: <202401111036.STMizmwE-lkp@intel.com>

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



  reply	other threads:[~2024-01-12 15:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-11  2:44 fs/exec.c:1307:26: sparse: sparse: incorrect type in argument 1 (different address spaces) kernel test robot
2024-01-12 15:32 ` Thomas Gleixner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-12-28 19:27 kernel test robot
2023-12-10  6:35 kernel test robot
2023-12-05 21:45 kernel test robot
2023-12-04 21:44 kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87jzoein41.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=brauner@kernel.org \
    --cc=cascardo@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=paulmck@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.