1 |
On 29 Jul 2013 at 6:23, Javier Juan Martínez Cabezón wrote: |
2 |
|
3 |
> PaX tries to do this modification to rsbac git code: |
4 |
> |
5 |
> --- fs/namei.c 2013-03-19 01:53:21.091281869 +0100 |
6 |
> +++ fs/namei.c 2013-03-19 01:53:31.251281326 +0100 |
7 |
> @@ -3954,7 +3956,14 @@ |
8 |
> len = strlen(link); |
9 |
> if (len > (unsigned) buflen) |
10 |
> len = buflen; |
11 |
> - if (copy_to_user(buffer, link, len)) |
12 |
> + |
13 |
> + if (len < sizeof(tmpbuf)) { |
14 |
> + memcpy(tmpbuf, link, len); |
15 |
> + newlink = tmpbuf; |
16 |
> + } else |
17 |
> + newlink = link; |
18 |
> + |
19 |
> + if (copy_to_user(buffer, newlink, len)) |
20 |
> len = -EFAULT; |
21 |
> out: |
22 |
> return len; |
23 |
|
24 |
this change is done for USERCOPY to prevent false positive reports when the |
25 |
name comes from a dentry field (vs. a normal kmalloc slab) or something |
26 |
like that. if you want to enable USERCOPY under RSBAC as well then you'll |
27 |
have to ensure that either rsbac_name is allocated by a normal kmalloc (this |
28 |
seems to be the case already from a quick look) or you'll have to do the |
29 |
temporary stack copy as done in the above snippet. |