lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 17 Dec 2013 16:36:11 +0100
From:	Oleg Nesterov <oleg@...hat.com>
To:	Richard Guy Briggs <rgb@...hat.com>
Cc:	linux-audit@...hat.com, linux-kernel@...r.kernel.org,
	Eric Paris <eparis@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH] pid: change task_struct::pid to read-only

On 12/16, Richard Guy Briggs wrote:
>
> task->pid is only ever assigned once (well ok, twice).  For system health and
> secure logging confidence, make it const to make it much more intentional when
> it is being changed.

Hmm. I am a bit suprized you decided to constify task->pid, but OK.

And we can do the same with task->signal, this can actually help to generate
a better code, probably.

>  	if (!thread_group_leader(tsk)) {
>  		struct task_struct *leader = tsk->group_leader;
> +		/* tast_struct::pid is const pid_t, hence the ugly cast */
> +		pid_t *pid_p = (pid_t*)&(tsk->pid);
>
>  		sig->notify_count = -1;	/* for exit_notify() */
>  		for (;;) {
> @@ -950,7 +952,7 @@ static int de_thread(struct task_struct *tsk)
>  		 * Note: The old leader also uses this pid until release_task
>  		 *       is called.  Odd but simple and correct.
>  		 */
> -		tsk->pid = leader->pid;
> +		*pid_p = leader->pid;

Well, imho this (and de_thread) looks a bit ugly. Perhaps we should add
something like

	#define ASSIGN_CONST(l, r)      (*(typeof(r) *)&(l) = (r))

into compiler.h ?

Oleg.

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

Powered by Openwall GNU/*/Linux Powered by OpenVZ