[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140918231154.GH5182@n2100.arm.linux.org.uk>
Date: Fri, 19 Sep 2014 00:11:54 +0100
From: Russell King - ARM Linux <linux@....linux.org.uk>
To: Daniel Borkmann <dborkman@...hat.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org,
Will Deacon <will.deacon@....com>,
Mircea Gherzan <mgherzan@...il.com>,
Catalin Marinas <catalin.marinas@....com>,
linux-arm-kernel@...ts.infradead.org,
Alexei Starovoitov <ast@...mgrid.com>
Subject: Re: [PATCH net-next] net: bpf: arm: make hole-faulting more robust
On Fri, Sep 19, 2014 at 12:57:03AM +0200, Daniel Borkmann wrote:
> Will Deacon pointed out, that the currently used opcode for filling holes,
> that is 0xe7ffffff, seems not robust enough ...
If you're after a single 32-bit word which will fault if executed in
ARM or Thumb mode, and you only want it to raise an undefined
instruction exception (iow, you're not using it as a breakpoint or
similar), then may I suggest the poison value I chose for the vectors
page, designed to trap userspace branches to locations in there?
0xe7fddef1
> Similarly, ptrace, kprobes, kgdb, bug and uprobes make use of such instruction
> as well to trap. Given mentioned section from the specification, we can find
> such a universe as (where 'x' denotes 'don't care'):
>
> ARM: xxxx 0111 1111 xxxx xxxx xxxx 1111 xxxx
> Thumb: 1101 1110 xxxx xxxx
You'll notice that the value conforms to the ARM undefined instruction
space. You'll also notice that the low 16 bits correspond to the
Thumb case. The only question is, what is 0xe7fd as a Thumb instruction...
00000000 <a>:
0: def1 ; <UNDEFINED> instruction: 0xdef1
2: e7fd b.n 0 <a>
So, if either 0 or 2 gets branched to, we end up at the Thumb UDF
instruction. (Sorry, my binutils doesn't know about UDF.)
--
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
--
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