linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Larry H." <research@subreption.com>
To: linux-kernel@vger.kernel.org
Cc: Linus Torvalds <torvalds@osdl.org>,
	linux-mm@kvack.org, Ingo Molnar <mingo@redhat.com>,
	pageexec@freemail.hu, davem@redhat.com
Subject: [patch 4/5] Apply the PG_sensitive flag to the AF_KEY implementation
Date: Wed, 20 May 2009 11:52:36 -0700	[thread overview]
Message-ID: <20090520185236.GD10756@oblivion.subreption.com> (raw)

This patch deploys the use of the PG_sensitive page allocator flag
within the AF_KEY implementation.

Since AF_KEY's main purpose is credential management for network
stacks, it is desirable to mark the memory used to store such data
as sensitive and assure sanitization upon release.

Signed-off-by: Larry H. <research@subreption.com>

---
 net/key/af_key.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Index: linux-2.6/net/key/af_key.c
===================================================================
--- linux-2.6.orig/net/key/af_key.c
+++ linux-2.6/net/key/af_key.c
@@ -480,7 +480,7 @@ static inline struct xfrm_user_sec_ctx *
 	struct xfrm_user_sec_ctx *uctx = NULL;
 	int ctx_size = sec_ctx->sadb_x_ctx_len;
 
-	uctx = kmalloc((sizeof(*uctx)+ctx_size), GFP_KERNEL);
+	uctx = kmalloc((sizeof(*uctx)+ctx_size), GFP_KERNEL | GFP_SENSITIVE);
 
 	if (!uctx)
 		return NULL;
@@ -1184,7 +1184,7 @@ static struct xfrm_state * pfkey_msg2xfr
 		}
 		if (key)
 			keysize = (key->sadb_key_bits + 7) / 8;
-		x->aalg = kmalloc(sizeof(*x->aalg) + keysize, GFP_KERNEL);
+		x->aalg = kmalloc(sizeof(*x->aalg) + keysize, GFP_KERNEL | GFP_SENSITIVE);
 		if (!x->aalg)
 			goto out;
 		strcpy(x->aalg->alg_name, a->name);
@@ -1203,7 +1203,7 @@ static struct xfrm_state * pfkey_msg2xfr
 				err = -ENOSYS;
 				goto out;
 			}
-			x->calg = kmalloc(sizeof(*x->calg), GFP_KERNEL);
+			x->calg = kmalloc(sizeof(*x->calg), GFP_KERNEL | GFP_SENSITIVE);
 			if (!x->calg)
 				goto out;
 			strcpy(x->calg->alg_name, a->name);
@@ -1218,7 +1218,7 @@ static struct xfrm_state * pfkey_msg2xfr
 			key = (struct sadb_key*) ext_hdrs[SADB_EXT_KEY_ENCRYPT-1];
 			if (key)
 				keysize = (key->sadb_key_bits + 7) / 8;
-			x->ealg = kmalloc(sizeof(*x->ealg) + keysize, GFP_KERNEL);
+			x->ealg = kmalloc(sizeof(*x->ealg) + keysize, GFP_KERNEL | GFP_SENSITIVE);
 			if (!x->ealg)
 				goto out;
 			strcpy(x->ealg->alg_name, a->name);
@@ -1267,7 +1267,7 @@ static struct xfrm_state * pfkey_msg2xfr
 		struct sadb_x_nat_t_type* n_type;
 		struct xfrm_encap_tmpl *natt;
 
-		x->encap = kmalloc(sizeof(*x->encap), GFP_KERNEL);
+		x->encap = kmalloc(sizeof(*x->encap), GFP_KERNEL | GFP_SENSITIVE);
 		if (!x->encap)
 			goto out;
 

--
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>

                 reply	other threads:[~2009-05-20 18:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20090520185236.GD10756@oblivion.subreption.com \
    --to=research@subreption.com \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@redhat.com \
    --cc=pageexec@freemail.hu \
    --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