[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c49ae41f-6031-014a-2c43-855e3bbff5e6@infradead.org>
Date: Mon, 4 Jan 2021 08:19:53 -0800
From: Randy Dunlap <rdunlap@...radead.org>
To: Peter Zijlstra <peterz@...radead.org>,
Josh Poimboeuf <jpoimboe@...hat.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, x86@...nel.org
Subject: Re: [PATCH] x86/compat: Pull huge_encode_dev() outside of UACCESS
On 1/4/21 7:53 AM, Peter Zijlstra wrote:
> On Mon, Jan 04, 2021 at 09:31:27AM -0600, Josh Poimboeuf wrote:
>> Peter, care to submit a proper patch?
>
> Here goes..
>
> ---
> Subject: x86/compat: Pull huge_encode_dev() outside of UACCESS
> From: Peter Zijlstra <peterz@...radead.org>
> Date: Mon, 4 Jan 2021 13:28:25 +0100
>
> Fixes the following warning:
>
> arch/x86/kernel/sys_ia32.o: warning: objtool: cp_stat64()+0xd8: call to new_encode_dev() with UACCESS enabled
>
> Reported-by: Randy Dunlap <rdunlap@...radead.org>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Acked-by: Randy Dunlap <rdunlap@...radead.org> # build-tested
Thanks.
> ---
> arch/x86/kernel/sys_ia32.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> --- a/arch/x86/kernel/sys_ia32.c
> +++ b/arch/x86/kernel/sys_ia32.c
> @@ -133,18 +133,23 @@ static int cp_stat64(struct stat64 __use
> {
> typeof(ubuf->st_uid) uid = 0;
> typeof(ubuf->st_gid) gid = 0;
> + u64 dev, rdev;
> +
> SET_UID(uid, from_kuid_munged(current_user_ns(), stat->uid));
> SET_GID(gid, from_kgid_munged(current_user_ns(), stat->gid));
> + dev = huge_encode_dev(stat->dev);
> + rdev = huge_encode_dev(stat->rdev);
> +
> if (!user_write_access_begin(ubuf, sizeof(struct stat64)))
> return -EFAULT;
> - unsafe_put_user(huge_encode_dev(stat->dev), &ubuf->st_dev, Efault);
> + unsafe_put_user(dev, &ubuf->st_dev, Efault);
> unsafe_put_user(stat->ino, &ubuf->__st_ino, Efault);
> unsafe_put_user(stat->ino, &ubuf->st_ino, Efault);
> unsafe_put_user(stat->mode, &ubuf->st_mode, Efault);
> unsafe_put_user(stat->nlink, &ubuf->st_nlink, Efault);
> unsafe_put_user(uid, &ubuf->st_uid, Efault);
> unsafe_put_user(gid, &ubuf->st_gid, Efault);
> - unsafe_put_user(huge_encode_dev(stat->rdev), &ubuf->st_rdev, Efault);
> + unsafe_put_user(rdev, &ubuf->st_rdev, Efault);
> unsafe_put_user(stat->size, &ubuf->st_size, Efault);
> unsafe_put_user(stat->atime.tv_sec, &ubuf->st_atime, Efault);
> unsafe_put_user(stat->atime.tv_nsec, &ubuf->st_atime_nsec, Efault);
>
--
~Randy
Powered by blists - more mailing lists