Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2349799ybg; Sat, 19 Oct 2019 13:20:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqy8gA5zRMdYcMJmdjESJg802uO8MmRC9nhiOt0ziPnH3v+zzLyYoXGFIDyqPK9Xh1b2aBuk X-Received: by 2002:a17:907:397:: with SMTP id ss23mr3879739ejb.177.1571516456251; Sat, 19 Oct 2019 13:20:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571516456; cv=none; d=google.com; s=arc-20160816; b=gQhNZj+64/jAb56K/mtVIDz+wkYLzFKcXit8MNgU5m73c2tM9JROw701fDgtoh9ccX edw50a3zU16AYaQ/KLv1haFvKP8sz3QhARqDuyNtq8FYnWNiRhPBN2ZzfkcURDjlUMQa oMU83ZyB1Vqva7zhI2mQlyYkmB3DmIuPdkuoXkNqufpdnR6iP0o2Gmtq2UYDMC729E7Y bNcbvsInmqcKZGryhBzW02nlOXLhc2hgFi7B68cBXF1yODPUhkaHYuXjkO00VBa3x5EE S420Eea/XF0wH6tjiUp6zR9k6rLB03SnW2LIFygD+u1Y8aTGPv0v1zGgGUeVexRRoLDa oDVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=wxv7zz6f9JrnnZ4WhJ/zncIhX21h/08jhPiGSOyQMVE=; b=Yozqnx5kwDMXsTdYjv8mQOS/8+F+pCbkU/ble4/eeSh0iXK9Ed1KNy6uMX6DpU9oR+ bknBoe2wSIoank/WmlmGPnX/I2JlqOenoglq5wZ3a/A9nPaIs2jQc9Wpyb7H+F9e8chj g4WMAFUcwrPvCB02DJ0HW9HAqyS8aVkJ9PcHBYEbD8bH/XAC/w8NlmqCSZJlX+XlMPoB JuHX2CGYoBH/X4gNYknWJjbmR+I6kFQvDMmja3vtPS51iqhrFeG8ItZVs3y6fQ0v8wGg UOST9uoejcVQhmOVhjw4pyuu6e3w38BmS4MNTiGDUUV9TxOSKA1BKmaz8vUumW9l/zjN aXZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hh12si2095078ejb.343.2019.10.19.13.20.20; Sat, 19 Oct 2019 13:20:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726215AbfJSURt (ORCPT + 99 others); Sat, 19 Oct 2019 16:17:49 -0400 Received: from mx2a.mailbox.org ([80.241.60.219]:49861 "EHLO mx2a.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726129AbfJSURt (ORCPT ); Sat, 19 Oct 2019 16:17:49 -0400 Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx2a.mailbox.org (Postfix) with ESMTPS id E5003A133B; Sat, 19 Oct 2019 22:17:45 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter02.heinlein-hosting.de (spamfilter02.heinlein-hosting.de [80.241.56.116]) (amavisd-new, port 10030) with ESMTP id tS8T5X5iyvkP; Sat, 19 Oct 2019 22:17:43 +0200 (CEST) From: Hauke Mehrtens To: catalin.marinas@arm.com, will@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, musl@lists.openwall.com, Hauke Mehrtens , stable@vger.kernel.org Subject: [PATCH] arm64: uapi: Fix user space compile with musl libc Date: Sat, 19 Oct 2019 22:17:17 +0200 Message-Id: <20191019201717.15358-1-hauke@hauke-m.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org musl libc also defines the structures in their arch/aarch64/bits/signal.h header file. Some applications like strace and gdb include both of them and then the structure definitions are clashing and the build of these user space applications fails. This patch allows a libc to define a constant which tells the kernel header file that the libc already defined these structures and that they should not be defined by the kernel uapi header files any more to prevent clashes. This is done in a similar way as it is already done for other header files. When this patch was accepted into the kernel I will also update musl libc to define these constants. Signed-off-by: Hauke Mehrtens Cc: stable@vger.kernel.org --- arch/arm64/include/uapi/asm/sigcontext.h | 13 +++++++++++++ include/uapi/linux/libc-compat.h | 20 ++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/arch/arm64/include/uapi/asm/sigcontext.h b/arch/arm64/include/uapi/asm/sigcontext.h index 8b0ebce92427..92d911146137 100644 --- a/arch/arm64/include/uapi/asm/sigcontext.h +++ b/arch/arm64/include/uapi/asm/sigcontext.h @@ -20,7 +20,9 @@ #ifndef __ASSEMBLY__ #include +#include +#if __UAPI_DEF_SIGCONTEXT /* * Signal context structure - contains all info to do with the state * before the signal handler was invoked. @@ -35,6 +37,7 @@ struct sigcontext { /* 4K reserved for FP/SIMD state and future expansion */ __u8 __reserved[4096] __attribute__((__aligned__(16))); }; +#endif /* * Allocation of __reserved[]: @@ -57,6 +60,7 @@ struct sigcontext { * generated when userspace does not opt in for any such extension. */ +#if __UAPI_DEF_AARCH64_CTX /* * Header to be used at the beginning of structures extending the user * context. Such structures must be placed after the rt_sigframe on the stack @@ -67,7 +71,9 @@ struct _aarch64_ctx { __u32 magic; __u32 size; }; +#endif +#if __UAPI_DEF_FPSIMD_CONTEXT #define FPSIMD_MAGIC 0x46508001 struct fpsimd_context { @@ -76,7 +82,9 @@ struct fpsimd_context { __u32 fpcr; __uint128_t vregs[32]; }; +#endif +#if __UAPI_DEF_ESR_CONTEXT /* * Note: similarly to all other integer fields, each V-register is stored in an * endianness-dependent format, with the byte at offset i from the start of the @@ -93,7 +101,9 @@ struct esr_context { struct _aarch64_ctx head; __u64 esr; }; +#endif +#if __UAPI_DEF_EXTRA_CONTEXT /* * extra_context: describes extra space in the signal frame for * additional structures that don't fit in sigcontext.__reserved[]. @@ -128,7 +138,9 @@ struct extra_context { __u32 size; /* size in bytes of the extra space */ __u32 __reserved[3]; }; +#endif +#if __UAPI_DEF_SVE_CONTEXT #define SVE_MAGIC 0x53564501 struct sve_context { @@ -136,6 +148,7 @@ struct sve_context { __u16 vl; __u16 __reserved[3]; }; +#endif #endif /* !__ASSEMBLY__ */ diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h index 8254c937c9f4..a863130f4638 100644 --- a/include/uapi/linux/libc-compat.h +++ b/include/uapi/linux/libc-compat.h @@ -264,4 +264,24 @@ #endif /* __GLIBC__ */ +/* Definitions for arch/arm64/include/uapi/asm/sigcontext.h */ +#ifndef __UAPI_DEF_SIGCONTEXT +#define __UAPI_DEF_SIGCONTEXT 1 +#endif +#ifndef __UAPI_DEF_AARCH64_CTX +#define __UAPI_DEF_AARCH64_CTX 1 +#endif +#ifndef __UAPI_DEF_FPSIMD_CONTEXT +#define __UAPI_DEF_FPSIMD_CONTEXT 1 +#endif +#ifndef __UAPI_DEF_ESR_CONTEXT +#define __UAPI_DEF_ESR_CONTEXT 1 +#endif +#ifndef __UAPI_DEF_EXTRA_CONTEXT +#define __UAPI_DEF_EXTRA_CONTEXT 1 +#endif +#ifndef __UAPI_DEF_SVE_CONTEXT +#define __UAPI_DEF_SVE_CONTEXT 1 +#endif + #endif /* _UAPI_LIBC_COMPAT_H */ -- 2.20.1