netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: hpa@zytor.com
Cc: ast@plumgrid.com, eric.dumazet@gmail.com, edumazet@google.com,
	dborkman@redhat.com, heiko.carstens@de.ibm.com,
	netdev@vger.kernel.org
Subject: Re: [PATCH net] net: filter: x86: fix JIT address randomization
Date: Tue, 13 May 2014 17:38:28 -0400 (EDT)	[thread overview]
Message-ID: <20140513.173828.1128380962164004400.davem@davemloft.net> (raw)
In-Reply-To: <53728E97.6030400@zytor.com>

From: "H. Peter Anvin" <hpa@zytor.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.

  reply	other threads:[~2014-05-13 21:38 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
2014-05-13 21:38       ` David Miller [this message]
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=20140513.173828.1128380962164004400.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=ast@plumgrid.com \
    --cc=dborkman@redhat.com \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=hpa@zytor.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).