From patchwork Fri Jul 31 12:22:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11694863 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ACA5A13B6 for ; Fri, 31 Jul 2020 12:23:52 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 863852087C for ; Fri, 31 Jul 2020 12:23:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="eMgJqMTZ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="V3I6U4u4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 863852087C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.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=kzhLXWqIKRvA3BVDBlVrqES2AOzrcxCW0pK1k557Q/0=; b=eMgJqMTZoToraOKdPEtcAmuJn hoAx8tfsVIju13SHIAjM3b5lkgbPlSVtFQPXYPt/DshSBt/cWxePWE4jtq6/jCpzt/RrJw9PfIZ0j 1zAzi/Ow5ZExXOJRkpzTd3DvdEo2chVGUvc2ZJOPZ8xn9QjymqN8ONn8ieDCoMyQNhHEcdS7rs/+v dMkvKughPLjdurfn0094o1XpQPBkNK6po6JKoDoHuJFAzTo21aDPgePi1tv+dLSu26M8jAERZ/o31 B7LCSffp5aK+YXjhVYAYIfhJUcxiaQXNYPlXbKRgpPcTW8b1b3ie5JcPjJQChdzKPXLDsbYq0sYbW 5VAr9HYzA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k1U3H-0003tx-Rc; Fri, 31 Jul 2020 12:22:19 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k1U38-0003r6-D3 for linux-arm-kernel@merlin.infradead.org; Fri, 31 Jul 2020 12:22:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=XJVkNSbm3rNjn+7yYFiPCzhlPnNgnxohOidDxm683oU=; b=V3I6U4u4zECJMCSr8grbvFcJW0 aINEZxdcBI9e7BwM0h4uMMjXa+LOmh/up37cfjbD7lt7ha3RNhBay4PTAXSZqF/WqwnIIYuVr2L0l lOftc3sWjQ6xHTJkcF/BeJt6wZ+wA/CvquyoxxaTj5orCMU7NMeeHDWTuHQno0nTfy2jM9RaXrqHN PirBX1OuYkgji2N3NuMSPBK8w7MUuRSgZeuf5rnI+tYB1gmKIIlXTlimivbRY2Em67o1sOwbHumtw Shr3vd9WOEG4+5byb2wNJwqPzImknwD0aY8ZhRpmGXWt7g9Nt0oyE48qn2443p41PSH0+70Nn8THf b7gYCGlQ==; Received: from 138.57.168.109.cust.ip.kpnqwest.it ([109.168.57.138] helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1k1U37-000269-7W; Fri, 31 Jul 2020 12:22:09 +0000 From: Christoph Hellwig To: x86@kernel.org, Jan Kara Subject: [PATCH 2/3] compat: add a compat_need_64bit_alignment_fixup() helper Date: Fri, 31 Jul 2020 14:22:01 +0200 Message-Id: <20200731122202.213333-3-hch@lst.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200731122202.213333-1-hch@lst.de> References: <20200731122202.213333-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Add a helper to check if the calling syscall needs a fixup for non-natural 64-bit type alignment in the compat ABI. This will only return true for i386 syscalls on x86_64. Signed-off-by: Christoph Hellwig --- arch/x86/include/asm/compat.h | 1 + include/linux/compat.h | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/arch/x86/include/asm/compat.h b/arch/x86/include/asm/compat.h index bf547701f41f87..0e327a01f50fbb 100644 --- a/arch/x86/include/asm/compat.h +++ b/arch/x86/include/asm/compat.h @@ -209,6 +209,7 @@ static inline bool in_compat_syscall(void) return in_32bit_syscall(); } #define in_compat_syscall in_compat_syscall /* override the generic impl */ +#define compat_need_64bit_alignment_fixup in_ia32_syscall #endif struct compat_siginfo; diff --git a/include/linux/compat.h b/include/linux/compat.h index e90100c0de72e4..a195f90f156cf6 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -937,6 +937,15 @@ static inline bool in_compat_syscall(void) { return false; } #endif /* CONFIG_COMPAT */ +/* + * Some legacy ABIs like the i386 one use less than natural alignment for 64-bit + * types, and will need special compat treatment for that. Most architectures + * don't need that special handling even for compat syscalls. + */ +#ifndef compat_need_64bit_alignment_fixup +#define compat_need_64bit_alignment_fixup() false +#endif + /* * A pointer passed in from user mode. This should not * be used for syscall parameters, just declare them