All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] signal: propagate __user annotations properly
@ 2020-12-07 12:36 ` Lukas Bulwahn
  0 siblings, 0 replies; 6+ messages in thread
From: Lukas Bulwahn @ 2020-12-07 12:36 UTC (permalink / raw)
  To: Christian Brauner, linux-kernel
  Cc: Tycho Andersen, Kees Cook, David Howells, Arnd Bergmann,
	Thomas Gleixner, Serge Hallyn, Aleksa Sarai, kernel-janitors,
	Lukas Bulwahn

Commit 3eb39f47934f ("signal: add pidfd_send_signal() syscall") introduced
copy_siginfo_from_user_any(), but missed to add the __user annotation to
the user pointer that is passed as second argument.

Hence, when copy_siginfo_from_user_any() calls copy_siginfo_from_user(),
sparse warns:

  kernel/signal.c:3716:46: warning: incorrect type in argument 2 (different address spaces)
  kernel/signal.c:3716:46:    expected struct siginfo const [noderef] [usertype] __user *from
  kernel/signal.c:3716:46:    got struct siginfo [usertype] *info

And when pidfd_send_signal() calls copy_siginfo_from_user_any(), sparse
warns as well:

  kernel/signal.c:3776:58: warning: incorrect type in argument 2 (different address spaces)
  kernel/signal.c:3776:58:    expected struct siginfo [usertype] *info
  kernel/signal.c:3776:58:    got struct siginfo [noderef] [usertype] __user *info

Add the __user annotation to repair this chain of propagating __user
annotations.

Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
---
applies cleanly on current master (v5.10-rc7) and next-20201204

Christian, please pick this minor non-urgent clean-up patch.

 kernel/signal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 5736c55aaa1a..e969b3bc815f 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -3701,7 +3701,7 @@ static bool access_pidfd_pidns(struct pid *pid)
 	return true;
 }
 
-static int copy_siginfo_from_user_any(kernel_siginfo_t *kinfo, siginfo_t *info)
+static int copy_siginfo_from_user_any(kernel_siginfo_t *kinfo, siginfo_t __user *info)
 {
 #ifdef CONFIG_COMPAT
 	/*
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] signal: propagate __user annotations properly
@ 2020-12-07 12:36 ` Lukas Bulwahn
  0 siblings, 0 replies; 6+ messages in thread
From: Lukas Bulwahn @ 2020-12-07 12:36 UTC (permalink / raw)
  To: Christian Brauner, linux-kernel
  Cc: Tycho Andersen, Kees Cook, David Howells, Arnd Bergmann,
	Thomas Gleixner, Serge Hallyn, Aleksa Sarai, kernel-janitors,
	Lukas Bulwahn

Commit 3eb39f47934f ("signal: add pidfd_send_signal() syscall") introduced
copy_siginfo_from_user_any(), but missed to add the __user annotation to
the user pointer that is passed as second argument.

Hence, when copy_siginfo_from_user_any() calls copy_siginfo_from_user(),
sparse warns:

  kernel/signal.c:3716:46: warning: incorrect type in argument 2 (different address spaces)
  kernel/signal.c:3716:46:    expected struct siginfo const [noderef] [usertype] __user *from
  kernel/signal.c:3716:46:    got struct siginfo [usertype] *info

And when pidfd_send_signal() calls copy_siginfo_from_user_any(), sparse
warns as well:

  kernel/signal.c:3776:58: warning: incorrect type in argument 2 (different address spaces)
  kernel/signal.c:3776:58:    expected struct siginfo [usertype] *info
  kernel/signal.c:3776:58:    got struct siginfo [noderef] [usertype] __user *info

Add the __user annotation to repair this chain of propagating __user
annotations.

Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
---
applies cleanly on current master (v5.10-rc7) and next-20201204

Christian, please pick this minor non-urgent clean-up patch.

 kernel/signal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 5736c55aaa1a..e969b3bc815f 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -3701,7 +3701,7 @@ static bool access_pidfd_pidns(struct pid *pid)
 	return true;
 }
 
