From: tip-bot for Andy Lutomirski <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: mingo@kernel.org, torvalds@linux-foundation.org,
linux-kernel@vger.kernel.org, hpa@zytor.com, bp@alien8.de,
oleg@redhat.com, tglx@linutronix.de, viro@zeniv.linux.org.uk,
luto@amacapital.net
Subject: [tip:x86/asm] x86/signal/64: Remove 'fs' and 'gs' from sigcontext
Date: Mon, 16 Mar 2015 05:08:29 -0700 [thread overview]
Message-ID: <tip-e82f114d61effc06385f61bce9047a8f13d28337@git.kernel.org> (raw)
In-Reply-To: <844f8490e938780c03355be4c9b69eb4c494bf4e.1426193719.git.luto@kernel.org>
Commit-ID: e82f114d61effc06385f61bce9047a8f13d28337
Gitweb: http://git.kernel.org/tip/e82f114d61effc06385f61bce9047a8f13d28337
Author: Andy Lutomirski <luto@amacapital.net>
AuthorDate: Thu, 12 Mar 2015 13:57:52 -0700
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 16 Mar 2015 09:14:51 +0100
x86/signal/64: Remove 'fs' and 'gs' from sigcontext
As far as I can tell, these fields have been set to zero on save
and ignored on restore since Linux was imported into git.
Rename them '__pad1' and '__pad2' to avoid confusion. This may
also allow us to recycle them some day.
This also adds a comment clarifying the history of those fields.
I'm intentionally avoiding calling either of them '__pad0': the
field formerly known as '__pad0' is now 'ss'.
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/844f8490e938780c03355be4c9b69eb4c494bf4e.1426193719.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/include/asm/sigcontext.h | 4 ++--
arch/x86/include/uapi/asm/sigcontext.h | 19 +++++++++++++++++--
arch/x86/kernel/signal.c | 4 ++--
3 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/arch/x86/include/asm/sigcontext.h b/arch/x86/include/asm/sigcontext.h
index f910cdc..6fe6b18 100644
--- a/arch/x86/include/asm/sigcontext.h
+++ b/arch/x86/include/asm/sigcontext.h
@@ -57,8 +57,8 @@ struct sigcontext {
unsigned long ip;
unsigned long flags;
unsigned short cs;
- unsigned short gs;
- unsigned short fs;
+ unsigned short __pad2; /* Was called gs, but was always zero. */
+ unsigned short __pad1; /* Was called fs, but was always zero. */
unsigned short ss;
unsigned long err;
unsigned long trapno;
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index 076b11f..16dc4e8 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -177,8 +177,23 @@ struct sigcontext {
__u64 rip;
__u64 eflags; /* RFLAGS */
__u16 cs;
- __u16 gs;
- __u16 fs;
+
+ /*
+ * Prior to 2.5.64 ("[PATCH] x86-64 updates for 2.5.64-bk3"),
+ * Linux saved and restored fs and gs in these slots. This
+ * was counterproductive, as fsbase and gsbase were never
+ * saved, so arch_prctl was presumably unreliable.
+ *
+ * If these slots are ever needed for any other purpose, there
+ * is some risk that very old 64-bit binaries could get
+ * confused. I doubt that many such binaries still work,
+ * though, since the same patch in 2.5.64 also removed the
+ * 64-bit set_thread_area syscall, so it appears that there is
+ * no TLS API that works in both pre- and post-2.5.64 kernels.
+ */
+ __u16 __pad2; /* Was gs. */
+ __u16 __pad1; /* Was fs. */
+
__u16 ss;
__u64 err;
__u64 trapno;
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index e2f6061..edcb862 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -155,8 +155,8 @@ int setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate,
#else /* !CONFIG_X86_32 */
put_user_ex(regs->flags, &sc->flags);
put_user_ex(regs->cs, &sc->cs);
- put_user_ex(0, &sc->gs);
- put_user_ex(0, &sc->fs);
+ put_user_ex(0, &sc->__pad2);
+ put_user_ex(0, &sc->__pad1);
put_user_ex(regs->ss, &sc->ss);
#endif /* CONFIG_X86_32 */
next prev parent reply other threads:[~2015-03-16 12:08 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-12 20:57 [PATCH v3 0/2] x86_64: Sigcontext improvements Andy Lutomirski
2015-03-12 20:57 ` [PATCH v3 1/2] x86_64,signal: Fix SS handling for signals delivered to 64-bit programs Andy Lutomirski
2015-03-13 16:13 ` Borislav Petkov
2015-03-16 8:11 ` Ingo Molnar
2015-03-16 12:08 ` [tip:x86/asm] x86/signal/64: " tip-bot for Andy Lutomirski
2015-03-17 8:44 ` tip-bot for Andy Lutomirski
2015-03-18 17:19 ` [PATCH v3 1/2] x86_64,signal: " Andrey Wagin
2015-03-18 17:48 ` Oleg Nesterov
2015-03-18 18:06 ` Andy Lutomirski
2015-03-18 18:17 ` Cyrill Gorcunov
2015-03-18 18:20 ` Andy Lutomirski
2015-03-18 18:45 ` Cyrill Gorcunov
2015-03-18 18:25 ` Oleg Nesterov
2015-03-18 18:32 ` Andy Lutomirski
2015-03-18 19:13 ` Cyrill Gorcunov
2015-03-18 18:13 ` Cyrill Gorcunov
2015-03-18 18:31 ` Oleg Nesterov
2015-03-18 18:50 ` Cyrill Gorcunov
2015-03-18 19:52 ` Andrey Wagin
2015-03-18 20:02 ` Oleg Nesterov
2015-03-18 21:26 ` Andy Lutomirski
2015-03-18 21:34 ` Pavel Emelyanov
2015-03-18 22:03 ` Andy Lutomirski
2015-03-19 7:35 ` Cyrill Gorcunov
2015-03-19 16:08 ` Andy Lutomirski
2015-03-19 16:19 ` Cyrill Gorcunov
2015-03-20 11:43 ` Denys Vlasenko
2015-03-20 11:56 ` Cyrill Gorcunov
2015-03-20 12:04 ` Cyrill Gorcunov
2015-03-20 14:07 ` Oleg Nesterov
2015-03-20 14:47 ` Cyrill Gorcunov
2015-04-10 21:59 ` Andy Lutomirski
2015-04-10 22:11 ` Cyrill Gorcunov
2015-04-10 22:16 ` Andy Lutomirski
2015-04-10 22:20 ` Cyrill Gorcunov
2015-03-12 20:57 ` [PATCH v3 2/2] x86_64,signal: Remove 'fs' and 'gs' from sigcontext Andy Lutomirski
2015-03-16 12:08 ` tip-bot for Andy Lutomirski [this message]
2015-03-17 8:44 ` [tip:x86/asm] x86/signal/64: " tip-bot for Andy Lutomirski
2015-03-13 15:31 ` [PATCH v3 0/2] x86_64: Sigcontext improvements Oleg Nesterov
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=tip-e82f114d61effc06385f61bce9047a8f13d28337@git.kernel.org \
--to=tipbot@zytor.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/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).