[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210427022431.GA168962@yury-ThinkPad>
Date: Mon, 26 Apr 2021 19:24:31 -0700
From: Yury Norov <yury.norov@...il.com>
To: linux-api@...r.kernel.org, linux-arch@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: "Alexander A. Klimov" <grandmaster@...klimov.de>,
André Almeida <andrealmeid@...labora.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Arnd Bergmann <arnd@...db.de>, David Sterba <dsterba@...e.com>,
Joe Perches <joe@...ches.com>,
Jonathan Corbet <corbet@....net>,
Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
Mike Rapoport <rppt@...nel.org>
Subject: Re: [PATCH] Documentation: syscalls: add a note about ABI-agnostic
types
On Fri, Apr 09, 2021 at 01:43:04PM -0700, Yury Norov wrote:
> Recently added memfd_secret() syscall had a flags parameter passed
> as unsigned long, which requires creation of compat entry for it.
> It was possible to change the type of flags to unsigned int and so
> avoid bothering with compat layer.
>
> https://www.spinics.net/lists/linux-mm/msg251550.html
>
> Documentation/process/adding-syscalls.rst doesn't point clearly about
> preference of ABI-agnostic types. This patch adds such notification.
>
> Signed-off-by: Yury Norov <yury.norov@...il.com>
> ---
> Documentation/process/adding-syscalls.rst | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/Documentation/process/adding-syscalls.rst b/Documentation/process/adding-syscalls.rst
> index 9af35f4ec728..46add16edf14 100644
> --- a/Documentation/process/adding-syscalls.rst
> +++ b/Documentation/process/adding-syscalls.rst
> @@ -172,6 +172,13 @@ arguments (i.e. parameter 1, 3, 5), to allow use of contiguous pairs of 32-bit
> registers. (This concern does not apply if the arguments are part of a
> structure that's passed in by pointer.)
>
> +Whenever possible, try to use ABI-agnostic types for passing parameters to
> +a syscall in order to avoid creating compat entry for it. Linux supports two
> +ABI models - ILP32 and LP64. The types like ``void *``, ``long``, ``size_t``,
> +``off_t`` have different size in those ABIs; types like ``char`` and ``int``
> +have the same size and don't require a compat layer support. For flags, it's
> +always better to use ``unsigned int``.
> +
>
> Proposing the API
> -----------------
> --
> 2.25.1
So, what about this patch? Mauro, are you OK with this? If no
objections, I'd like to have it merged in this window.
Powered by blists - more mailing lists