kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lukas Bulwahn <lukas.bulwahn@gmail.com>
To: Christian Brauner <christian@brauner.io>, linux-kernel@vger.kernel.org
Cc: Tycho Andersen <tycho@tycho.ws>,
	Kees Cook <keescook@chromium.org>,
	David Howells <dhowells@redhat.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Serge Hallyn <serge@hallyn.com>, Aleksa Sarai <cyphar@cyphar.com>,
	kernel-janitors@vger.kernel.org,
	Lukas Bulwahn <lukas.bulwahn@gmail.com>
Subject: [PATCH] signal: propagate __user annotations properly
Date: Mon, 07 Dec 2020 12:36:10 +0000	[thread overview]
Message-ID: <20201207123610.18246-1-lukas.bulwahn@gmail.com> (raw)

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

             reply	other threads:[~2020-12-07 12:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-07 12:36 Lukas Bulwahn [this message]
2020-12-07 13:04 ` [PATCH] signal: propagate __user annotations properly Christian Brauner
2020-12-07 13:06   ` Lukas Bulwahn

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=20201207123610.18246-1-lukas.bulwahn@gmail.com \
    --to=lukas.bulwahn@gmail.com \
    --cc=arnd@arndb.de \
    --cc=christian@brauner.io \
    --cc=cyphar@cyphar.com \
    --cc=dhowells@redhat.com \
    --cc=keescook@chromium.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=serge@hallyn.com \
    --cc=tglx@linutronix.de \
    --cc=tycho@tycho.ws \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).