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:	Fri, 6 May 2011 20:28:26 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
Cc:	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
	john.stultz@...aro.org
Subject: Re: [PATCH 1/1] coredump: use task comm instead of (unknown)

On Sat, 7 May 2011 11:14:14 +0900 Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp> wrote:

> Andrew Morton wrote:
> > > char *strncpy(char *dest, const char *src, size_t n)
> > > {
> > > 	size_t len = __strnend(src, n) - src;
> 
> If src was overwritten by prctl(PR_SET_NAME) at this moment (i.e. after len was
> calculated),
> 
> > > 	__builtin_memset(dest + len, 0, n - len);
> > > 	__builtin_memcpy(dest, src, len);
> 
> won't this result in inconsistent copying of src when length of src has changed
> by prctl(PR_SET_NAME)?
> 
> > > 	return dest;
> > > }
> 
> This strncpy() assumes that length of src won't change within the function.
> I thought prctl(PR_SET_NAME) might break such assumption.

PR_SET_NAME uses set_task_comm() which has appropriate locking to
protect against get_task_comm().  

If kernel code directly accesses task->comm without taking task_lock()
then yes, it's racy.

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