lkml.org 
[lkml]   [2021]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] landlock: Initialize kernel stack variables properly
From
Date
Hi Austin,

On 03/11/2021 08:14, Austin Kim wrote:
> In case kernel stack variables are not initialized properly, there might
> be a little chance of kernel information disclosure. So it is better for
> kernel stack variables to be initialized with null characters.
>
> Signed-off-by: Austin Kim <austindh.kim@gmail.com>
> ---
> security/landlock/syscalls.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/security/landlock/syscalls.c b/security/landlock/syscalls.c
> index 32396962f04d..50a6f7091428 100644
> --- a/security/landlock/syscalls.c
> +++ b/security/landlock/syscalls.c
> @@ -320,6 +320,8 @@ SYSCALL_DEFINE4(landlock_add_rule,
> if (rule_type != LANDLOCK_RULE_PATH_BENEATH)
> return -EINVAL;
>
> + memset(&path_beneath_attr, 0, sizeof(path_beneath_attr));
> +

This memset is already done with the copy_from_user() call just below.

> /* Copies raw user space buffer, only one type for now. */
> res = copy_from_user(&path_beneath_attr, rule_attr,
> sizeof(path_beneath_attr));
>

\
 
 \ /
  Last update: 2021-11-03 13:15    [W:0.060 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site