It unmaps for each thread when it is destroyed, but never for the
initial thread.

On Sat, Jan 13, 2018 at 03:45:52PM -0700, Theo de Raadt wrote:
> Does it not free it somewhere eventually?  How is that handled.
> 
> 
> > lang/sbcl will need a small patch:
> > 
> > $OpenBSD$
> > 
> > Index: src/runtime/thread.c
> > --- src/runtime/thread.c.orig
> > +++ src/runtime/thread.c
> > @@ -636,9 +636,16 @@ create_thread_struct(lispobj initial_function) {
> >       * on the alignment passed from os_validate, since that might
> >       * assume the current (e.g. 4k) pagesize, while we calculate with
> >       * the biggest (e.g. 64k) pagesize allowed by the ABI. */
> > +#ifdef MAP_STACK
> > +    spaces = mmap(0, THREAD_STRUCT_SIZE, OS_VM_PROT_ALL,
> > +   MAP_PRIVATE | MAP_ANON | MAP_STACK, -1, 0);
> > +    if(spaces == MAP_FAILED)
> > +        return NULL;
> > +#else
> >      spaces=os_validate(0, THREAD_STRUCT_SIZE);
> >      if(!spaces)
> >          return NULL;
> > +#endif
> >      /* Aligning up is safe as THREAD_STRUCT_SIZE has
> >       * THREAD_ALIGNMENT_BYTES padding. */
> >      aligned_spaces = (void *)((((uword_t)(char *)spaces)
> > 

Reply via email to