Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2272619imu; Sat, 10 Nov 2018 11:07:25 -0800 (PST) X-Google-Smtp-Source: AJdET5e6ho5f5uvCGHDlFprU43h//0lekYC6p7RiEecl2MeiGQmf9xFWJQvclHkXmZb0aCdhnFuY X-Received: by 2002:a62:cc4:: with SMTP id 65-v6mr13829484pfm.127.1541876845580; Sat, 10 Nov 2018 11:07:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541876845; cv=none; d=google.com; s=arc-20160816; b=cpE2osp/VlJ0n5J54Lfo0sAxqXF02DxH6+bhq54DmIb1aWE9QMJPrR/2ySVCMJef8R 974e9f7nKOOqtrOef5FxojJ2+AOuwbY1JV6AbPOOomHeFWyy/SCkLyYoX9Zesl4mIp6Z 7iUae0AFDauNxEAxBOSS6OJZ8zl3qI2YxQsZpL4aYgoJK2Od7109wNquA7DzW4sZowCE L8X2iVZOWeM3gIzO961uGV19TRPoF92rRv33/qPljyDfBf9rx1j0XhMzMCJ+HZVrX/RG cFcy+A8Z/f33oAqq5r0V+jCW5/BlEOZYc386X5gdf1t0297LiFpNqhnPY/xgF/V60a79 xNZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=n5v/iLGMlv7PH3fcfhp2JAhZuyfFV7BC4VmUgPZq/jo=; b=SZs3+5RXxDCR3TsYzMNLCzjc5Rb3K1wlhptGIblnV6BEtMqTlt+i6m1Jeu7ObGsU2d 5IIf+0EkYs5QEZBaWmEh/GdFDOUtOcZWI2jIKG+Cqss3HcRzCzVAtYfilq08Af5EfDaZ BkqrOFhjpuyvPYPfKPPdISY8JeCW2FR2KoySeViq2gfL2glYgRO3BsSnpZ8AYgikrjw8 3nkBD7Eopidrez1Odq1IhnbjpT0yg89azjd16feYVYCI0lvYmhaRfc5xFLoEe9U1ql85 mTaUc+S7cnCPmmLsgbRg1m+/YD+bFckfk9eQ/UQzGMsjgvvqJliL0bRUAg3v83vqm5v6 MZSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=afi0yMJZ; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l91-v6si12240737plb.315.2018.11.10.11.07.10; Sat, 10 Nov 2018 11:07:25 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=afi0yMJZ; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727214AbeKKEwr (ORCPT + 99 others); Sat, 10 Nov 2018 23:52:47 -0500 Received: from mail-vk1-f196.google.com ([209.85.221.196]:45705 "EHLO mail-vk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726323AbeKKEwr (ORCPT ); Sat, 10 Nov 2018 23:52:47 -0500 Received: by mail-vk1-f196.google.com with SMTP id n126so1148187vke.12 for ; Sat, 10 Nov 2018 11:06:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=n5v/iLGMlv7PH3fcfhp2JAhZuyfFV7BC4VmUgPZq/jo=; b=afi0yMJZwGa54wYqGNQGfzIGxyPrgJdtD3ZOR9Qc0BwZ5RoXnC3a3iep+P88MNczn/ QQeR1N32HuW/J+7K/geuSQXKMLAON4FopYeD0JsG+FwTBqcJLstiWqUcSxQFGm6rcsJZ FGHK3ZhT0pTMH55mE+z8iTePD5RKPVlirD1yJCIs6GZxqakRhXAsRhK/wgSDUmFQ7T2y 0HOq/F819OU7V8d1H7UICLvKj5g6braE3GSOxUNAJ9FP3GXM0++ZIhTHBhlaMmsQ1pvW IhZuH70OKzY8KgllrOtk87kFhb8f1KBzCHAVZxJQ3vKhxhemKhkTqGlphQAqSe3q7t9R 9PHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=n5v/iLGMlv7PH3fcfhp2JAhZuyfFV7BC4VmUgPZq/jo=; b=CakiFvNppRFsPOl7WYTt0PaYAlhqtC7QtvzefGbCdpKXQD+zZ/GQ4mAr438xOv/gYj gYkc1iKZ0YTtSQ3Np3tvXd6vd7UsxFNXiNyv7JGvzhbKYAGy1wS5isL+61BNFPKAraB0 aVHCv5yhdHLnOceuimUzao+nUEtxxyHsqk3181LPsrWFhw3O9QfCog6ie+LlDMLtgGPE vxZGbnUgbide13e7rWPar7j1IX4LLLsXK7MHKUkR6IzFSaZXv5xFLIZCh7N/wopth0CS OsJ+jTIcE2Esb+yy3TX5ldJgNt73aRo8Vtz8H1oG8jZUeyzN35M4Gjfy39Np6H8J/x1W 8FEw== X-Gm-Message-State: AGRZ1gJXtZkr1N2MKpcgSzbaEv7tEc7Us9DwGvOHPzO+J1pu5mQmk8ck VjrlpMCDghOQAFpmQTfIUA2o5IEDEcUNcmjt77EAmg== X-Received: by 2002:a1f:34c7:: with SMTP id b190mr2263365vka.55.1541876805708; Sat, 10 Nov 2018 11:06:45 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a67:f48d:0:0:0:0:0 with HTTP; Sat, 10 Nov 2018 11:06:45 -0800 (PST) In-Reply-To: <20181110190132.GA21185@1wt.eu> References: <20181110190132.GA21185@1wt.eu> From: Daniel Colascione Date: Sat, 10 Nov 2018 11:06:45 -0800 Message-ID: Subject: Re: Official Linux system wrapper library? To: Willy Tarreau Cc: linux-kernel , Joel Fernandes , Linux API Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Nov 10, 2018 at 11:01 AM, Willy Tarreau wrote: > On Sat, Nov 10, 2018 at 10:52:06AM -0800, Daniel Colascione wrote: >> Now that glibc is basically not adding any new system call wrappers, >> how about publishing an "official" system call glue library as part of >> the kernel distribution, along with the uapi headers? I don't think >> it's reasonable to expect people to keep using syscall(__NR_XXX) for >> all new functionality, especially as the system grows increasingly >> sophisticated capabilities (like the new mount API, and hopefully the >> new process API) outside the strictures of the POSIX process. > > It's partly related, but you may be interested in something I did that > is in the the RCU tree. It's called "nolibc", it's a set of syscall > wrappers defined only in include files. It's not complete, but still > enough to boot some small init wrappers. Mine can extract tar files > and do stuff like this with it. Here is the kernel port in the RCU > tree and an example of code using it : > > https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/tree/tools/testing/selftests/rcutorture/bin/nolibc.h?h=rcu/next > https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/tree/tools/testing/selftests/rcutorture/bin/mkinitrd.sh?h=rcu/next > > The original one is maintained here (not very active since it works > well enough for my use cases now eventhough it's far from being > complete) : > > http://git.formilux.org/?p=people/willy/nolibc.git > > Maybe something along this could be done for the vast majority of > syscalls and the thicker stuff be left to glibc ? That would allow > simple userland to build without glibc using only kernel headers, > or by occasionally defining a few extra stuff or glue. Reminds me of LSS: https://chromium.googlesource.com/linux-syscall-support/ I'm not a fan of this approach for general-purpose use. There's value in having *some* common function-level indirection before actually issuing system calls, e.g., for LD_PRELOAD stuff.