News for hackers. Stuff that matters.
Re:OpenBSD's kernel gets W^X treatment by hlieberman on Wednesday January 14, 2015 @12:44AM (#8884536)
Correct me if I'm wrong, but isn't amd64 kernels always going to have this implemented in hardware? I mean, W^X is a replication of the NX bit, which is (as far as I know) mandatory for the x86 instruction set.
Re:OpenBSD's kernel gets W^X treatment by achernya on Wednesday January 14, 2015 @12:45AM (#8884540)
You're correct, the protection is implemented in hardware, but the pages have to be marked appropriately. This message describes a patchset that correctly marks the kernel pages as writable xor executable.
Re:OpenBSD's kernel gets W^X treatment by k__ on Wednesday January 14, 2015 @01:32AM (#8884685)
So they can but don't have to be marked?
Re:OpenBSD's kernel gets W^X treatment by taejo on Wednesday January 14, 2015 @05:22AM (#8885400)
Yes. Many programs rely on W&X (I believe the JVM is a prominent example)
Re:OpenBSD's kernel gets W^X treatment by masklinn on Wednesday January 14, 2015 @06:55AM (#8885669)
Any JIT-based system requires executable writable memory. This includes the JVM, LuaJIT, Pypy, HHVM and all modern browsers.
Re:OpenBSD's kernel gets W^X treatment by m_eiman on Wednesday January 14, 2015 @07:50AM (#8885878)
It'd be quite possible for a JIT to have the memory first writable but not executable when creating the code, then the other way around when running it. No need to be both at the same time.
Re:OpenBSD's kernel gets W^X treatment by geofft on Wednesday January 14, 2015 @03:47PM (#8888910)
As I understand it, the NX bit is just a new permission bit to say "Don't execute this page". The i386 architecture only had read and write bits, and assumed that read also meant execute.

W^X is a policy that a kernel can choose to implement, that if the W bit is set on a page table entry, so is the NX bit. You need the NX bit to be available in hardware for this to be useful, but hardware support for NX doesn't mean that you have to use it, let alone implement W^X.

This means that amd64 processors are backwards-compatible with kernel and userspace designs that require W|X, even in long (64-bit) mode.

Re:OpenBSD's kernel gets W^X treatment by mrweasel on Wednesday January 14, 2015 @03:51AM (#8885051)
I don't think the first versions of Intels AMD64 chips had the NX bit, but those chips are so old at this point it might be unimportant.