Christian Eggers
2020-Jul-08 06:37 UTC
[klibc] [PATCH] Add syscall wrappers required by libkeyutils
libkeyutils is used by the keyctl command which is required for loading keys into the kernel (e.g. for mounting an authenticated UBIFS as root file system). libkeyutils usually invokes syscall() directly. As syscall() is not provided by klibc, libkeyutils has to be slightly modified for using the klibc wrappers. Signed-off-by: Christian Eggers <ceggers at arri.de> --- usr/klibc/SYSCALLS.def | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr/klibc/SYSCALLS.def b/usr/klibc/SYSCALLS.def index 461d9bf6..67056a2c 100644 --- a/usr/klibc/SYSCALLS.def +++ b/usr/klibc/SYSCALLS.def @@ -274,6 +274,9 @@ int reboot::__reboot(int, int, int, void *); int syslog::klogctl(int, char *, int); int sysinfo(struct sysinfo *); long kexec_load(void *, unsigned long, struct kexec_segment *, unsigned long); +int add_key(const char *, const char *, const void *, size_t, int); +int request_key(const char *, const char *, const char *, int); +long keyctl::__keyctl(int, unsigned long, unsigned long, unsigned long, unsigned long); /* * Low-level I/O (generally architecture-specific); -- Christian Eggers Embedded software developer Arnold & Richter Cine Technik GmbH & Co. Betriebs KG Sitz: Muenchen - Registergericht: Amtsgericht Muenchen - Handelsregisternummer: HRA 57918 Persoenlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH Sitz: Muenchen - Registergericht: Amtsgericht Muenchen - Handelsregisternummer: HRB 54477 Geschaeftsfuehrer: Dr. Michael Neuhaeuser; Stephan Schenk; Walter Trauninger; Markus Zeiler
Ben Hutchings
2020-Jul-25 21:36 UTC
[klibc] [PATCH] Add syscall wrappers required by libkeyutils
On Wed, 2020-07-08 at 08:37 +0200, Christian Eggers wrote:> libkeyutils is used by the keyctl command which is required for loading > keys into the kernel (e.g. for mounting an authenticated UBIFS as root > file system). > > 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? Ben.> Signed-off-by: Christian Eggers <ceggers at arri.de> > --- > usr/klibc/SYSCALLS.def | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/usr/klibc/SYSCALLS.def b/usr/klibc/SYSCALLS.def > index 461d9bf6..67056a2c 100644 > --- a/usr/klibc/SYSCALLS.def > +++ b/usr/klibc/SYSCALLS.def > @@ -274,6 +274,9 @@ int reboot::__reboot(int, int, int, void *); > int syslog::klogctl(int, char *, int); > int sysinfo(struct sysinfo *); > long kexec_load(void *, unsigned long, struct kexec_segment *, unsigned long); > +int add_key(const char *, const char *, const void *, size_t, int); > +int request_key(const char *, const char *, const char *, int); > +long keyctl::__keyctl(int, unsigned long, unsigned long, unsigned long, unsigned long); > > /* > * Low-level I/O (generally architecture-specific);-- Ben Hutchings Anthony's Law of Force: Don't force it, get a larger hammer. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: <https://lists.zytor.com/archives/klibc/attachments/20200725/8622ff95/attachment-0001.sig>
Christian Eggers
2020-Jul-27 09:43 UTC
[klibc] [PATCH] Add syscall wrappers required by libkeyutils
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()/ getpgid() 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 stubs? 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? regards Christian ________________________________ [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