[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20140513.173828.1128380962164004400.davem@davemloft.net>
Date: Tue, 13 May 2014 17:38:28 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: hpa@...or.com
Cc: ast@...mgrid.com, eric.dumazet@...il.com, edumazet@...gle.com,
dborkman@...hat.com, heiko.carstens@...ibm.com,
netdev@...r.kernel.org
Subject: Re: [PATCH net] net: filter: x86: fix JIT address randomization
From: "H. Peter Anvin" <hpa@...or.com>
Date: Tue, 13 May 2014 14:28:55 -0700
> 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.
Agreed.
>> 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.
Also agreed.
--
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