From patchwork Mon Jun 13 01:30:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Guo Ren X-Patchwork-Id: 12878910 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2058EC43334 for ; Mon, 13 Jun 2022 01:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=1bCP8wED5jEcOWvgff32qMxgJ+WXkPGjj9A8ZezyK/0=; b=CHbqvGppZqAqFa eTaJs+nTafnT/0CdO9e2q6XcYApAPRIqlihlpG/5dntMLGRagRszbuJsUbGep5oZEqVbGNu2AfVQf b9vP3MTEfRlVsO5YCKkxX90mLBdHeqv81qbSMbLP6Byxe79ubAUw7Q1HfU/OVQbpn+8FLXVcUSXmO JnWOn+IMLbKfpjdnX7z/HKYz58hHRpKQYbo+cdJ4sZwdobPLZFJHfymXWyXXTTv+VmdmrE7oQdge8 zcTJ9tNQAAI23PwlmxCgAxLfC0dUvHCabRnPsmrz5nG/hP7dU2S2ep+xv++Bon/bulH7vi5yK8bKx R263GcYs2uOnDK7ONw+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o0YvH-000kjr-KO; Mon, 13 Jun 2022 01:31:19 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o0YvE-000kjE-Vn for linux-riscv@lists.infradead.org; Mon, 13 Jun 2022 01:31:18 +0000 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 dfw.source.kernel.org (Postfix) with ESMTPS id BBAE2611E2; Mon, 13 Jun 2022 01:31:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E3C4C34115; Mon, 13 Jun 2022 01:31:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655083873; bh=RVAyZuqlwM/hDCOHKUQEWUEw9mlKJE2gEK5yaIsZ4to=; h=From:To:Cc:Subject:Date:From; b=oHdlufOHxW6XFaMV+oOWi8IucAsP/2KBIE4/fnDJ4fRoVSM6PUMW/Xkdu8sUZUhMo I7gYwme3y+XPuoSGxp65UkpNt1yuR7v/mdBPVWBy5TZiqyFcutWKvSS/l/T5vyRVdB 48FYnZvyfimqbWKMgQwckbae+NwbP3rxIkcDBX0ArXbtyCBUeymYa+YgXKkxD5e0dw 2MDJiDLn9TkZgh5zvFRbGs61JqmQ5zcyF49vYljd0xrvgihhn8DRYgDyN9V4uFfV21 /OLc3yGJvY2vmE/DNFUFW9k1Gza7wrPkg6dIoI9qfHThWZ/X0rTWeaObP+Xi17zAy2 79FEsvSEiYQeg== From: guoren@kernel.org To: palmer@rivosinc.com, arnd@arndb.de, linux@roeck-us.net, palmer@dabbelt.com, heiko@sntech.de Cc: linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Guo Ren , Eugene Syromiatnikov , Christoph Hellwig Subject: [PATCH] uapi: Fixup strace compile error Date: Sun, 12 Jun 2022 21:30:51 -0400 Message-Id: <20220613013051.1741434-1-guoren@kernel.org> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220612_183117_148271_6D026D69 X-CRM114-Status: GOOD ( 13.94 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: Guo Ren There is no CONFIG_64BIT in userspace, we shouldn't limit it with __BITS_PER_LONG == 32 to break the compatibility. Just export F_*64 definitions to userspace permanently. gcc-11 -DHAVE_CONFIG_H -I./linux/x86_64 -I../../../src/linux/x86_64 -I./linux/generic -I../../../src/linux/generic -I. -I../../../src -DIN_STRACE=1 -isystem /opt/kernel/include -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wdate-time -Wformat-security -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wtrampolines -Wundef -Wwrite-strings -Werror -g -O2 -c -o libstrace_a-fetch_bpf_fprog.o `test -f 'fetch_bpf_fprog.c' || echo '../../../src/'`fetch_bpf_fprog.c In file included from ../../../src/defs.h:404, from ../../../src/fcntl.c:12: ../../../src/xlat/fcntlcmds.h:54:7: error: ‘F_GETLK64’ undeclared here (not in a function); did you mean ‘F_GETLK’? 54 | XLAT(F_GETLK64), | ^~~~~~~~~ ../../../src/xlat.h:64:54: note: in definition of macro ‘XLAT’ 64 | # define XLAT(val) { (unsigned)(val), #val } | ^~~ ../../../src/xlat/fcntlcmds.h:57:7: error: ‘F_SETLK64’ undeclared here (not in a function); did you mean ‘F_SETLK’? 57 | XLAT(F_SETLK64), | ^~~~~~~~~ ../../../src/xlat.h:64:54: note: in definition of macro ‘XLAT’ 64 | # define XLAT(val) { (unsigned)(val), #val } | ^~~ ../../../src/xlat/fcntlcmds.h:60:7: error: ‘F_SETLKW64’ undeclared here (not in a function); did you mean ‘F_SETLKW’? 60 | XLAT(F_SETLKW64), | ^~~~~~~~~~ ../../../src/xlat.h:64:54: note: in definition of macro ‘XLAT’ 64 | # define XLAT(val) { (unsigned)(val), #val } | ^~~ make[4]: *** [Makefile:5017: libstrace_a-fcntl.o] Error 1 comment by Eugene: Actually, it's quite the opposite: "ifndef" usage made it vailable at all times to the userspace, and this change has actually broken building strace with the latest kernel headers[1][2]. There could be some debate whether having these F_*64 definitions exposed to the user space 64-bit applications, but it seems that were no harm (as they were exposed already for quite some time), and they are useful at least for strace for compat application tracing purposes. Fixes: 306f7cc1e9061 "uapi: always define F_GETLK64/F_SETLK64/F_SETLKW64 in fcntl.h" Signed-off-by: Guo Ren Reported-by: Eugene Syromiatnikov Cc: Christoph Hellwig Cc: Arnd Bergmann Cc: Heiko Stuebner Cc: Palmer Dabbelt Acked-by: Palmer Dabbelt --- include/uapi/asm-generic/fcntl.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/uapi/asm-generic/fcntl.h b/include/uapi/asm-generic/fcntl.h index f13d37b60775..cd6bd65ec25d 100644 --- a/include/uapi/asm-generic/fcntl.h +++ b/include/uapi/asm-generic/fcntl.h @@ -116,13 +116,11 @@ #define F_GETSIG 11 /* for sockets. */ #endif -#if __BITS_PER_LONG == 32 || defined(__KERNEL__) #ifndef F_GETLK64 #define F_GETLK64 12 /* using 'struct flock64' */ #define F_SETLK64 13 #define F_SETLKW64 14 #endif -#endif /* __BITS_PER_LONG == 32 || defined(__KERNEL__) */ #ifndef F_SETOWN_EX #define F_SETOWN_EX 15