Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp429207ybg; Sun, 26 Jul 2020 09:04:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwBB7l+rwTYdBX7dVgCGuZHS5VEEtREyS5XfNlVcIplSnFRfbOLEMt7Bsi6LmbtZ6eimy0 X-Received: by 2002:a17:906:1e0c:: with SMTP id g12mr7756201ejj.103.1595779482223; Sun, 26 Jul 2020 09:04:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595779482; cv=none; d=google.com; s=arc-20160816; b=HvNlSvTcsD9NdmpITN6TDrqTzOM0IyigWq3GI6svpEkVcL7ZuLQB3A3v5p16d+VOQX DBEjen6E+dgZfhq6u3aK22hCisjPzZMx4EZiklL+mLfTyi+ycXQXN1SHrfky5cr0RgHG NH7ZlvGMyCJ9ehEMss/NERl/AUNsg1GOPXos656EuSB5bfFUuCKSZCnT2sYdav5fvuju NBCFDB7ycoF7pwM4fnEscgyNOJl0o4LeLy7TyJ6/KYYa+WGmikOjOySXmeY8MsVz1NVU RByfoECARc55I4LCA35d/4k6HNm71iNaUp7IWuEfBaBL3/bCI2D1Gk176V6lljI6/wxq gwrw== 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:dkim-signature; bh=UyAQuKzOjtI/x1r3Rxgb+Q9XWacAff5rq+0vrGSNTvw=; b=spqBjUOSlNK/VWHZIQ1KTaCaZPjqCOiwjWkE1AS9ImXBtFGayaqPAbi8J89VW5ZDhP IZ6e04b+uxdhHvI+9vKoSgon/keZ45Ida4dvLkkjH98RbW53GwzWpfcnGNQzOFgWNBhq 5EgS/7TqS5f4m3fAowxsG89Tpj2SSwzUJf91X15tuhSR2OzeOSTrVyyFb4Hw8rzLebM/ 2Gle+BdEoXqloGI3dyT5lyS+AUg+VwLtPBTGU7f3Am1QOCGxhadzGih923SzFoqVwZlo jyNipNeV9XHAdOuC3T00NyFoEF6kJNI7v1hNJ1M/htwieSUZUXQH4vjHDgYVcbnybDvy 7DZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=FafvLAUw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f11si2207162ejt.706.2020.07.26.09.04.20; Sun, 26 Jul 2020 09:04:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=FafvLAUw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727091AbgGZQEI (ORCPT + 99 others); Sun, 26 Jul 2020 12:04:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726998AbgGZQEH (ORCPT ); Sun, 26 Jul 2020 12:04:07 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55741C0619D4; Sun, 26 Jul 2020 09:04:07 -0700 (PDT) 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: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=UyAQuKzOjtI/x1r3Rxgb+Q9XWacAff5rq+0vrGSNTvw=; b=FafvLAUw2Km0gfGFD6euiu6kRr AkfcGLFyA7DNFjZb+gYe7/VuiUDIQsKcqi3Mz/B74maTqHuig5mQ0FQqeXV4gCrQn7q7KGQT0oRgY UUQJBeI9Icto65wHQRDvNE+GaZFZDJeEJuxLtBaStcBBvyVuYz82cSJj0QesJdalXKgfLRUIssZol BNaj+YK9hDgc9BCY6h+6RU+mpefIEPlpqwczaa+SdGN4EoB4G7GHRfkuFVb2R5v0QcQwWcivty2u7 1zld9ry8CAPrkWFpr14FZQ72uN6HzbqoiWLNqm0URIZrP+0GXSnC5wkZyt3oGX+hcwGHGpfIyadjp ptOJHnIw==; Received: from [2001:4bb8:18c:2acc:2375:88ff:9f84:118d] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzj87-0000YT-Ed; Sun, 26 Jul 2020 16:04:03 +0000 From: Christoph Hellwig To: x86@kernel.org, Jan Kara Cc: linux-arm-kernel@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org Subject: improve compat handling for the i386 u64 alignment quirk Date: Sun, 26 Jul 2020 18:03:57 +0200 Message-Id: <20200726160401.311569-1-hch@lst.de> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, the i386 ABI is a little special in that it uses less than natural alignment for 64-bit integer types (u64 and s64), and a significant amount of our compat handlers deals with just that. Unfortunately there is no good way to check for this specific quirk at runtime, similar how in_compat_syscall() checks for a compat syscall. This series adds such a check, and then uses the quota code as an example of how this improves the compat handling. I have a few other places in mind where this will also be useful going forward. Diffstat: b/arch/arm64/include/asm/compat.h | 2 b/arch/arm64/include/asm/stat.h | 2 b/arch/arm64/kernel/process.c | 1 b/arch/arm64/kernel/ptrace.c | 1 b/arch/mips/include/asm/compat.h | 2 b/arch/parisc/include/asm/compat.h | 2 b/arch/powerpc/include/asm/compat.h | 2 b/arch/s390/include/asm/compat.h | 2 b/arch/sparc/include/asm/compat.h | 3 b/arch/x86/entry/syscalls/syscall_32.tbl | 2 b/arch/x86/include/asm/compat.h | 3 b/fs/quota/Kconfig | 5 - b/fs/quota/Makefile | 1 b/fs/quota/compat.h | 34 ++++++++ b/fs/quota/quota.c | 73 +++++++++++++++--- b/include/linux/compat.h | 17 ++++ b/include/linux/quotaops.h | 3 b/kernel/sys_ni.c | 1 fs/quota/compat.c | 120 ------------------------------- 19 files changed, 114 insertions(+), 162 deletions(-)