[PATCH 2/2] jmpbuf: Add paddings for target specific usage

Florian Weimer fweimer@redhat.com
Wed Nov 15 11:10:00 GMT 2017


On 11/14/2017 02:10 PM, H.J. Lu wrote:
> +static int
> +do_test (void)
> +{
> +  sigjmp_buf sj;
> +  struct support_next_to_fault sigset_t_buf
> +    = support_next_to_fault_allocate (SIZEOF_SIGSET_T);
> +  sigset_t *m_p = (sigset_t *) sigset_t_buf.buffer;
> +  sigset_t m;
> +
> +  sigemptyset (&m);
> +  memcpy (m_p, &m, SIZEOF_SIGSET_T);
> +  sigprocmask (SIG_SETMASK, m_p, NULL);
> +  memcpy (&m, m_p, SIZEOF_SIGSET_T);
> +  if (sigsetjmp (sj, 0) == 0)
> +    {
> +      sigaddset (&m, SIGUSR1);
> +      memcpy (m_p, &m, SIZEOF_SIGSET_T);
> +      sigprocmask (SIG_SETMASK, m_p, NULL);
> +      memcpy (&m, m_p, SIZEOF_SIGSET_T);
> +      siglongjmp (sj, 1);
> +      return EXIT_FAILURE;
> +    }
> +  sigprocmask (SIG_SETMASK, NULL, m_p);
> +  memcpy (&m, m_p, SIZEOF_SIGSET_T);
> +  return sigismember (&m, SIGUSR1) ? EXIT_SUCCESS : EXIT_FAILURE;
> +}

Sorry, I don't understand anymore what this test is supposed to test and 
how.

To be honest, I don't like how you inject the internal definition of 
jmp_buf.  Is this the way we do it for the nptl types?

I think you should check _JUMP_BUF_SIGSET_NSIG against a kernel constant 
(_NSIGS?) somewhere.

Thanks,
Florian



More information about the Libc-alpha mailing list