From: J Freyensee <why2jjj.linux@gmail.com>
To: "Austin Kim" <austindh.kim@gmail.com>,
"Mickaël Salaün" <mic@digikod.net>
Cc: "Serge E. Hallyn" <serge@hallyn.com>,
linux-security-module <linux-security-module@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] landlock: Initialize kernel stack variables properly
Date: Fri, 5 Nov 2021 09:58:47 -0700 [thread overview]
Message-ID: <136709ac-1fbe-80d0-f49f-8a0399106ad8@gmail.com> (raw)
In-Reply-To: <CADLLry4zYn-NZBtC3pdQpb4c_3vvzNfc71rBrXc-oXqgSZNHaQ@mail.gmail.com>
On 11/4/21 4:41 AM, Austin Kim wrote:
> 2021년 11월 3일 (수) 오후 9:14, Mickaël Salaün <mic@digikod.net>님이 작성:
>> 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.
>>
> It seems that memset() is done inside copy_from_user().
> Thanks for feedback.
If you are really sensitive of what information may be disclosed in this
case you can consider memzero_explicit() to use instead:
https://www.kernel.org/doc/htmldocs/kernel-api/API-memzero-explicit.html
Jay
>
> BR,
> Austin Kim
>
>>> /* Copies raw user space buffer, only one type for now. */
>>> res = copy_from_user(&path_beneath_attr, rule_attr,
>>> sizeof(path_beneath_attr));
>>>
prev parent reply other threads:[~2021-11-05 16:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-03 7:14 [PATCH] landlock: Initialize kernel stack variables properly Austin Kim
2021-11-03 12:17 ` Mickaël Salaün
2021-11-04 11:41 ` Austin Kim
2021-11-05 16:58 ` J Freyensee [this message]
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=136709ac-1fbe-80d0-f49f-8a0399106ad8@gmail.com \
--to=why2jjj.linux@gmail.com \
--cc=austindh.kim@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mic@digikod.net \
--cc=serge@hallyn.com \
/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).