linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: x86@kernel.org, Jan Kara <jack@suse.com>
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: [PATCH 3/4] compat: add a compat_need_64bit_alignment_fixup() helper
Date: Sun, 26 Jul 2020 18:04:00 +0200	[thread overview]
Message-ID: <20200726160401.311569-4-hch@lst.de> (raw)
In-Reply-To: <20200726160401.311569-1-hch@lst.de>

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 <hch@lst.de>
---
 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 c22a7f1d253b87..afdd44ba3a8869 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -945,6 +945,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
-- 
2.27.0


  parent reply	other threads:[~2020-07-26 16:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-26 16:03 improve compat handling for the i386 u64 alignment quirk Christoph Hellwig
2020-07-26 16:03 ` [PATCH 1/4] arm64: stop using <asm/compat.h> directly Christoph Hellwig
2020-07-30 17:34   ` Nathan Chancellor
2020-07-31  8:41     ` Naresh Kamboju
2020-07-26 16:03 ` [PATCH 2/4] compat: lift compat_s64 and compat_u64 to <linux/compat.h> Christoph Hellwig
2020-07-29  6:08   ` [PATCH 2/4 v2] " Christoph Hellwig
2020-07-26 16:04 ` Christoph Hellwig [this message]
2020-07-26 16:04 ` [PATCH 4/4] quota: simplify the quotactl compat handling Christoph Hellwig
2020-07-26 16:32   ` Al Viro
2020-07-26 16:34     ` Christoph Hellwig
2020-07-26 16:37       ` Al Viro
2020-07-27 12:41   ` Jan Kara
2020-07-27 15:56     ` Al Viro
2020-07-27 21:31       ` Jan Kara
2020-07-28  1:49         ` Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200726160401.311569-4-hch@lst.de \
    --to=hch@lst.de \
    --cc=jack@suse.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).