From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Florian Weimer <fw@deneb.enyo.de>
Cc: Zack Weinberg <zackw@panix.com>,
Carlos O'Donell <carlos@redhat.com>,
GNU C Library <libc-alpha@sourceware.org>
Subject: Re: wrappers for multiplexed syscalls (was Re: glibc at the Toolchains microconference at LPC 2019)
Date: Sat, 29 Jun 2019 00:20:40 +0300 [thread overview]
Message-ID: <20190628212040.GB18013@altlinux.org> (raw)
In-Reply-To: <87ef3eu3iy.fsf@mid.deneb.enyo.de>
[-- Attachment #1: Type: text/plain, Size: 2300 bytes --]
On Thu, Jun 27, 2019 at 11:22:45PM +0200, Florian Weimer wrote:
> * Dmitry V. Levin:
> > why would we want to add a wrapper for __NR_bpf or __NR_keyctl?
>
> We have wrappers for ioctl, fcntl, ptrace, prctl. I suppose they
> could serve as models.
>
> We'll see what the future will bring on the Linux. I expect that
> system calls are now easier to wire up consistently across
> architectures, so perhaps we will see fewer multiplexer system calls
> in the future. I suspect that, for architecture-independent features,
> these multiplexers had the important property that a kernel
> contributor wouldn't need to touch arch-specific code to add further
> sub-calls, which made them very attractive if you want to roll out new
> features relatively quickly.
>
> Regarding fcntl, I did look into providing a type-safe version of it
> using _Generic/__builtin_types_compatible_p/__builtin_choose_expr and
> so on. But then I realized that instead, we probably should have
> separate fcntl_* functions for each sub-call, similar to what we did
> for socketcall. gnulib could easily provide high-quality
> implementations for libcs which do not pick up on this idea.
>
> So yes, I tend to agree that exposing wrappers is problematic.
>
> > Since these syscalls have interfaces explicitly designed to scare regular
> > users off and encourage them to use library functions instead, providing
> > glibc wrappers for them would mislead people into invoking these system
> > calls directly. These wrappers would lack type checking available in
> > higher-level library functions, causing unnecessary runtime errors that
> > are easily avoidable at compile time when higher-level library functions
> > are used.
>
> Right. And fcntl isn't so different, actually.
What if we start adding separate functions for new interfaces of already
existing multiplexed system call wrappers?
For example, ptrace is going to gain a new command (PTRACE_GET_SYSCALL_INFO)
in Linux 5.3. My initial plan was just to update sys/ptrace.h with a new
constant and bits/ptrace-shared.h with a new structure, but I could add
a new function as well:
extern int ptrace_get_syscall_info (__pid_t __pid,
struct __ptrace_syscall_info *__infop)
__THROW;
--
ldv
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
next prev parent reply other threads:[~2019-06-28 21:20 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-26 16:01 glibc at the Toolchains microconference at LPC 2019 Florian Weimer
2019-06-26 16:39 ` Dmitry V. Levin
2019-06-26 16:50 ` Zack Weinberg
2019-06-26 16:56 ` Florian Weimer
2019-06-26 17:40 ` Zack Weinberg
2019-06-26 20:33 ` Carlos O'Donell
2019-06-26 20:39 ` Christian Brauner
2019-06-26 20:58 ` Carlos O'Donell
2019-06-26 17:28 ` Yann Droneaud
2019-06-26 17:41 ` Christian Brauner
2019-06-26 21:04 ` Carlos O'Donell
2019-06-27 9:39 ` Dmitry V. Levin
2019-06-27 10:05 ` Szabolcs Nagy
2019-06-27 10:18 ` Christian Brauner
2019-06-27 13:05 ` Dmitry V. Levin
2019-06-27 15:57 ` Zack Weinberg
2019-06-27 17:21 ` Florian Weimer
2019-06-27 20:07 ` Carlos O'Donell
2019-06-27 20:53 ` wrappers for multiplexed syscalls (was Re: glibc at the Toolchains microconference at LPC 2019) Dmitry V. Levin
2019-06-27 21:22 ` Florian Weimer
2019-06-28 21:20 ` Dmitry V. Levin [this message]
2019-06-28 21:35 ` Florian Weimer
2019-06-29 1:52 ` Zack Weinberg
2019-06-29 6:27 ` Florian Weimer
2019-06-27 13:22 ` glibc at the Toolchains microconference at LPC 2019 Zack Weinberg
2019-06-27 14:10 ` syscall wrappers policy (was re: glibc at the Toolchains microconference) Zack Weinberg
2019-06-27 15:48 ` DJ Delorie
2019-06-27 16:02 ` Zack Weinberg
2019-06-27 16:50 ` Carlos O'Donell
2019-06-27 17:45 ` glibc at the Toolchains microconference at LPC 2019 Maciej Rozycki
2019-07-08 12:57 ` Florian Weimer
2019-07-08 16:06 ` Paul Eggert
2019-07-19 11:49 ` Florian Weimer
2019-09-14 4:33 ` Maciej W. Rozycki
2019-09-14 11:53 ` Dmitry V. Levin
2019-09-14 14:02 ` Maciej W. Rozycki
2019-07-09 0:14 ` Dmitry V. Levin
2019-09-16 13:26 ` Christian Brauner
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
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190628212040.GB18013@altlinux.org \
--to=ldv@altlinux.org \
--cc=carlos@redhat.com \
--cc=fw@deneb.enyo.de \
--cc=libc-alpha@sourceware.org \
--cc=zackw@panix.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).