[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090531015537.GA8941@oblivion.subreption.com>
Date: Sat, 30 May 2009 18:55:37 -0700
From: "Larry H." <research@...reption.com>
To: linux-kernel@...r.kernel.org
Cc: linux-mm@...ck.org, Rik van Riel <riel@...hat.com>,
Alan Cox <alan@...rguk.ukuu.org.uk>,
Linus Torvalds <torvalds@...l.org>
Subject: [PATCH] Use kzfree in tty buffer management to enforce data
sanitization
[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@...reption.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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists