From patchwork Wed Jul 3 00:52:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 11028789 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 69F1717E0 for ; Wed, 3 Jul 2019 00:55:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 641512896F for ; Wed, 3 Jul 2019 00:55:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57C8C2897A; Wed, 3 Jul 2019 00:55:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F3C952896F for ; Wed, 3 Jul 2019 00:54:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NE8Y1RzxBvpZZkahMmW2AKwGZc/3j2BYXZC679v9V6s=; b=pGRkB7G7f+kyZf VX1FqllgJ30SjKVD8BKwmAQmx38t+nB9gVWkQ4wBLoQ9cWOcz+20Eegs+iBwxDJ4m3cXmrE9Z14GI Y43+9zqaQMDp6NRirnAN6/BoKHT8AeZfHD0ChHc39K2ou1NjCjaaH6XKwc/EaHRPOJ0mnCDZ/rRCu GFVw6HXKOTRwva38TcOVEegb/vdAEH4NvGjf+sztdm2mgB8DBtb5G7crvlwPipIOd3cILgIzEp8SP i8+JUyXQ1Jy+hEYdPzAxNHb+xxr/06JHM+9ZGJRNt7r9ec0FlZKINA3AdXzv2vTpOJuTpIhpKlZ4B t0yYiksmPFaZQ2iz5GSQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hiTXy-0001wQ-4u; Wed, 03 Jul 2019 00:54:54 +0000 Received: from esa3.hgst.iphmx.com ([216.71.153.141]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hiTXu-0001tJ-Im for linux-riscv@lists.infradead.org; Wed, 03 Jul 2019 00:54:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1562115291; x=1593651291; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eC3388U7gS1n3ruZjbzbm4lmFXg2heaDobqQD9WiAWA=; b=VJzPVWEDxn0rs2pd9NqlzJdfZ+1CZlj5hZTteRj0FvR8LDsdDa3G9dow pKLTL9pK2L+LX5rqCgB4xUJGWlzleyQb7Jsce5vF20jLao5mPoYNJvUlo NcV4GsJ3QU1+s/bk1pkZrMePADGLvqFMNHpOpvbUzrCDjZVHnI4pXDC5Y +s9sLt/OPfS5HRw7moOvx/psZ1PWxCrBfg8OKc5p43LA+dHLUGzq1nBYu SOwATCEAEP3xRWOSVAm5ovMVBHEHUXYRjTgedLNIwPQgab+UM16vxhPXi cAXxe07lFkF3sM3donHjJyc2e3HZDUpOQLW9cvvjogbS2RpxJrDPXmt9Z Q==; IronPort-SDR: Qt8AD4SbO8vZQaBJXgsqe/qetwUYfl8hjvt+Te6sB5B2HPyxqFTLmBCX2pwtTvG4pwWYinN2ob 1dpFKTVoc/iBbfYFtnFLtfIYADYXNmy4SqT944EEVp/FzD+FkGECdK754stKPtLWa4tMnoSyRe yJNQppZXvqlJNz0GN2dr8hytQnd0NVe+V9KeWIsH6hg1olN6CrcmZTS2TWzrpidnrDXdQXOZ0H BMr43moET/CRKUcVkncghYJtq93zukULhTvlORZtOcHqZNsr/Wml/GRaG/2A8tsWMpTHiljOZg G4M= X-IronPort-AV: E=Sophos;i="5.63,445,1557158400"; d="scan'208";a="116940451" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 03 Jul 2019 08:54:41 +0800 IronPort-SDR: Nslcd0P1/s0h53PbLHAID5jBM5KKcWFUivcZp3FzwJyqk6u4lSdEiPraORW7ytP2u6WEvk/qSw 96+EsaDk4qBypS7xLPScsLOarW9SFkXDZYB78eSUfde0E4UoJejAgemD8jNkM9W70L0F7dRTkL B/EGuem9atYd0abKQpmgLHgY5f/B6HCblg5SAHidRApLHeHwK/nybgJs7btsqq8IM/yfAwIR+P eaRuz2njNTr1eVCDwCtIVoLjYHaoXzfdU3tPp68JHHT+Sy0hugCGBMz1tKLHQtzXNtdBYdvppj sqI3rGFBr+cRsf71GNC6pcmp Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 02 Jul 2019 17:53:41 -0700 IronPort-SDR: Dz0M+IAo+4wEj1xOA9OuK1TY7/bzSPMnj56ySQqqLHxHvhJqyk+qM7mAVnJVSzpTgtWXeJGXeT VR7FIVmdIBGVqnmB3xCVDmmWT+OjqX3n1v3Hd9XToK4l5EmqTrcu7eRpU7PQkGXRpqGEg0eCBV NwsGHI9DjzM+VRiXDScIaGRIIPUIqG5/OYkSby1iHa9my/PtofrTcTDnMAHzWfBXA2HLzqtPWT ReqvW0u8MFrhAYRboKlwLjqEB0pcnS80OdRU0TCPHKmKJktCldw8RVSryG1VikQdZBmsEH7sLg vxg= Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.140]) by uls-op-cesaip01.wdc.com with ESMTP; 02 Jul 2019 17:54:41 -0700 From: Alistair Francis To: linux-riscv@lists.infradead.org, arnd@arndb.de Subject: [PATCH RESEND 1/2] uapi/asm-generic: Allow defining a custom __SIGINFO struct Date: Tue, 2 Jul 2019 17:52:01 -0700 Message-Id: <20190703005202.7578-2-alistair.francis@wdc.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190703005202.7578-1-alistair.francis@wdc.com> References: <20190703005202.7578-1-alistair.francis@wdc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190702_175450_738686_0204B7DF X-CRM114-Status: UNSURE ( 8.75 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair23@gmail.com, Alistair Francis , linux-kernel@vger.kernel.org Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Allow defining a custom __SIGINFO struct. This allows architectures to apply their own padding and allignment requirements to the struct. This is similar to the __ARCH_SI_ATTRIBUTES #define that already exists, but applies to the __SIGINFO struct instead of the siginfo_t struct. Signed-off-by: Alistair Francis --- include/uapi/asm-generic/siginfo.h | 32 ++++++++++++++++-------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/include/uapi/asm-generic/siginfo.h b/include/uapi/asm-generic/siginfo.h index cb3d6c267181..09b0a1abac14 100644 --- a/include/uapi/asm-generic/siginfo.h +++ b/include/uapi/asm-generic/siginfo.h @@ -108,23 +108,25 @@ union __sifields { } _sigsys; }; -#ifndef __ARCH_HAS_SWAPPED_SIGINFO -#define __SIGINFO \ -struct { \ - int si_signo; \ - int si_errno; \ - int si_code; \ - union __sifields _sifields; \ +#ifndef __SIGINFO +# ifndef __ARCH_HAS_SWAPPED_SIGINFO +# define __SIGINFO \ +struct { \ + int si_signo; \ + int si_errno; \ + int si_code; \ + union __sifields _sifields __ARCH_SI_ATTRIBUTES; \ } -#else -#define __SIGINFO \ -struct { \ - int si_signo; \ - int si_code; \ - int si_errno; \ - union __sifields _sifields; \ +# else +# define __SIGINFO \ +struct { \ + int si_signo; \ + int si_code; \ + int si_errno; \ + union __sifields _sifields __ARCH_SI_ATTRIBUTES; \ } -#endif /* __ARCH_HAS_SWAPPED_SIGINFO */ +# endif /* __ARCH_HAS_SWAPPED_SIGINFO */ +#endif /* __SIGINFO */ typedef struct siginfo { union { From patchwork Wed Jul 3 00:52:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 11028787 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E3F761580 for ; Wed, 3 Jul 2019 00:54:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF8C62897A for ; Wed, 3 Jul 2019 00:54:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D41632897B; Wed, 3 Jul 2019 00:54:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 835DA28970 for ; Wed, 3 Jul 2019 00:54:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZnaglEuxXXVO9GbIUnT384b9GoMIowpRCe7plJUc8X8=; b=divigcZTFmX2Y3 QO8IKAtZoppW9k6kPLOoA10KNOJs5s2zLhqF2IIQ7OvalDqvK7mbAURKWHS7qeQ2Z6a3FizHgIyur mTjdLqhqPYeDDvomtnd0NvTzPCbpoih6vehBDq3lwJ3oUB9tNLNPh1qsyWiHXIu2jMJLNKOK7WtmE BkokWtPtOO9EmlX3yHxRi2E/E/Kv5ulfLBRYBo0zN8nJarvXlgxGIElNjISAs0irSeC5dU9vkA292 5Oq8RBKsHKw19IpRg9DCZeXgNF6TG9eIrbyHdViSVL9Z2rBYA0a+fMXI7Mkf92ab8QII5vcuOWEJX 2C3hqOObCfVHkCrOgrLA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hiTY0-0001yS-8d; Wed, 03 Jul 2019 00:54:56 +0000 Received: from esa3.hgst.iphmx.com ([216.71.153.141]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hiTXv-0001ug-0E for linux-riscv@lists.infradead.org; Wed, 03 Jul 2019 00:54:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1562115292; x=1593651292; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Wy7yC5O2tmsY73xSrxj13jbMBblMeVDokHmeqGBlXTw=; b=pUM/4nLfmIikRXUJoIs6Mg2Ipn9jQC5RtfpWwa1MAFBKOw93sSr1pvRL RofH47mO45DL262EUtnoywyBIYRIBpLhPNtdLGOOfTB8okC9Xwesuj92n ypRqoahwUtzBW24igFDanVQuyKZtBIQT/YwYOTlmfNRuYy718BXjoDx5k fAlMz7Bmv25Z7E4DD/M8XJfz7a9TgdoE73sZ+pnP0gAL9U6n2r0LFABIk c/ikzvRYYr20VOdQhxd4DBwMTI2uQDN5xcAdt9UnwEk4zvqF93gg2GQEr ohqZSrGGWg69dqd4b/NtDHDvivBe/pDTD4fhw+oUy+CeXl3ymrMWkvuo1 A==; IronPort-SDR: ThdFQ7xVMZjppmpvrm/OsG06AQabMEAMQTY65xWtHvjmV5iofEIIGWjkgDR87FWHMTRyOQYJm4 YJ4yQSNFcQC7zH1bv1OhsEgGNG8zMJvjSou758HyxU5x0BmNHihXdEsf8uHW3cvxJSd5tg6clI KYCJeA3ed0HG41sdvCD8OG7MMv7dI8deE6UnCYs8T7mTQZ76uLQCl+LvrrczFpLQIXlwFNKuYi VkplrM/fMJR0hIXVvRtL7vs5YdxSlDsoHSWLIvoXk0IbCWuqF/RqwXHpqhEeWuCQD/OOfixkHd aOQ= X-IronPort-AV: E=Sophos;i="5.63,445,1557158400"; d="scan'208";a="116940452" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 03 Jul 2019 08:54:41 +0800 IronPort-SDR: pjjr5qUaKQfe7aXFtGOLGMhH6hNcDaSyBHTps5BhdrVEXhL32SSl+DtJP3zevtNNsIYjwYTmJK yDUxzKQkYeWwqY10h3EgG07eAiKBTt0fuaI44kUP3ntQpp1C5IrshG5cj3K3vlnuVfhSo7vOx1 km1Nt/hImeImLh4iOBRz6a16iHGRbuYlrGER8RaDAHLAqwzLKdYbeZnFxkg5fPDdq77NM3ZC5/ GGWal4Kc2CilqPVi24x4cYYQgWRtSE8cckAjbdyAQmtVFwkRpPAt7LRXN/glVoQxRMAPSzPhPJ Jbwlr4EFov/2Fb3YiAvtCO44 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 02 Jul 2019 17:53:42 -0700 IronPort-SDR: Vas0ZmY2WTLD4D32wsiC0idNWk2cEvWjiEvuKcoTH7iaPOOiiIfGMUfQGFBsTdaEhdnmTm6L9M XbHVpKx2ryuFhZ6ghamcNSTUIizdK/F4l4gDpsY8JI79LPmpikqxk9qq/7SmADCrfP4KjCIfuJ OTK60S9lo+MUCN++J+E+OgrPCawor07uRnS+OwkPCSb9c1Vxt9gVwOFMyiqCnZx5Z2gE4JDR7H dJSz3XOjIAaAMjEGAsPD1cO5dSzzHIcQp8zoMMJAHnGpddrxWh/IkSvrQwS92uc6wkCxq26qjK 9M4= Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.140]) by uls-op-cesaip01.wdc.com with ESMTP; 02 Jul 2019 17:54:41 -0700 From: Alistair Francis To: linux-riscv@lists.infradead.org, arnd@arndb.de Subject: [PATCH RESEND 2/2] riscv/include/uapi: Define a custom __SIGINFO struct for RV32 Date: Tue, 2 Jul 2019 17:52:02 -0700 Message-Id: <20190703005202.7578-3-alistair.francis@wdc.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190703005202.7578-1-alistair.francis@wdc.com> References: <20190703005202.7578-1-alistair.francis@wdc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190702_175451_163667_F0810B3D X-CRM114-Status: GOOD ( 10.64 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair23@gmail.com, Alistair Francis , linux-kernel@vger.kernel.org Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The glibc implementation of siginfo_t results in an allignment of 8 bytes for the union _sifields on RV32. The kernel has an allignment of 4 bytes for the _sifields union. This results in information being lost when glibc parses the siginfo_t struct. To fix the issue add a pad variable to the struct to avoid allignment mismatches. Signed-off-by: Alistair Francis --- arch/riscv/include/uapi/asm/siginfo.h | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 arch/riscv/include/uapi/asm/siginfo.h diff --git a/arch/riscv/include/uapi/asm/siginfo.h b/arch/riscv/include/uapi/asm/siginfo.h new file mode 100644 index 000000000000..0854ad97bf44 --- /dev/null +++ b/arch/riscv/include/uapi/asm/siginfo.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _ASM_RISCV_SIGINFO_H +#define _ASM_RISCV_SIGINFO_H + +/* Add a pad element for RISC-V 32-bit. We need this as the + * _sifields union is 8 byte allgined in usperace. + */ +#if __riscv_xlen == 32 +#ifndef __ARCH_HAS_SWAPPED_SIGINFO +#define __SIGINFO \ +struct { \ + int si_signo; \ + int si_errno; \ + int si_code; \ + int pad; \ + union __sifields _sifields; \ +} +#else +#define __SIGINFO \ +struct { \ + int si_signo; \ + int si_code; \ + int si_errno; \ + int pad; \ + union __sifields _sifields; \ +} +#endif /* __ARCH_HAS_SWAPPED_SIGINFO */ +#endif + +#include + +#endif /* _ASM_RISCV_SIGINFO_H */