Gentoo Archives: gentoo-hardened

From: PaX Team <pageexec@×××××.com>
To: gentoo-hardened@l.g.o
Subject: Re: [gentoo-hardened] rsbac+pax fixation Patch to kernel 3.8
Date: Mon, 29 Jul 2013 11:25:12
Message-Id: 51F6510A.29790.153D7859@pageexec.gmail.com
In Reply to: [gentoo-hardened] rsbac+pax fixation Patch to kernel 3.8 by "Javier Juan Martínez Cabezón"
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.

Replies

Subject Author
Re: [gentoo-hardened] rsbac+pax fixation Patch to kernel 3.8 "Javier Juan Martínez Cabezón" <tazok.id0@×××××.com>