Re: immutable userland mappings

2022-09-28 Thread Theo de Raadt
Theo de Raadt wrote: > Theo de Raadt wrote: > > > > Yet another version of the diff as I incrementally get it working better. > > > Call it version 22.. > > This is around version 30. New version. uvm_unmap_remove() now avoids doing entry splits as it scans for immutables in the region. Lot

Re: immutable userland mappings

2022-09-15 Thread Crystal Kolipe
On Thu, Sep 15, 2022 at 08:31:06AM -0600, Theo de Raadt wrote: > RCS file: lib/libc/sys/mimmutable.2 ... > +Unmapped pages in the region do not retain immutability, but this > +behaviour should not be relied up. s/relied up/relied on/ or s/relied up/relied upon/

Re: immutable userland mappings

2022-09-15 Thread Theo de Raadt
Theo de Raadt wrote: > > Yet another version of the diff as I incrementally get it working better. > > Call it version 22.. This is around version 30. There is still a subtle problem with RELRO, but it is masked with a hack. arm64 also works correctly, and I'm onto the next architecture. Syste

Re: immutable userland mappings

2022-09-10 Thread Theo de Raadt
Theo de Raadt wrote: > Theo de Raadt wrote: > > > Theo de Raadt wrote: > > > > > In this version of the diff, the kernel manages to mark immutable most of > > > the main binary, and in the shared-binary case, also most of ld.so. But > > > it > > > cannot mark all of the ELF mapping -- becau

Re: immutable userland mappings

2022-09-10 Thread Theo de Raadt
Theo de Raadt wrote: > Theo de Raadt wrote: > > > In this version of the diff, the kernel manages to mark immutable most of > > the main binary, and in the shared-binary case, also most of ld.so. But it > > cannot mark all of the ELF mapping -- because of two remaining problems > > (RELRO > >

Re: immutable userland mappings

2022-09-03 Thread Theo de Raadt
Theo de Raadt wrote: > In this version of the diff, the kernel manages to mark immutable most of > the main binary, and in the shared-binary case, also most of ld.so. But it > cannot mark all of the ELF mapping -- because of two remaining problems (RELRO > in .data, and the malloc.c self-protect

immutable userland mappings

2022-09-01 Thread Theo de Raadt
In the last few years, I have been improving the strictness of userland memory layout. An example is the recent addition of MAP_STACK and msyscall(). The first one marks pages that are stack, so that upon entry to the kernel we can check if the stack-pointer is pointing in the stack range. If it