From patchwork Mon Jul 5 18:30:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 44155 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 76824383D809 for ; Mon, 5 Jul 2021 18:31:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 76824383D809 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1625509900; bh=BLl4/W6VAyJ5bqm4j9oz9qtDPZjPpr4KxixYq1mPpTk=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=MVteg0yTcEH90qhb/o8aJq2gmm9knDSHXJ816OfbwwJJTX+dgzCPqAYQIeYjICMJz OzXDnqD22C/FG+Xm4zeOOiJjzRmowHW4GLPCj91+SCgwI2jcWFQv5XP6OG+7zBcpTt QaLSJm1sFIO9+AGd6s29u1eTS2GkmBhWiQpUSFjY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by sourceware.org (Postfix) with ESMTPS id 01B5938515E5 for ; Mon, 5 Jul 2021 18:30:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 01B5938515E5 Received: by mail-pl1-x632.google.com with SMTP id o4so7599197plg.1 for ; Mon, 05 Jul 2021 11:30:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BLl4/W6VAyJ5bqm4j9oz9qtDPZjPpr4KxixYq1mPpTk=; b=ShSo8GoLfgAtM5ICB+q8dciV7NrwQiuwQhDZO6LGY7Tz/EL54gDc+XX8rkArgic1s+ 1OVM3Lt7fo2GbiSWK0Jlzr8ymtuyaq0Ht/B8H8MPg3uKv/2UxdCNI17gtv7Vo3RrYy3w E3VM4LcvEJk21EVS07ykZ/Xf/3rd7yVKoDhZoS2WKluodAhmwd/zqUhGOUfJRZWiM4jT 0Sd/wZjz9DOIgzp0r8dJ87827ZmJghvQlK4yjMYRM96CYJodLW7XdJ53fkaf23w1ypfl xbFZ8yDqmAj7uTGIZ0z7d9xn6ZNzLqzB0f5ZDKoN3puRoVGQkEbyAmMUWVrkWtt1N930 4k8g== X-Gm-Message-State: AOAM533m7GyQ5rOb/uXbSvXHDW+xvthlF5jFwvLV7t0kqKEZJsVIkRSn 3qSngZYCui3PjnwFORizbG7AnojhnlSl2g== X-Google-Smtp-Source: ABdhPJy01znyhdsjk8pZCgud43VmfX8M1eYxuQ3nzPQ1kG2PaYoGDfS/cawbLYRNsp0R/53Rtq/GSw== X-Received: by 2002:a17:902:d2c1:b029:128:d851:77fc with SMTP id n1-20020a170902d2c1b0290128d85177fcmr13684513plc.23.1625509833822; Mon, 05 Jul 2021 11:30:33 -0700 (PDT) Received: from birita.. ([177.194.59.218]) by smtp.gmail.com with ESMTPSA id y13sm14311299pgp.16.2021.07.05.11.30.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 11:30:33 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 1/7] linux: Consolidate Linux getsockopt implementation Date: Mon, 5 Jul 2021 15:30:21 -0300 Message-Id: <20210705183027.3804093-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210705183027.3804093-1-adhemerval.zanella@linaro.org> References: <20210705183027.3804093-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org 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: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" This patch consolidates the getsockopt Linux syscall implementation on sysdeps/unix/sysv/linux/getsockopt.c. The changes are: 1. Remove it from auto-generation syscalls.list on all architectures. 2. Add __ASSUME_GETSOCKOPT_SYSCALL as default and undef if for specific kernel versions on some architectures. This also fix a potential issue where 32-bit time_t ABI should use the linux getsockopt which overrides the underlying SO_* constants used for socket timestamping for _TIME_BITS=64. Checked on x86_64-linux-gnu and i686-linux-gnu. --- sysdeps/unix/sysv/linux/alpha/syscalls.list | 1 - sysdeps/unix/sysv/linux/arm/syscalls.list | 1 - sysdeps/unix/sysv/linux/generic/syscalls.list | 1 - sysdeps/unix/sysv/linux/hppa/syscalls.list | 1 - sysdeps/unix/sysv/linux/i386/kernel-features.h | 2 +- sysdeps/unix/sysv/linux/ia64/syscalls.list | 1 - 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/mips/syscalls.list | 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 | 2 +- sysdeps/unix/sysv/linux/x86_64/syscalls.list | 1 - 15 files changed, 5 insertions(+), 14 deletions(-) diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list index c848fcbd99..0a39d0871c 100644 --- a/sysdeps/unix/sysv/linux/alpha/syscalls.list +++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list @@ -8,7 +8,6 @@ getpriority - getpriority i:ii __getpriority getpriority bind - bind i:ipi __bind bind getpeername - getpeername i:ipp __getpeername getpeername getsockname - getsockname i:ipp __getsockname getsockname -getsockopt - getsockopt i:iiiBN __getsockopt getsockopt listen - listen i:ii __listen listen setsockopt - setsockopt i:iiibn __setsockopt setsockopt shutdown - shutdown i:ii __shutdown shutdown diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list index 13441f7eb4..b530057cd8 100644 --- a/sysdeps/unix/sysv/linux/arm/syscalls.list +++ b/sysdeps/unix/sysv/linux/arm/syscalls.list @@ -25,7 +25,6 @@ personality EXTRA personality Ei:i __personality personality bind - bind i:ipi __bind bind getpeername - getpeername i:ipp __getpeername getpeername getsockname - getsockname i:ipp __getsockname getsockname -getsockopt - getsockopt i:iiiBN __getsockopt getsockopt listen - listen i:ii __listen listen setsockopt - setsockopt i:iiibn __setsockopt setsockopt shutdown - shutdown i:ii __shutdown shutdown diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list index ed8b216d47..7397797571 100644 --- a/sysdeps/unix/sysv/linux/generic/syscalls.list +++ b/sysdeps/unix/sysv/linux/generic/syscalls.list @@ -8,5 +8,4 @@ listen - listen i:ii __listen listen getsockname - getsockname i:ipp __getsockname getsockname getpeername - getpeername i:ipp __getpeername getpeername setsockopt - setsockopt i:iiibn __setsockopt setsockopt -getsockopt - getsockopt i:iiiBN __getsockopt getsockopt shutdown - shutdown i:ii __shutdown shutdown diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list index cd37573b89..2451cc90f1 100644 --- a/sysdeps/unix/sysv/linux/hppa/syscalls.list +++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list @@ -4,7 +4,6 @@ bind - bind i:ipi __bind bind getpeername - getpeername i:ipp __getpeername getpeername getsockname - getsockname i:ipp __getsockname getsockname -getsockopt - getsockopt i:iiiBN __getsockopt getsockopt listen - listen i:ii __listen listen setsockopt - setsockopt i:iiibn __setsockopt setsockopt shutdown - shutdown i:ii __shutdown shutdown diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h index 923fa0b997..a6eca4092d 100644 --- a/sysdeps/unix/sysv/linux/i386/kernel-features.h +++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h @@ -23,7 +23,6 @@ # define __ASSUME_SOCKETPAIR_SYSCALL 1 # define __ASSUME_BIND_SYSCALL 1 # define __ASSUME_LISTEN_SYSCALL 1 -# define __ASSUME_GETSOCKOPT_SYSCALL 1 # define __ASSUME_SETSOCKOPT_SYSCALL 1 # define __ASSUME_GETSOCKNAME_SYSCALL 1 # define __ASSUME_GETPEERNAME_SYSCALL 1 @@ -41,6 +40,7 @@ # undef __ASSUME_CONNECT_SYSCALL # undef __ASSUME_RECVFROM_SYSCALL # undef __ASSUME_SENDTO_SYSCALL +# undef __ASSUME_GETSOCKOPT_SYSCALL #endif /* i686 only supports ipc syscall before 5.1. */ diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list index bd39441d3c..c0e9ea207c 100644 --- a/sysdeps/unix/sysv/linux/ia64/syscalls.list +++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list @@ -6,7 +6,6 @@ getpriority - getpriority i:ii __getpriority getpriority bind - bind i:ipi __bind bind getpeername - getpeername i:ipp __getpeername getpeername getsockname - getsockname i:ipp __getsockname getsockname -getsockopt - getsockopt i:iiiBN __getsockopt getsockopt listen - listen i:ii __listen listen setsockopt - setsockopt i:iiibn __setsockopt setsockopt shutdown - shutdown i:ii __shutdown shutdown diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h index 1680b10ca1..913c3fc222 100644 --- a/sysdeps/unix/sysv/linux/kernel-features.h +++ b/sysdeps/unix/sysv/linux/kernel-features.h @@ -77,6 +77,7 @@ #define __ASSUME_ACCEPT4_SYSCALL 1 #define __ASSUME_RECVMMSG_SYSCALL 1 #define __ASSUME_SENDMMSG_SYSCALL 1 +#define __ASSUME_GETSOCKOPT_SYSCALL 1 /* 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 46bb9d8b26..e1fa35c784 100644 --- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h +++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h @@ -23,7 +23,6 @@ # define __ASSUME_SOCKETPAIR_SYSCALL 1 # define __ASSUME_BIND_SYSCALL 1 # define __ASSUME_LISTEN_SYSCALL 1 -# define __ASSUME_GETSOCKOPT_SYSCALL 1 # define __ASSUME_SETSOCKOPT_SYSCALL 1 # define __ASSUME_GETSOCKNAME_SYSCALL 1 # define __ASSUME_GETPEERNAME_SYSCALL 1 @@ -43,6 +42,7 @@ # undef __ASSUME_CONNECT_SYSCALL # undef __ASSUME_RECVFROM_SYSCALL # undef __ASSUME_SENDTO_SYSCALL +# undef __ASSUME_GETSOCKOPT_SYSCALL #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 69d8ccaa23..a09a9ea09d 100644 --- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h +++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h @@ -28,7 +28,6 @@ #define __ASSUME_SEND_SYSCALL 1 #define __ASSUME_RECV_SYSCALL 1 #define __ASSUME_SHUTDOWN_SYSCALL 1 -#define __ASSUME_GETSOCKOPT_SYSCALL 1 #define __ASSUME_SETSOCKOPT_SYSCALL 1 #include_next diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list index f3621cdd51..07e07dec03 100644 --- a/sysdeps/unix/sysv/linux/mips/syscalls.list +++ b/sysdeps/unix/sysv/linux/mips/syscalls.list @@ -15,7 +15,6 @@ sysmips - sysmips i:iiii __sysmips sysmips bind - bind i:ipi __bind bind getpeername - getpeername i:ipp __getpeername getpeername getsockname - getsockname i:ipp __getsockname getsockname -getsockopt - getsockopt i:iiiBN __getsockopt getsockopt listen - listen i:ii __listen listen setsockopt - setsockopt i:iiibn __setsockopt setsockopt shutdown - shutdown i:ii __shutdown shutdown diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h index c2056959a5..769ef1386d 100644 --- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h +++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h @@ -28,7 +28,6 @@ #define __ASSUME_SEND_SYSCALL 1 #define __ASSUME_RECV_SYSCALL 1 #define __ASSUME_SHUTDOWN_SYSCALL 1 -#define __ASSUME_GETSOCKOPT_SYSCALL 1 #define __ASSUME_SETSOCKOPT_SYSCALL 1 /* Define this if your 32-bit syscall API requires 64-bit register diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h index 724f207e9f..0221a0e0bc 100644 --- a/sysdeps/unix/sysv/linux/s390/kernel-features.h +++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h @@ -23,7 +23,6 @@ # define __ASSUME_SOCKETPAIR_SYSCALL 1 # define __ASSUME_BIND_SYSCALL 1 # define __ASSUME_LISTEN_SYSCALL 1 -# define __ASSUME_GETSOCKOPT_SYSCALL 1 # define __ASSUME_SETSOCKOPT_SYSCALL 1 # define __ASSUME_GETSOCKNAME_SYSCALL 1 # define __ASSUME_GETPEERNAME_SYSCALL 1 @@ -43,6 +42,7 @@ # undef __ASSUME_CONNECT_SYSCALL # undef __ASSUME_RECVFROM_SYSCALL # undef __ASSUME_SENDTO_SYSCALL +# undef __ASSUME_GETSOCKOPT_SYSCALL #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 334e69b0c7..3b0c385260 100644 --- a/sysdeps/unix/sysv/linux/sh/kernel-features.h +++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h @@ -33,7 +33,6 @@ #define __ASSUME_SEND_SYSCALL 1 #define __ASSUME_RECV_SYSCALL 1 #define __ASSUME_SHUTDOWN_SYSCALL 1 -#define __ASSUME_GETSOCKOPT_SYSCALL 1 #define __ASSUME_SETSOCKOPT_SYSCALL 1 #include_next diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h index 7ffafc9fd0..0b105eb849 100644 --- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h +++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h @@ -38,10 +38,10 @@ # undef __ASSUME_CONNECT_SYSCALL # undef __ASSUME_RECVFROM_SYSCALL # undef __ASSUME_SENDTO_SYSCALL +# undef __ASSUME_GETSOCKOPT_SYSCALL #else # define __ASSUME_SOCKET_SYSCALL 1 # define __ASSUME_SOCKETPAIR_SYSCALL 1 -# define __ASSUME_GETSOCKOPT_SYSCALL 1 # define __ASSUME_SHUTDOWN_SYSCALL 1 #endif diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list index d46524eff3..fceb6d2415 100644 --- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list +++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list @@ -9,7 +9,6 @@ syscall_clock_gettime EXTRA clock_gettime Ei:ip __syscall_clock_gettime bind - bind i:ipi __bind bind getpeername - getpeername i:ipp __getpeername getpeername getsockname - getsockname i:ipp __getsockname getsockname -getsockopt - getsockopt i:iiiBN __getsockopt getsockopt listen - listen i:ii __listen listen setsockopt - setsockopt i:iiibn __setsockopt setsockopt shutdown - shutdown i:ii __shutdown shutdown