[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191028071856.GA1944@kadam>
Date: Mon, 28 Oct 2019 10:18:56 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Joe Perches <joe@...ches.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>,
Dan Carpenter <error27@...il.com>,
Julia Lawall <julia.lawall@...6.fr>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH] kernel: sys.c: Avoid copying possible padding bytes in
copy_to_user
On Sat, Oct 26, 2019 at 12:46:08PM -0700, Joe Perches wrote:
> Initialization is not guaranteed to zero padding bytes so
> use an explicit memset instead to avoid leaking any kernel
> content in any possible padding bytes.
>
> Signed-off-by: Joe Perches <joe@...ches.com>
> ---
> kernel/sys.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/sys.c b/kernel/sys.c
> index a611d1..3459a5 100644
> --- a/kernel/sys.c
> +++ b/kernel/sys.c
> @@ -1279,11 +1279,13 @@ SYSCALL_DEFINE1(uname, struct old_utsname __user *, name)
>
> SYSCALL_DEFINE1(olduname, struct oldold_utsname __user *, name)
> {
> - struct oldold_utsname tmp = {};
> + struct oldold_utsname tmp;
oldold_utsname doesn't have an struct holes. It looks like this:
struct oldold_utsname {
char sysname[9];
char nodename[9];
char release[9];
char version[9];
char machine[9];
};
regards,
dan carpenter
Powered by blists - more mailing lists