This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: Shadow Stack support in glibc


On 09/06/17 16:39, H.J. Lu wrote:
> Since the __saved_mask field in jmp_buf is unused for x86, replace
> __saved_mask with a union to save save shadow stack pointer while
> keeping the size of jmp_buf unchanged.
> 
> 	* sysdeps/x86/setjmp.h: New file.

sigsetjmp/siglongjmp has to save/restore the signal mask
but the signal mask size on linux is at most 16bytes (?)
and glibc uses 128 byte sigset_t.

so instead of the union below, i'd expect a solution where
if !HURD then the first 16bytes of __saved_mask and the rest
can be accessed separately and the tail bytes are usable
for target specific data.

> +/* Calling environment, plus possibly a saved signal mask.  */
> +struct __jmp_buf_tag
> +  {
> +    /* NOTE: The machine-dependent definitions of `__sigsetjmp'
> +       assume that a `jmp_buf' begins with a `__jmp_buf' and that
> +       `__mask_was_saved' follows it.  Do not move these members
> +       or add others before it.  */
> +    __jmp_buf __jmpbuf;		/* Calling environment.  */
> +    int __mask_was_saved;	/* Saved the signal mask?  */
> +    union
> +      {
> +	/* Saved shadow stack pointer.  */
> +	uintptr_t __saved_shadow_stack_pointer;
> +	/* Saved signal mask.  */
> +	__sigset_t __saved_mask;
> +      } u;
> +  };


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]