From: "Larry H." <research@subreption.com>
To: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org, Rik van Riel <riel@redhat.com>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
Linus Torvalds <torvalds@osdl.org>
Subject: [PATCH] Use kzfree in tty buffer management to enforce data sanitization
Date: Sat, 30 May 2009 18:55:37 -0700 [thread overview]
Message-ID: <20090531015537.GA8941@oblivion.subreption.com> (raw)
[PATCH] Use kzfree in tty buffer management to enforce data sanitization
This patch replaces the kfree() calls within the tty buffer management API
with kzfree(), to enforce sanitization of the buffer contents.
It also takes care of handling buffers larger than PAGE_SIZE, which are
allocated via the page allocator directly.
This prevents such information from persisting on memory, potentially
leaking sensitive data like access credentials, or being leaked to other
kernel users after re-allocation of the memory by the LIFO allocators.
This patch doesn't affect fastpaths.
Signed-off-by: Larry Highsmith <research@subreption.com>
Index: linux-2.6/drivers/char/tty_audit.c
===================================================================
--- linux-2.6.orig/drivers/char/tty_audit.c
+++ linux-2.6/drivers/char/tty_audit.c
@@ -54,10 +54,12 @@ err:
static void tty_audit_buf_free(struct tty_audit_buf *buf)
{
WARN_ON(buf->valid != 0);
- if (PAGE_SIZE != N_TTY_BUF_SIZE)
- kfree(buf->data);
- else
+ if (PAGE_SIZE != N_TTY_BUF_SIZE) {
+ kzfree(buf->data);
+ } else {
+ memset(buf->data, 0, PAGE_SIZE);
free_page((unsigned long)buf->data);
+ }
kfree(buf);
}
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next reply other threads:[~2009-05-31 1:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-31 1:55 Larry H. [this message]
2009-05-31 2:04 ` Linus Torvalds
2009-05-31 2:35 ` Larry H.
2009-05-31 6:27 ` Pekka Enberg
2009-05-31 6:24 ` Pekka Enberg
2009-05-31 10:26 ` Alan Cox
2009-05-31 17:05 ` Linus Torvalds
2009-05-31 17:10 ` Alan Cox
2009-05-31 17:17 ` Pekka Enberg
2009-06-02 15:05 ` Christoph Lameter
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=20090531015537.GA8941@oblivion.subreption.com \
--to=research@subreption.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=riel@redhat.com \
--cc=torvalds@osdl.org \
/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