Re: [PATCH 1/1] coredump: use task comm instead of (unknown)

From: Tetsuo Handa
Date: Fri May 06 2011 - 22:14:31 EST


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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/