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.



Reply via email to