Re: rsbac+pax fixation Patch to kernel 3.8

"PaX Team" <[email protected]>
Newsgroups gmane.linux.gentoo.hardened
Message-ID <[email protected]>
On 29 Jul 2013 at 6:23, Javier Juan Martínez Cabezón wrote:

> PaX tries to do this modification to rsbac git code:
> 
> --- fs/namei.c    2013-03-19 01:53:21.091281869 +0100
> +++ fs/namei.c    2013-03-19 01:53:31.251281326 +0100
> @@ -3954,7 +3956,14 @@
>      len = strlen(link);
>      if (len > (unsigned) buflen)
>          len = buflen;
> -    if (copy_to_user(buffer, link, len))
> +
> +    if (len < sizeof(tmpbuf)) {
> +        memcpy(tmpbuf, link, len);
> +        newlink = tmpbuf;
> +    } else
> +        newlink = link;
> +
> +    if (copy_to_user(buffer, newlink, len))
>          len = -EFAULT;
>  out:
>      return len;

this change is done for USERCOPY to prevent false positive reports when the
name comes from a dentry field (vs. a normal kmalloc slab) or something
like that. if you want to enable USERCOPY under RSBAC as well then you'll
have to ensure that either rsbac_name is allocated by a normal kmalloc (this
seems to be the case already from a quick look) or you'll have to do the
temporary stack copy as done in the above snippet.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.