-static int copy_siginfo_from_user_any(kernel_siginfo_t *kinfo, siginfo_t *info)
+static int copy_siginfo_from_user_any(kernel_siginfo_t *kinfo, siginfo_t __user *info)
 {
 #ifdef CONFIG_COMPAT
 	/*
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] signal: propagate __user annotations properly
  2020-12-07 12:36 ` Lukas Bulwahn
@ 2020-12-07 13:04   ` Christian Brauner
  -1 siblings, 0 replies; 6+ messages in thread
From: Christian Brauner @ 2020-12-07 13:04 UTC (permalink / raw)
  To: Lukas Bulwahn
  Cc: Christian Brauner, linux-kernel, Tycho Andersen, Kees Cook,
	David Howells, Arnd Bergmann, Thomas Gleixner, Serge Hallyn,
	Aleksa Sarai, kernel-janitors

On Mon, Dec 07, 2020 at 01:36:10PM +0100, Lukas Bulwahn wrote:
> Commit 3eb39f47934f ("signal: add pidfd_send_signal() syscall") introduced
> copy_siginfo_from_user_any(), but missed to add the __user annotation to
> the user pointer that is passed as second argument.
> 
> Hence, when copy_siginfo_from_user_any() calls copy_siginfo_from_user(),
> sparse warns:
> 
>   kernel/signal.c:3716:46: warning: incorrect type in argument 2 (different address spaces)
>   kernel/signal.c:3716:46:    expected struct siginfo const [noderef] [usertype] __user *from
>   kernel/signal.c:3716:46:    got struct siginfo [usertype] *info
> 
> And when pidfd_send_signal() calls copy_siginfo_from_user_any(), sparse
> warns as well:
> 
>   kernel/signal.c:3776:58: warning: incorrect type in argument 2 (different address spaces)
>   kernel/signal.c:3776:58:    expected struct siginfo [usertype] *info
>   kernel/signal.c:3776:58:    got struct siginfo [noderef] [usertype] __user *info
> 
> Add the __user annotation to repair this chain of propagating __user
> annotations.
> 
> Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
> ---
> applies cleanly on current master (v5.10-rc7) and next-20201204
> 
> Christian, please pick this minor non-urgent clean-up patch.

Thanks for the patch. Unfortunately I already picked up Jann's patch who
sent it yesterday or this morning:
https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git/commit/?h=pidfd

Thanks!
Christian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] signal: propagate __user annotations properly
@ 2020-12-07 13:04   ` Christian Brauner
  0 siblings, 0 replies; 6+ messages in thread
From: Christian Brauner @ 2020-12-07 13:04 UTC (permalink / raw)
  To: Lukas Bulwahn
  Cc: Christian Brauner, linux-kernel, Tycho Andersen, Kees Cook,
	David Howells, Arnd Bergmann, Thomas Gleixner, Serge Hallyn,
	Aleksa Sarai, kernel-janitors

On Mon, Dec 07, 2020 at 01:36:10PM +0100, Lukas Bulwahn wrote:
> Commit 3eb39f47934f ("signal: add pidfd_send_signal() syscall") introduced
> copy_siginfo_from_user_any(), but missed to add the __user annotation to
> the user pointer that is passed as second argument.
> 
> Hence, when copy_siginfo_from_user_any() calls copy_siginfo_from_user(),
> sparse warns:
> 
>   kernel/signal.c:3716:46: warning: incorrect type in argument 2 (different address spaces)
>   kernel/signal.c:3716:46:    expected struct siginfo const [noderef] [usertype] __user *from
>   kernel/signal.c:3716:46:    got struct siginfo [usertype] *info
> 
> And when pidfd_send_signal() calls copy_siginfo_from_user_any(), sparse
> warns as well:
> 
>   kernel/signal.c:3776:58: warning: incorrect type in argument 2 (different address spaces)
>   kernel/signal.c:3776:58:    expected struct siginfo [usertype] *info
>   kernel/signal.c:3776:58:    got struct siginfo [noderef] [usertype] __user *info
> 
> Add the __user annotation to repair this chain of propagating __user
> annotations.
> 
> Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
> ---
> applies cleanly on current master (v5.10-rc7) and next-20201204
> 
> Christian, please pick this minor non-urgent clean-up patch.

Thanks for the patch. Unfortunately I already picked up Jann's patch who
sent it yesterday or this morning:
https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git/commit/?h=pidfd

Thanks!
Christian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] signal: propagate __user annotations properly
  2020-12-07 13:04   ` Christian Brauner
@ 2020-12-07 13:06     ` Lukas Bulwahn
  -1 siblings, 0 replies; 6+ messages in thread
From: Lukas Bulwahn @ 2020-12-07 13:06 UTC (permalink / raw)
  To: Christian Brauner
  Cc: Christian Brauner, Linux Kernel Mailing List, Tycho Andersen,
	Kees Cook, David Howells, Arnd Bergmann, Thomas Gleixner,
	Serge Hallyn, Aleksa Sarai, kernel-janitors

On Mon, Dec 7, 2020 at 2:04 PM Christian Brauner
<christian.brauner@ubuntu.com> wrote:
>
> On Mon, Dec 07, 2020 at 01:36:10PM +0100, Lukas Bulwahn wrote:
> > Commit 3eb39f47934f ("signal: add pidfd_send_signal() syscall") introduced
> > copy_siginfo_from_user_any(), but missed to add the __user annotation to
> > the user pointer that is passed as second argument.
> >
> > Hence, when copy_siginfo_from_user_any() calls copy_siginfo_from_user(),
> > sparse warns:
> >
> >   kernel/signal.c:3716:46: warning: incorrect type in argument 2 (different address spaces)
> >   kernel/signal.c:3716:46:    expected struct siginfo const [noderef] [usertype] __user *from
> >   kernel/signal.c:3716:46:    got struct siginfo [usertype] *info
> >
> > And when pidfd_send_signal() calls copy_siginfo_from_user_any(), sparse
> > warns as well:
> >
> >   kernel/signal.c:3776:58: warning: incorrect type in argument 2 (different address spaces)
> >   kernel/signal.c:3776:58:    expected struct siginfo [usertype] *info
> >   kernel/signal.c:3776:58:    got struct siginfo [noderef] [usertype] __user *info
> >
> > Add the __user annotation to repair this chain of propagating __user
> > annotations.
> >
> > Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
> > ---
> > applies cleanly on current master (v5.10-rc7) and next-20201204
> >
> > Christian, please pick this minor non-urgent clean-up patch.
>
> Thanks for the patch. Unfortunately I already picked up Jann's patch who
> sent it yesterday or this morning:
> https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git/commit/?h=pidfd
>

Thanks for letting me know and good to know that Jann is tracking
those sparse warnings as well :)

Lukas

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] signal: propagate __user annotations properly
@ 2020-12-07 13:06     ` Lukas Bulwahn
  0 siblings, 0 replies; 6+ messages in thread
From: Lukas Bulwahn @ 2020-12-07 13:06 UTC (permalink / raw)
  To: Christian Brauner
  Cc: Christian Brauner, Linux Kernel Mailing List, Tycho Andersen,
	Kees Cook, David Howells, Arnd Bergmann, Thomas Gleixner,
	Serge Hallyn, Aleksa Sarai, kernel-janitors

On Mon, Dec 7, 2020 at 2:04 PM Christian Brauner
<christian.brauner@ubuntu.com> wrote:
>
> On Mon, Dec 07, 2020 at 01:36:10PM +0100, Lukas Bulwahn wrote:
> > Commit 3eb39f47934f ("signal: add pidfd_send_signal() syscall") introduced
> > copy_siginfo_from_user_any(), but missed to add the __user annotation to
> > the user pointer that is passed as second argument.
> >
> > Hence, when copy_siginfo_from_user_any() calls copy_siginfo_from_user(),
> > sparse warns:
> >
> >   kernel/signal.c:3716:46: warning: incorrect type in argument 2 (different address spaces)
> >   kernel/signal.c:3716:46:    expected struct siginfo const [noderef] [usertype] __user *from
> >   kernel/signal.c:3716:46:    got struct siginfo [usertype] *info
> >
> > And when pidfd_send_signal() calls copy_siginfo_from_user_any(), sparse
> > warns as well:
> >
> >   kernel/signal.c:3776:58: warning: incorrect type in argument 2 (different address spaces)
> >   kernel/signal.c:3776:58:    expected struct siginfo [usertype] *info
> >   kernel/signal.c:3776:58:    got struct siginfo [noderef] [usertype] __user *info
> >
> > Add the __user annotation to repair this chain of propagating __user
> > annotations.
> >
> > Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
> > ---
> > applies cleanly on current master (v5.10-rc7) and next-20201204
> >
> > Christian, please pick this minor non-urgent clean-up patch.
>
> Thanks for the patch. Unfortunately I already picked up Jann's patch who
> sent it yesterday or this morning:
> https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git/commit/?h=pidfd
>

Thanks for letting me know and good to know that Jann is tracking
those sparse warnings as well :)

Lukas

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-12-07 13:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-07 12:36 [PATCH] signal: propagate __user annotations properly Lukas Bulwahn
2020-12-07 12:36 ` Lukas Bulwahn
2020-12-07 13:04 ` Christian Brauner
2020-12-07 13:04   ` Christian Brauner
2020-12-07 13:06   ` Lukas Bulwahn
2020-12-07 13:06     ` Lukas Bulwahn

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.