[klibc] [PATCH] Add syscall wrappers required by libkeyutils

Christian Eggers ceggers at arri.de
Mon Jul 27 02:43:36 PDT 2020

On Saturday, 25 July 2020, 23:36:33 CEST, Ben Hutchings wrote:
> On Wed, 2020-07-08 at 08:37 +0200, Christian Eggers wrote:
> > ...
> > libkeyutils usually invokes syscall() directly. As syscall() is not
> > provided by klibc, libkeyutils has to be slightly modified for using the
> > klibc wrappers.
> Wouldn't it be more useful for klibc to implement syscall() then?

I hope that somebody else could respond to this question as I am likely not
skilled enough to answer this.

For me it looks like there are currently two cases of using syscalls in klibc:
1. Exporting stubs directly: For many syscalls, automatically generated stubs
are directly exported as symbols for use by the linker. Examples: setpgid()/

2. Using stubs internally for implementing public function. The auto generated
stub is used as base for implementing a C library function. Example: exit()

For both cases, the code for the individual stubs is auto generated using a
perl script (with an arch specific "plugin"). All generated stubs call common
arch specific assembly code (__syscall_common).

The lack of the syscall function itself lead me to the (probably wrong)
conclusion that this is "by design". Should all syscalls use the generated

There are some syscalls which are traditionally not implemented by C libraries
(like keyctl, add_key and request_key). These functions are required for
mounting encrypted / authenticated (root) file systems. Programs using this
functionality call syscall() directly. Providing a syscall function in klibc
would avoid klibc specific modifications of such software.

Are there reasons for NOT providing the syscall() function in klibc? Who is
able to implement syscall() for klibc?


 [http://assets.arri.com/media/sign/2020-04-03-E-mail-signature-Stellar2_V1.jpg] <https://microsites.arri.com/stellar/>

Get all the latest information from www.arri.com<https://www.arri.com/>, Facebook<https://www.facebook.com/TeamARRI>, Twitter<https://twitter.com/ARRIChannel>, Instagram<https://instagram.com/arri> and YouTube<https://www.youtube.com/user/ARRIChannel>.

Arnold & Richter Cine Technik GmbH & Co. Betriebs KG
Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRA 57918
Persönlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH
Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRB 54477
Geschäftsführer: Dr. Michael Neuhäuser; Stephan Schenk; Walter Trauninger; Markus Zeiler

More information about the klibc mailing list