Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp927455pxb; Fri, 22 Apr 2022 14:32:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzATlYFvA4+YK7L8mr7cshUyyyGoD7+1IOeEkMgw4l2uPvib3YjxlgiwYQ+i4LK9rwf7+/W X-Received: by 2002:a05:6a00:ac1:b0:4f1:29e4:b3a1 with SMTP id c1-20020a056a000ac100b004f129e4b3a1mr6889327pfl.63.1650663144873; Fri, 22 Apr 2022 14:32:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650663144; cv=none; d=google.com; s=arc-20160816; b=D8Q4iMhhb8StpSuzzGRGKY3mhEfqB0sajCh/kiqR2SPIrZ1929WVe4bhlQkgIMeq/S rhThl/zORpzV3zy7283nTcugdoChUN0v90MSrPGkNP2kJXzzL9tU0hKjlfKWOR1eNT8a /vUL003mbLWp4w/WLwB4lhCdNvCWAyJZOmi3P+xk1hziFoBCvHJfjG5e2QuUKY3ZMt4i oCNXHBcV5zVhTQbC8xXpMZ9kDmm+XtSU5TrG3j5iVbkxvKjPeJNevK/yeg3QUaR/3xvX bsk26WKoL/cTWQN3aMhf1QnhVr3qWPEoL/DBbe+anTudtuB8rxTL+X3ILzdSMTt3VOUG JvUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Y5ynLRu29XVeXc48USDTxMOFlYCYJRAeGXyfD8MUnEM=; b=GuvL6NTzIaRNZ3t31E6tCI917rPyOn8sia4vV4rfvdHj+DB5Ff6i+iKZ9EZCU0oz2L tWn3ji30SnqUqq8qquNn88IMiZi6Y8fD+8H55q6Nxponw6YMTvzVABESfnIK6mxgncUm IsRP0x+GbA6ZhV2E0EFaeiXRO6vmS37Fnw/4BRY1r3BHHpjLNR+DPceP7KUz3p9dWXWR 0oyLhSZOQSQVmdIeQ9y8WeN5u3jc2mZ24JkGJ/Wa5iWozxPfLk7nEFkvMgRLzdJ6QNO2 MZaEHRdOf3TXKEsI8mywF1S7s9zm69g0MAtYMefopFXnuvXxT/mFpea90iwC1s2WUCjx iHRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B5i5y2Bk; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id y14-20020a655a0e000000b0039942b974b1si9058847pgs.303.2022.04.22.14.32.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 14:32:24 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B5i5y2Bk; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 685A21F7D7F; Fri, 22 Apr 2022 12:39:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381020AbiDTRSV (ORCPT + 99 others); Wed, 20 Apr 2022 13:18:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381040AbiDTRRq (ORCPT ); Wed, 20 Apr 2022 13:17:46 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28C062AEE; Wed, 20 Apr 2022 10:14:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 6F8ADCE1F38; Wed, 20 Apr 2022 17:14:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 658ECC385A1; Wed, 20 Apr 2022 17:14:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650474894; bh=BOE8M66NoW0jpL4xn18L8Ak7nnXuciSXX4ZW9yjMTx8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=B5i5y2BkRjc1O3qYYtgxfPRCQamSS1CNqYHSvulOq4k2kR62dTLYjpA/xzaNQAeQv oYnTQWwzwQ4JzG5n9YiRcIVBbMheUduyZhQu681ld+qq2KUcg3ubJuRBvXBa3bKGri vdn895iW6K7cyNXiAvkmCfuP8YfTeEALw97x8j8Y= Date: Wed, 20 Apr 2022 19:14:52 +0200 From: Greg KH To: Spencer Baugh Cc: linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, marcin@juszkiewicz.com.pl, torvalds@linux-foundation.org, arnd@arndb.de Subject: Re: Explicitly defining the userspace API Message-ID: References: <874k2nhgtg.fsf@catern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <874k2nhgtg.fsf@catern.com> X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 20, 2022 at 04:15:25PM +0000, Spencer Baugh wrote: > > Linux guarantees the stability of its userspace API, but the API > itself is only informally described, primarily with English prose. I > want to add an explicit, authoritative machine-readable definition of > the Linux userspace API. > > As background, in a conventional libc like glibc, read(2) calls the > Linux system call read, passing arguments in an architecture-specific > way according to the specific details of read. > > The details of these syscalls are at best documented in manpages, and > often defined only by the implementation. Anyone else who wants to > work with a syscall, in any way, needs to duplicate all those details. > > So the most basic definition of the API would just represent the > information already present in SYSCALL_DEFINE macros: the C types of > arguments and return values. More usefully, it would describe the > formats of those arguments and return values: that the first argument > to read is a file descriptor rather than an arbitrary integer, and > what flags are valid in the flags argument of openat, and that open > returns a file descriptor. A step beyond that would be describing, in > some limited way, the effects of syscalls; for example, that read > writes into the passed buffer the number of bytes that it returned. So how would you define read() in this format in a way that has not already been attempted in the past? How are you going to define a format that explains functionality in a way that is not just the implementation in the end? > One step in this direction is Documentation/ABI, which specifies the > stability guarantees for different userspace APIs in a semi-formal > way. But it doesn't specify the actual content of those APIs, and it > doesn't cover individual syscalls at all. The content is described in Documentation/ABI/ entries, where do you see that missing? And you are correct, that place does not describe syscalls, or other user/kernel interfaces that predate sysfs. good luck! greg k-h