From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS17314 8.43.84.0/22 X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,NICE_REPLY_A, PDS_RDNS_DYNAMIC_FP,RCVD_IN_DNSWL_MED,RDNS_DYNAMIC,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 147AD1F626 for ; Mon, 20 Feb 2023 13:25:35 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=NEG5hiIx; dkim-atps=neutral Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 36FFD384474D for ; Mon, 20 Feb 2023 13:25:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 36FFD384474D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676899534; bh=uojcH+axusVN1aQaJZqVLesgreX8A3ajRe8LaGwL71U=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=NEG5hiIxndNhH5Oxhh4g4ecp33Z3+OHohEP13OXwoshpcAVW+akubtb/4nkjSgeK5 2SAE4dE2AVuakTih+76j+DnMWE38GKDnc/K+NYel7hUj5fN+R4VjPmWTd+K5CfLP6a MD110rJMy4MVDmlBEC1KEE45Qn9ryLJo2n1pL5+A= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 156DE384DD26 for ; Mon, 20 Feb 2023 13:25:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 156DE384DD26 Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-652-7vLt8WVPOP-Rrdjxg7ze4Q-1; Sun, 19 Feb 2023 16:20:39 -0500 X-MC-Unique: 7vLt8WVPOP-Rrdjxg7ze4Q-1 Received: by mail-il1-f198.google.com with SMTP id v6-20020a056e02164600b0031570404cf1so536128ilu.1 for ; Sun, 19 Feb 2023 13:20:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uojcH+axusVN1aQaJZqVLesgreX8A3ajRe8LaGwL71U=; b=2nS5+0k7HwmQLYlJZ+s8Pkvaq3Vue3PPNeDz55ow6/QqN0H6MVE0FLwMJpRp1fd6i/ t78E+heEkZ72DPwKp62e8Yfq4TBi3vk4s4f9k7GJRRKdbg54Ny8J06qxMdkJ0tetydDR D0YqFvILPmTvSoKCAa5cNXB4l1kO9ufCWxzsyJW5jjHIkswEwE8dXR6RBOBxpFASh86F lb5TaplLg12JJ+JPG8Bx7pFI5+gv+AxcO+PkkPnWeKsuuooxcZU6kUk+ISocp/TB+B+/ jxE3qz/Dail4778Vo0nzU+t+D16SEFEHKB/JWQrb/s2MBkPa2ISmBf20ZJV9Awr4sjju 5uFA== X-Gm-Message-State: AO0yUKWuM3UxlymljAo80UWsLT6rSR5o8YVyvmR5Xd3WvMoalxqMrRoB xg6Nmz3975fB5Uw3+5t6mjB6dGhUJ1mOF+g4uZUIBk2hElYP6R+tN4uXydNZm17mdhCRNs52nrd 1RjHuOA8PhEsakmI70VKG X-Received: by 2002:a6b:6402:0:b0:720:9057:a083 with SMTP id t2-20020a6b6402000000b007209057a083mr5657293iog.13.1676841638536; Sun, 19 Feb 2023 13:20:38 -0800 (PST) X-Google-Smtp-Source: AK7set/gfPqSp/AtcOgZBUppGOKcssmqYuXMUYyqjnKs7wIn+uT+VcqY4LicFRiXvP0lbEBaf2VflA== X-Received: by 2002:a6b:6402:0:b0:720:9057:a083 with SMTP id t2-20020a6b6402000000b007209057a083mr5657281iog.13.1676841638188; Sun, 19 Feb 2023 13:20:38 -0800 (PST) Received: from [192.168.0.241] ([198.48.244.52]) by smtp.gmail.com with ESMTPSA id p14-20020a6bce0e000000b00734d27b267dsm3505130iob.17.2023.02.19.13.20.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 19 Feb 2023 13:20:37 -0800 (PST) Message-ID: <6cce5acb-5401-632a-5e71-2d085c0730f7@redhat.com> Date: Sun, 19 Feb 2023 16:20:36 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH v2 2/5] Linux: Assume and consolidate getsockname wire-up syscall To: Adhemerval Zanella , libc-alpha@sourceware.org References: <20221207212246.2384051-1-adhemerval.zanella@linaro.org> <20221207212246.2384051-3-adhemerval.zanella@linaro.org> Organization: Red Hat In-Reply-To: <20221207212246.2384051-3-adhemerval.zanella@linaro.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Carlos O'Donell via Libc-alpha Reply-To: Carlos O'Donell Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" On 12/7/22 16:22, Adhemerval Zanella wrote: > And disable if kernel does not support it. > > Checked on x86_64-linux-gnu and i686-linux-gnu. LGTM. Reviewed-by: Carlos O'Donell Tested-by: Carlos O'Donell > --- > sysdeps/unix/sysv/linux/generic/syscalls.list | 1 - > sysdeps/unix/sysv/linux/getsockname.c | 7 +------ > sysdeps/unix/sysv/linux/i386/kernel-features.h | 2 +- > sysdeps/unix/sysv/linux/kernel-features.h | 1 + > sysdeps/unix/sysv/linux/m68k/kernel-features.h | 2 +- > sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 - > sysdeps/unix/sysv/linux/powerpc/kernel-features.h | 1 - > sysdeps/unix/sysv/linux/s390/kernel-features.h | 2 +- > sysdeps/unix/sysv/linux/sh/kernel-features.h | 1 - > sysdeps/unix/sysv/linux/sparc/kernel-features.h | 6 ++++++ > 10 files changed, 11 insertions(+), 13 deletions(-) > > diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list > index 7dbfde0dae..e89ce91ac0 100644 > --- a/sysdeps/unix/sysv/linux/generic/syscalls.list > +++ b/sysdeps/unix/sysv/linux/generic/syscalls.list > @@ -1,5 +1,4 @@ > # File name Caller Syscall name # args Strong name Weak names > > # Socket APIs > -getsockname - getsockname i:ipp __getsockname getsockname OK. > getpeername - getpeername i:ipp __getpeername getpeername > diff --git a/sysdeps/unix/sysv/linux/getsockname.c b/sysdeps/unix/sysv/linux/getsockname.c > index d0718c2aaf..8350b800fe 100644 > --- a/sysdeps/unix/sysv/linux/getsockname.c > +++ b/sysdeps/unix/sysv/linux/getsockname.c > @@ -15,19 +15,14 @@ > License along with the GNU C Library; if not, see > . */ > > -#include > -#include > #include > - > #include > -#include > -#include > > int > __getsockname (int fd, __SOCKADDR_ARG addr, socklen_t *len) > { > #ifdef __ASSUME_GETSOCKNAME_SYSCALL > - return INLINE_SYSCALL (getsockname, 3, fd, addr.__sockaddr__, len); > + return INLINE_SYSCALL_CALL (getsockname, fd, addr.__sockaddr__, len); OK. > #else > return SOCKETCALL (getsockname, fd, addr.__sockaddr__, len); > #endif > diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h > index ddf9ec0e5f..0c949349e1 100644 > --- a/sysdeps/unix/sysv/linux/i386/kernel-features.h > +++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h > @@ -19,7 +19,6 @@ > > /* Direct socketcalls available with kernel 4.3. */ > #if __LINUX_KERNEL_VERSION >= 0x040300 > -# define __ASSUME_GETSOCKNAME_SYSCALL 1 OK. Refactoring here. We let the default linux generic decide what to do, but if we are on < 4.3 then we disable trying getsockname. Semantics remain the same, we just changed the way the default is set. > # define __ASSUME_GETPEERNAME_SYSCALL 1 > #endif > > @@ -42,6 +41,7 @@ > # undef __ASSUME_SOCKETPAIR_SYSCALL > # undef __ASSUME_LISTEN_SYSCALL > # undef __ASSUME_SHUTDOWN_SYSCALL > +# undef __ASSUME_GETSOCKNAME_SYSCALL OK. > #endif > > /* i686 only supports ipc syscall before 5.1. */ > diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h > index e63bd4b4fc..cac8708050 100644 > --- a/sysdeps/unix/sysv/linux/kernel-features.h > +++ b/sysdeps/unix/sysv/linux/kernel-features.h > @@ -84,6 +84,7 @@ > #define __ASSUME_SOCKETPAIR_SYSCALL 1 > #define __ASSUME_LISTEN_SYSCALL 1 > #define __ASSUME_SHUTDOWN_SYSCALL 1 > +#define __ASSUME_GETSOCKNAME_SYSCALL 1 OK. Assume it in the generic linux support. > > /* Support for SysV IPC through wired syscalls. All supported architectures > either support ipc syscall and/or all the ipc correspondent syscalls. */ > diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h > index 55b8958fb2..b8f8e48c8a 100644 > --- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h > +++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h > @@ -19,7 +19,6 @@ > > /* Direct socketcalls available with kernel 4.3. */ > #if __LINUX_KERNEL_VERSION >= 0x040300 > -# define __ASSUME_GETSOCKNAME_SYSCALL 1 OK. Remove. > # define __ASSUME_GETPEERNAME_SYSCALL 1 > #endif > > @@ -44,6 +43,7 @@ > # undef __ASSUME_SOCKETPAIR_SYSCALL > # undef __ASSUME_LISTEN_SYSCALL > # undef __ASSUME_SHUTDOWN_SYSCALL > +# undef __ASSUME_GETSOCKNAME_SYSCALL OK. > #endif > > /* No support for PI futexes or robust mutexes before 3.10 for m68k. */ > diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h > index 9ee6c621ee..12f9a55b03 100644 > --- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h > +++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h > @@ -19,7 +19,6 @@ > > /* All supported kernel versions for MicroBlaze have these syscalls. */ > #define __ASSUME_CONNECT_SYSCALL 1 > -#define __ASSUME_GETSOCKNAME_SYSCALL 1 OK. This one isn't even needed after the refactor. > #define __ASSUME_GETPEERNAME_SYSCALL 1 > #define __ASSUME_SEND_SYSCALL 1 > #define __ASSUME_RECV_SYSCALL 1 > diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h > index ad9eb340b5..852bac0313 100644 > --- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h > +++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h > @@ -19,7 +19,6 @@ > > /* New syscalls added for PowerPC in 2.6.37. */ > #define __ASSUME_CONNECT_SYSCALL 1 > -#define __ASSUME_GETSOCKNAME_SYSCALL 1 OK. Likewise. > #define __ASSUME_GETPEERNAME_SYSCALL 1 > #define __ASSUME_SEND_SYSCALL 1 > #define __ASSUME_RECV_SYSCALL 1 > diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h > index e47c628f51..3a3942fa68 100644 > --- a/sysdeps/unix/sysv/linux/s390/kernel-features.h > +++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h > @@ -19,7 +19,6 @@ > > /* Direct socketcalls available with kernel 4.3. */ > #if __LINUX_KERNEL_VERSION >= 0x040300 > -# define __ASSUME_GETSOCKNAME_SYSCALL 1 OK. > # define __ASSUME_GETPEERNAME_SYSCALL 1 > #endif > > @@ -44,6 +43,7 @@ > # undef __ASSUME_SOCKETPAIR_SYSCALL > # undef __ASSUME_LISTEN_SYSCALL > # undef __ASSUME_SHUTDOWN_SYSCALL > +# undef __ASSUME_GETSOCKNAME_SYSCALL OK. > #endif > > /* s390 only supports ipc syscall before 5.1. */ > diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h > index 0ab656d58e..7a15569dfc 100644 > --- a/sysdeps/unix/sysv/linux/sh/kernel-features.h > +++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h > @@ -24,7 +24,6 @@ > > /* These syscalls were added for SH in 2.6.37. */ > #define __ASSUME_CONNECT_SYSCALL 1 > -#define __ASSUME_GETSOCKNAME_SYSCALL 1 OK. Not needed. > #define __ASSUME_GETPEERNAME_SYSCALL 1 > #define __ASSUME_SEND_SYSCALL 1 > #define __ASSUME_RECV_SYSCALL 1 > diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h > index 12e98a9f95..8ada43587b 100644 > --- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h > +++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h > @@ -42,6 +42,12 @@ > # undef __ASSUME_SETSOCKOPT_SYSCALL > #endif > > +/* There syscalls were added for 32-bit in compat syscall table only > + in 4.20 (but present for 64-bit in all supported kernel versions). */ > +#if !defined __arch64__ && __LINUX_KERNEL_VERSION < 0x041400 > +# undef __ASSUME_GETSOCKNAME_SYSCALL > +#endif OK. > + > /* These syscalls were added for both 32-bit and 64-bit in 4.4. */ > #if __LINUX_KERNEL_VERSION < 0x040400 > # undef __ASSUME_BIND_SYSCALL -- Cheers, Carlos.