On Wed, Oct 05, 2022 at 02:47:19PM +0200, Marc Espie wrote:

> On Tue, Oct 04, 2022 at 10:15:51AM -0600, Theo de Raadt wrote:
> > A note on why this chance is coming.
> > 
> > malloc.c (as it is today), does mprotects back and forth between RW and
> > R, to protect an internal object.  This object is in bss, it is not
> > allocated with mmap.  With the upcoming mimmutable change, the bss will
> > become immutable by default, at program load time.  mimmutable even prevents
> > changing a RW object to R.
> 
> I'm probably missing something here, but for me, traditionally,
> BSS is the "set to 0" section of global variables of a program... which are
> usually going to be changed to some other value.
> 
> Or are we talking at cross purposes ?
> 

malloc sets up a few values in a bss struct and then sets the page
its in to r/o.

But when switching to multi-threaded mode a few variables in the struct
are changed (in current), so the page has to be made r/w again,
modified and then back to r/o. 

The diff changes things so that the pages can be set to r/o and
immutable after malloc init.

        -Otto

Reply via email to