From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: carlos <carlos@redhat.com>,
Joseph Myers <joseph@codesourcery.com>,
Szabolcs Nagy <szabolcs.nagy@arm.com>,
libc-alpha <libc-alpha@sourceware.org>
Subject: Re: [RFC PATCH glibc 1/3] glibc: Perform rseq(2) registration at C startup and thread creation (v18)
Date: Thu, 30 Apr 2020 16:37:37 -0400 (EDT) [thread overview]
Message-ID: <467540610.78605.1588279057114.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <87v9lgk90c.fsf@oldenburg2.str.redhat.com>
----- On Apr 30, 2020, at 4:34 PM, Florian Weimer fweimer@redhat.com wrote:
> * Mathieu Desnoyers:
>
>> I'm actually wondering about "EPERM". Is it sometimes used by seccomp
>> filters to refuse a system call ?
>
> Yes, it's the default for systemd-nspawn. I have argued against it, but
> unsuccessfully. It breaks all kinds of stuff inside glibc, too.
OK, so how about this errno handling ?
static inline void
rseq_register_current_thread (void)
{
int ret;
if (__rseq_abi.cpu_id != RSEQ_CPU_ID_UNINITIALIZED)
__libc_fatal ("glibc fatal error: "
"rseq already initialized for this thread\n");
ret = INTERNAL_SYSCALL_CALL (rseq, &__rseq_abi, sizeof (struct rseq),
0, RSEQ_SIG);
if (INTERNAL_SYSCALL_ERROR_P (ret))
{
const char *msg = NULL;
switch (INTERNAL_SYSCALL_ERRNO (ret))
{
case ENOSYS: /* rseq system call not implemented. */
case EPERM: /* rseq system call filtered by seccomp. */
case EACCES: /* rseq system call filtered by seccomp. */
__rseq_abi.cpu_id = RSEQ_CPU_ID_REGISTRATION_FAILED;
break;
case EINVAL:
msg = "glibc fatal error: rseq already registered for this thread\n";
break;
case EBUSY:
msg = "glibc fatal error: rseq parameters are invalid\n";
break;
case EFAULT:
msg = "glibc fatal error: rseq is an invalid address\n";
break;
default:
msg = "glibc fatal error: unexpected rseq errno\n";
break;
}
if (msg)
__libc_fatal (msg);
}
}
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
next prev parent reply other threads:[~2020-04-30 20:37 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-28 17:15 Mathieu Desnoyers
2020-04-28 17:15 ` [RFC PATCH glibc 2/3] glibc: sched_getcpu(): use rseq cpu_id TLS on Linux (v7) Mathieu Desnoyers
2020-04-28 17:15 ` [RFC PATCH glibc 3/3] rseq registration tests (v10) Mathieu Desnoyers
2020-04-30 12:20 ` [RFC PATCH glibc 1/3] glibc: Perform rseq(2) registration at C startup and thread creation (v18) Florian Weimer
2020-04-30 16:11 ` Mathieu Desnoyers
2020-04-30 16:36 ` Florian Weimer
2020-04-30 16:55 ` Mathieu Desnoyers
2020-04-30 17:07 ` Florian Weimer
2020-04-30 17:20 ` Mathieu Desnoyers
2020-04-30 17:46 ` Florian Weimer
2020-04-30 19:39 ` Mathieu Desnoyers
2020-04-30 19:53 ` Mathieu Desnoyers
2020-04-30 19:59 ` Mathieu Desnoyers
2020-04-30 20:34 ` Florian Weimer
2020-04-30 20:37 ` Mathieu Desnoyers [this message]
2020-04-30 20:37 ` Florian Weimer
2020-04-30 20:39 ` Mathieu Desnoyers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=467540610.78605.1588279057114.JavaMail.zimbra@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=carlos@redhat.com \
--cc=fweimer@redhat.com \
--cc=joseph@codesourcery.com \
--cc=libc-alpha@sourceware.org \
--cc=szabolcs.nagy@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).