From: "Theodore Ts'o" <tytso@mit.edu>
To: Jasper Niebuhr <yjnworkstation@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Willy Tarreau <w@1wt.eu>,
akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org
Subject: Re: [PATCH] exitz syscall
Date: Sun, 12 Nov 2023 10:44:24 -0500 [thread overview]
Message-ID: <20231112154424.GE35991@mit.edu> (raw)
In-Reply-To: <CAMjCObv9Z+Ood9QFA_jSQ2roSEE6C_ip=KeyoChmtyi97UoU7g@mail.gmail.com>
On Sun, Nov 12, 2023 at 11:03:43AM +0100, Jasper Niebuhr wrote:
>
> Do you think it could make sense to enable zeroing on exit only for
> ranges of memory (base + len) with a config dictating the max amount
> of bytes (or pages or whatever) that a single process is allowed to
> flag for zeroing? This way the DoS issue is effectively solved and the
> config could always be set to 0 (by default I guess), which would
> effectively leave any common system unchanged. The users that actually
> want to use this feature could then decide on their own how much it is
> worth to them and how big of a task they want the kernel to perform at
> max on exit.
How about adding a flag MLOCK_ZERO_ON_FREE used by the mlock2() system
call? The number of pages which an unprivileged process can lock is
already capped via RLIMIT_MEMLOCK (or else mlock would be it own
denial of service attack). That way if process dies from crash, the
keys would be zero'ed.
The argument against this is that this functionality could be an
attractive nuisance, since best practice is to zero any keying
information the moment you no longer need it, instead of depending on
magic OS behavior to take care of something that you darned well
should be doing yourself. I understand that in your case, you're
trying to protect a key manager, whose *job* it is to hold onto keys
for long periods of time. So this advice might not be as applicable
in your case.
I do suspect that the chances that trying to grab a memory page after
it has been released is one of the least likely way keys would be
exfiltrated. I'd be much more worried about stack/buffer overflow
attacks in any of the libraries used by the key manager, for example.
Or zero-day attacks on the kernel which then grab the keys from the
key manager process while it is still running....
Cheers,
- Ted
next prev parent reply other threads:[~2023-11-12 15:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-11 12:51 [PATCH] exitz syscall York Jasper Niebuhr
2023-11-11 13:24 ` Willy Tarreau
2023-11-12 1:24 ` Linus Torvalds
2023-11-12 10:03 ` Jasper Niebuhr
2023-11-12 15:44 ` Theodore Ts'o [this message]
2023-11-12 18:50 ` Linus Torvalds
2023-11-12 19:03 ` Theodore Ts'o
2023-11-13 0:08 ` Andy Lutomirski
2023-11-12 4:52 ` Theodore Ts'o
2023-11-13 7:37 ` Vlastimil Babka
2023-11-19 14:54 ` Jasper Niebuhr
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=20231112154424.GE35991@mit.edu \
--to=tytso@mit.edu \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=w@1wt.eu \
--cc=yjnworkstation@gmail.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).