[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Xine.LNX.4.64.0802112156030.27028@us.intercode.com.au>
Date:	Mon, 11 Feb 2008 21:57:37 +1100 (EST)
From:	James Morris <jmorris@...ei.org>
To:	David Howells <dhowells@...hat.com>
cc:	Trond.Myklebust@...app.com, chuck.lever@...cle.com,
	nfsv4@...ux-nfs.org, linux-kernel@...r.kernel.org,
	linux-security-module@...r.kernel.org, selinux@...ho.nsa.gov,
	linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH 07/37] Security: De-embed task security record from task
 and use refcounting
On Fri, 8 Feb 2008, David Howells wrote:
> Remove the temporarily embedded task security record from task_struct.  Instead
> it is made to dangle from the task_struct::sec and task_struct::act_as pointers
> with references counted for each.
...
These patches are kind of huge.
> +static int selinux_task_dup_security(struct task_security *sec)
> +{
> +	struct task_security_struct *tsec1, *tsec2;
> +
> +	tsec1 = sec->security;
> +
> +	tsec2 = kmemdup(tsec1, sizeof(*tsec1), GFP_KERNEL);
> +	if (!tsec2)
> +		return -ENOMEM;
> +
> +	tsec2->osid = tsec1->osid;
> +	tsec2->sid = tsec1->sid;
> +
> +	tsec2->exec_sid = tsec1->exec_sid;
> +	tsec2->create_sid = tsec1->create_sid;
> +	tsec2->keycreate_sid = tsec1->keycreate_sid;
> +	tsec2->sockcreate_sid = tsec1->sockcreate_sid;
> +	tsec2->ptrace_sid = SECINITSID_UNLABELED;
> +	sec->security = tsec2;
> +
> +	return 0;
>  }
Why manually copy these fields after a kmemdup?
What about the task backpointer? (i.e. tsec2->task)
-- 
James Morris
<jmorris@...ei.org>
--
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