From: "H. Peter Anvin" <hpa@zytor•com>
To: Alexei Starovoitov <ast@plumgrid•com>,
Eric Dumazet <eric.dumazet@gmail•com>
Cc: "David S. Miller" <davem@davemloft•net>,
Eric Dumazet <edumazet@google•com>,
Daniel Borkmann <dborkman@redhat•com>,
Heiko Carstens <heiko.carstens@de•ibm.com>,
Network Development <netdev@vger•kernel.org>
Subject: Re: [PATCH net] net: filter: x86: fix JIT address randomization
Date: Tue, 13 May 2014 14:28:55 -0700 [thread overview]
Message-ID: <53728E97.6030400@zytor.com> (raw)
In-Reply-To: <CAMEtUuxLbDpkxJ4fORRdsJ36vBiidBwA0SVAwvmDHEpPmhTA2Q@mail.gmail.com>
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
next prev parent reply other threads:[~2014-05-13 21:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-13 18:53 [PATCH net] net: filter: x86: fix JIT address randomization Alexei Starovoitov
2014-05-13 20:23 ` Eric Dumazet
2014-05-13 20:34 ` Alexei Starovoitov
2014-05-13 21:28 ` H. Peter Anvin [this message]
2014-05-13 21:38 ` David Miller
2014-05-14 7:36 ` Heiko Carstens
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53728E97.6030400@zytor.com \
--to=hpa@zytor$(echo .)com \
--cc=ast@plumgrid$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=dborkman@redhat$(echo .)com \
--cc=edumazet@google$(echo .)com \
--cc=eric.dumazet@gmail$(echo .)com \
--cc=heiko.carstens@de$(echo .)ibm.com \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox