All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@amacapital.net>
To: Dave Martin <Dave.Martin@arm.com>
Cc: Daniel Colascione <dancol@google.com>,
	Florian Weimer <fweimer@redhat.com>,
	"Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Joel Fernandes <joelaf@google.com>,
	Linux API <linux-api@vger.kernel.org>, Willy Tarreau <w@1wt.eu>,
	Vlastimil Babka <vbabka@suse.cz>,
	Carlos O'Donell <carlos@redhat.com>,
	"libc-alpha@sourceware.org" <libc-alpha@sourceware.org>
Subject: Re: Official Linux system wrapper library?
Date: Tue, 13 Nov 2018 12:58:39 -0800	[thread overview]
Message-ID: <69B07026-5E8B-47FC-9313-E51E899FAFB0@amacapital.net> (raw)
In-Reply-To: <20181113193859.GJ3505@e103592.cambridge.arm.com>


> On Nov 13, 2018, at 11:39 AM, Dave Martin <Dave.Martin@arm.com> wrote:
> 
> On Mon, Nov 12, 2018 at 05:19:14AM -0800, Daniel Colascione wrote:
> 
> [...]
> 
>> We can learn something from how Windows does things. On that system,
>> what we think of as "libc" is actually two parts. (More, actually, but
>> I'm simplifying.) At the lowest level, you have the semi-documented
>> ntdll.dll, which contains raw system call wrappers and arcane
>> kernel-userland glue. On top of ntdll live the "real" libc
>> (msvcrt.dll, kernel32.dll, etc.) that provide conventional
>> application-level glue. The tight integration between ntdll.dll and
>> the kernel allows Windows to do very impressive things. (For example,
>> on x86_64, Windows has no 32-bit ABI as far as the kernel is
>> concerned! You can still run 32-bit programs though, and that works
>> via ntdll.dll essentially shimming every system call and switching the
>> processor between long and compatibility mode as needed.) Normally,
>> you'd use the higher-level capabilities, but if you need something in
>> ntdll (e.g., if you're Cygwin) nothing stops your calling into the
>> lower-level system facilities directly. ntdll is tightly bound to the
>> kernel; the higher-level libc, not so.
>> 
>> We should adopt a similar approach. Shipping a lower-level
>> "liblinux.so" tightly bound to the kernel would not only let the
>> kernel bypass glibc's "editorial discretion" in exposing new
>> facilities to userspace, but would also allow for tighter user-kernel
>> integration that one can achieve with a simplistic syscall(2)-style
>> escape hatch. (For example, for a long time now, I've wanted to go
>> beyond POSIX and improve the system's signal handling API, and this
>> improvement requires userspace cooperation.) The vdso is probably too
>> small and simplistic to serve in this role; I'd want a real library.
> 
> Can you expand on your reasoning here?
> 
> Playing devil's advocate:
> 
> If the library is just exposing the syscall interface, I don't see
> why it _couldn't_ fit into the vdso (or something vdso-like).
> 
> If a separate library, I'd be concerned that it would accumulate
> value-add bloat over time, and the kernel ABI may start to creep since
> most software wouldn't invoke the kernel directly any more.  Even if
> it's maintained in the kernel tree, its existence as an apparently
> standalone component may encourage forking, leading to a potential
> compatibility mess.
> 
> The vdso approach would mean we can guarantee that the library is
> available and up to date at runtime, and may make it easier to keep
> what's in it down to sane essentials.

Hmm. Putting on my vDSO hat:

The vDSO could provide all kinds of nifty things. Better exception handling comes to mind. But it has two major limitations that severely restrict what it can do:

- It can’t allocate memory. We probably want to keep it that way.

 - It can’t use TLS.  Solving this without genuinely awful ABI issues may be extremely hard. We *could* require callers to pass a thread pointer in, I suppose.

Also, if we make the vDSO stateful, CRIU is going to have a blast.  We might need to expose explicit save and restore abilities.

As a straw man use case, it would be neat if DSOs (or the loader, maybe) could register a list of exception fixups per DSO.  The kernel could consult these lists before delivering a signal.  ISTM it wouldn’t be so crazy if the vDSO handled registration, although it could uses syscalls as well. If the vDSO did it, it would need somewhere to put the lists.

  reply	other threads:[~2018-11-13 20:58 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-10 18:52 Official Linux system wrapper library? Daniel Colascione
2018-11-10 19:01 ` Willy Tarreau
2018-11-10 19:06   ` Daniel Colascione
2018-11-10 19:33     ` Willy Tarreau
2018-11-10 19:20 ` Greg KH
2018-11-10 19:58   ` Vlastimil Babka
2018-11-12  2:03     ` Carlos O'Donell
2018-11-12  2:24   ` Carlos O'Donell
2018-11-12  2:36     ` Greg KH
2018-11-12 16:08       ` Jonathan Corbet
2018-11-12 20:03         ` Greg KH
2018-12-09  4:38         ` Randy Dunlap
2018-12-10 16:27           ` Jonathan Corbet
2018-12-10 17:39             ` Carlos O'Donell
2018-12-10 23:32               ` Randy Dunlap
2018-11-12  5:46     ` Andy Lutomirski
2018-11-11  6:55 ` Michael Kerrisk (man-pages)
2018-11-11  8:17   ` Willy Tarreau
2018-11-11  8:25     ` Daniel Colascione
2018-11-11 10:40       ` Florian Weimer
2018-11-11 10:40         ` Florian Weimer
2018-11-11 10:30     ` Florian Weimer
2018-11-11 10:30       ` Florian Weimer
2018-11-11 11:02       ` Willy Tarreau
2018-11-11 12:07         ` Florian Weimer
2018-11-11 12:07           ` Florian Weimer
2018-11-11 10:53     ` Michael Kerrisk (man-pages)
2018-11-11 11:02       ` Florian Weimer
2018-11-11 11:02         ` Florian Weimer
2018-11-12 16:43         ` Joseph Myers
2018-11-13 15:15           ` Carlos O'Donell
2018-11-11 11:11       ` Willy Tarreau
2018-11-11 11:46         ` Florian Weimer
2018-11-11 11:46           ` Florian Weimer
2018-11-11 12:09           ` Willy Tarreau
2018-11-12 12:25             ` Florian Weimer
2018-11-12 12:25               ` Florian Weimer
2018-11-12 17:36             ` Joseph Myers
2018-11-12 17:53               ` Greg KH
2018-11-12 18:09                 ` Joseph Myers
2018-11-12 18:14                   ` Randy Dunlap
2018-11-12 16:59           ` Joseph Myers
2018-11-14 12:03           ` Adam Borowski
2018-11-14 12:10             ` Florian Weimer
2018-11-14 12:10               ` Florian Weimer
2018-11-16 21:24         ` Alan Cox
2018-11-11 11:09   ` Florian Weimer
2018-11-11 11:09     ` Florian Weimer
2018-11-11 14:22     ` Daniel Colascione
2018-11-12  1:44       ` Paul Eggert
2018-11-12  8:11       ` Florian Weimer
2018-11-12  8:11         ` Florian Weimer
2018-11-12 13:19         ` Daniel Colascione
2018-11-12 17:24           ` Zack Weinberg
2018-11-12 18:28             ` Daniel Colascione
2018-11-12 19:11               ` Florian Weimer
2018-11-12 19:11                 ` Florian Weimer
2018-11-12 19:26                 ` Daniel Colascione
2018-11-12 22:51                   ` Joseph Myers
2018-11-12 23:10                     ` Daniel Colascione
2018-11-12 23:26                       ` Joseph Myers
2018-11-12 22:34                 ` Joseph Myers
2018-11-13 19:39           ` Dave Martin
2018-11-13 20:58             ` Andy Lutomirski [this message]
2018-11-14 10:54               ` Dave Martin
2018-11-14 11:40                 ` Florian Weimer
2018-11-14 11:40                   ` Florian Weimer
2018-11-15 10:33                   ` Dave Martin
2018-11-14 11:58             ` Szabolcs Nagy
2018-11-14 14:46               ` Andy Lutomirski
2018-11-14 15:07                 ` Florian Weimer
2018-11-14 15:07                   ` Florian Weimer
2018-11-14 17:40                 ` Joseph Myers
2018-11-14 18:13                   ` Paul Eggert
2018-11-14 14:58               ` Carlos O'Donell
2018-11-14 17:15                 ` Arnd Bergmann
2018-11-14 18:30                   ` Joseph Myers
2018-11-14 18:30                     ` Joseph Myers
2018-11-14 15:40               ` Daniel Colascione
2018-11-14 18:15                 ` Joseph Myers
2018-11-14 18:35                   ` Daniel Colascione
2018-11-14 18:47                     ` Joseph Myers
2018-11-15  5:30                       ` Theodore Y. Ts'o
2018-11-15 16:29                         ` Joseph Myers
2018-11-15 17:08                           ` Theodore Y. Ts'o
2018-11-15 17:14                             ` Joseph Myers
2018-11-15 21:00                             ` Carlos O'Donell
2018-11-15 20:34                       ` Carlos O'Donell
2018-11-23 13:34           ` Florian Weimer
2018-11-23 13:34             ` Florian Weimer
2018-11-23 14:11             ` David Newall
2018-11-23 15:23               ` Szabolcs Nagy
2018-11-24  3:41                 ` David Newall
2018-11-28 13:18               ` David Laight
2018-11-23 20:15             ` Daniel Colascione
2018-11-23 23:19               ` Dmitry V. Levin
2018-11-12 12:45       ` Szabolcs Nagy
2018-11-12 14:35         ` Theodore Y. Ts'o
2018-11-12 14:40           ` Daniel Colascione

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=69B07026-5E8B-47FC-9313-E51E899FAFB0@amacapital.net \
    --to=luto@amacapital.net \
    --cc=Dave.Martin@arm.com \
    --cc=carlos@redhat.com \
    --cc=dancol@google.com \
    --cc=fweimer@redhat.com \
    --cc=joelaf@google.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=vbabka@suse.cz \
    --cc=w@1wt.eu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.