[CRIU] [PATCH 7/9] seccomp: test -- Add seccomp_filter_threads
Cyrill Gorcunov
gorcunov at gmail.com
Fri May 4 23:11:49 MSK 2018
On Fri, May 04, 2018 at 08:51:32PM +0100, Dmitry Safonov wrote:
> 2018-04-26 21:14 GMT+01:00 Cyrill Gorcunov <gorcunov at gmail.com>:
> [..]
> > + if (pid == 0) {
> > + pthread_t thread;
> > + void *p = NULL;
> > +
> > + zdtm_seccomp = 1;
> > +
> > + pthread_create(&thread, NULL, thread_main, NULL);
> > + if (pthread_join(thread, &p) != 0) {
> > + pr_perror("pthread_join");
> > + exit(1);
> > + }
> > +
> > + syscall(__NR_exit, p);
>
> Hmm.
> a) why syscall() and not _exit()?
Because here we're already inside filtering mode so we should not
rely on any library calls, plain syscalls only.
> b) (void *p) is 64-bit long on 64-bit platfoms, exit() has (int)
> parameter == 32-bit long.
> Does this work as expected without a cast?
It is a pointer with value 1 due to pthread_join specifics.
Works without a cast.
More information about the CRIU
mailing list