[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <53728E97.6030400@zytor.com>
Date: Tue, 13 May 2014 14:28:55 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Alexei Starovoitov <ast@...mgrid.com>,
Eric Dumazet <eric.dumazet@...il.com>
CC: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Daniel Borkmann <dborkman@...hat.com>,
Heiko Carstens <heiko.carstens@...ibm.com>,
Network Development <netdev@...r.kernel.org>
Subject: Re: [PATCH net] net: filter: x86: fix JIT address randomization
On 05/13/2014 01:34 PM, Alexei Starovoitov wrote:
>>
>> The argument of not having code ending on (or being very close of) page
>> boundary seems orthogonal to this bug fix.
>
> Gotta pick some number... page/2 seems good enough to have
> large range for prandom() to choose and better performance.
> Another alternative is to do min(…, PAGE_SIZE - sizeof(*header)),
> but that is harder to understand.
>
The latter is correct by construction, and thus doesn't end up with the
question "what is going on here" or has hidden failure conditions.
> Also just realized that I miscalculated the breaking point:
> "If prandom_u32() % hole selects a number >= 4096, then kernel will crash"
> it should read: "… >= 4092 ..."
> since sizeof(*header) needs to be accounted for.
No, it should read PAGE_SIZE - sizeof(*header) if anything.
-hpa
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists