Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2928546imu; Sun, 11 Nov 2018 04:11:14 -0800 (PST) X-Google-Smtp-Source: AJdET5fyTPtyrafZLn43kFfN66w5VoQ5076spGNt8Yk9p7u84WfohVzg2ikLQcX4WEsFY/3MYhNY X-Received: by 2002:a17:902:b217:: with SMTP id t23-v6mr4030837plr.128.1541938273957; Sun, 11 Nov 2018 04:11:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541938273; cv=none; d=google.com; s=arc-20160816; b=gTqSGNBwBO/5JDSoyn7Pi85WzGD/Lb1ataq+QTwpUTQhE5LSLLWuSg2UMMXq0CpdJE 1Xdp3v2TjxMTRDZiX50lkb3VuRwvqnV8Iwp9CyH87hK+gHUwwH6eqM04llNZJPlkuEz+ zWZiiW4+G6d0j8EqW3E5zuCEDuNAvrmAVoCfbDMrrKPqimPxTW42lDpS+HtP7n/BPMh6 KuyvPeV2LZmjF9JIZmSW4xjY3o8UkNmINlUBJuNd0Vdh4d1y4rK2mZoMBplsnIDp6qdB RVGjkYTY4jgEHhAfWzO3/gqKK2Gen9VW1BbY7o+pQaNLXNOGow31nY/3wGr/ltKd4aoM LceQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=im2v/CiVFaJlb2QyPyabZIPVlIbDVrGyz472sdJFMJg=; b=VXSqOtpwqgWR2VVDpWhFj1GeRAsu6XzVzaYJobiJHxUVEuNbG5dsZcc1zYb+Mqo6Tk Pdujh/xq3BIN9Vr6nl5Dkvnu3r+PeRk0X7T9kYcIV3slMj3S7Dwih5e/1YvtGgtwUs7U o36OsmarSkWHJXvZ9/hfsKkJnZ12H0W25U637RMTBfaye/n5/p8TTBMqKf5xz/cLEeHP m0yW45GJparUopP2EOSVgBE8XKAWY9N2e8rb28gWcKkiO4uf7MRqsxSb8+hEfGls93k2 HNmhJXEzu/PiXQKlOhuUJa++lJRvIdjFWKDrD4lpomGGziDCX1ZXROrBiEqn2vsB2QLe IwiA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5si13824271pgr.411.2018.11.11.04.10.58; Sun, 11 Nov 2018 04:11:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727978AbeKKV5r (ORCPT + 99 others); Sun, 11 Nov 2018 16:57:47 -0500 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:41874 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727492AbeKKV5r (ORCPT ); Sun, 11 Nov 2018 16:57:47 -0500 Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id wABC9AUU004450; Sun, 11 Nov 2018 13:09:10 +0100 Date: Sun, 11 Nov 2018 13:09:10 +0100 From: Willy Tarreau To: Florian Weimer Cc: "Michael Kerrisk (man-pages)" , Daniel Colascione , linux-kernel , Joel Fernandes , Linux API , Vlastimil Babka , "Carlos O'Donell" , "libc-alpha@sourceware.org" Subject: Re: Official Linux system wrapper library? Message-ID: <20181111120910.GA4425@1wt.eu> References: <20181111081725.GA30248@1wt.eu> <3664a508-ca74-4ff0-39a6-34543194a24e@gmail.com> <20181111111143.GB4189@1wt.eu> <87zhufvntw.fsf@oldenburg.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87zhufvntw.fsf@oldenburg.str.redhat.com> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Nov 11, 2018 at 12:46:35PM +0100, Florian Weimer wrote: > > In practice we all know (believe?) that both statements above are > > true but in practice 99% of the time there's a 1:1 relation between > > these two components. > > Eh. Most Linux systems do not run glibc at all (and use cryptography > and other tricks to prevent users from installing it). Good point on this one. I could even have thought that most syscalls are added with glibc in mind but your counter-example above could remain valid. > > What we'd really need would be to have the libc > > interface as part of the operating system itself. I'm perfectly fine > > with glibc providing all the "high-level" stuff like strcpy(), FILE* > > operations etc, and all this probably is mostly system-independent. > > That's a bit messy, unfortunately. > > The kernel does not know about TCB layout, so a lot of low-level > threading aspects are defined by userspace. > > The kernel does not know about POSIX cancellation. Directly calling > system calls breaks support for that. > > A lot of multi-threaded applications assume that most high-level > functionality remains usable even after fork in a multi-threaded > process. (This is increasingly a problem today with all those direct > calls to clone.) Unfortunately, this introduces rather tricky > low-level/high-level cross-subsystem issues, too. But don't you think that moving a bit of this into the kernel repository could improve the situation ? The corner cases could then be detected when the feature is developed and be addressed either by adapting the kernel side of the syscall or even by changing the design before it's committed. Maybe a few extra syscalls are missing to retrieve some critial info that would make things more reliable or easier between userland and kernel, and that would become more obvious with all the relevant parts at the same place ? > > But the system interface could possibly be handled easier in the > > system itself, which would also provide a smoother adoption of new > > syscalls and API updates. It would also limit the hassle required to > > provide new syscalls, as if you start to have to contribute to two > > projects at once for a single syscall, it becomes really painful. > > Sure, the duplication is unfortunate. > > Several glibc contributors deeply care about standards compliance for > header files. For having suffered a lot from the libc-4 to libc-5 then libc-5 to glibc, I certainly can understand their concerns about standards compliance. > The kernel developers care not, and the result is that we > copy definitions and declarations from the kernel header files, creating > additional problems. Probably that these standard compatibility issues should be addressed at their root in the kernel header definitions in fact. Working around issues always leads to a stall at some point, and it encourages the process not to change. > We also want to use old kernel headers to compile glibc and still > implement features which are only defined by newer (upstream) kernels, > so that leads to more duplication. This one could possibly be got rid of. When I build glibc, I specify the oldest supported kernel, which usually is older than or equal to the headers used to build, but I don't expect that newer features will magically work at all. Thus I normally build with the most recent headers covering my needs. Thanks, Willy