Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1255611

[PATCH v2 1/4] x86/signal/64: Add a comment about sigcontext->fs and gs

From Andy Lutomirski <luto@kernel.org>
Newsgroups linux.kernel
Subject [PATCH v2 1/4] x86/signal/64: Add a comment about sigcontext->fs and gs
Date 2015-10-26 02:30 +0100
Message-ID <qnELL-1Sy-15@gated-at.bofh.it> (permalink)
References <qnELL-1Sy-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


These fields have a strange history.  This tries to document it.

This borrows from 9a036b93a344 ("x86/signal/64: Remove 'fs' and 'gs'
from sigcontext"), which was reverted by ed596cde9425 ("Revert x86
sigcontext cleanups").

Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
 arch/x86/include/uapi/asm/sigcontext.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index 40836a9a7250..827c6ed0e26a 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -177,6 +177,24 @@ struct sigcontext {
 	__u64 rip;
 	__u64 eflags;		/* RFLAGS */
 	__u16 cs;
+
+	/*
+	 * 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.
+	 *
+	 * There is at least one additional concern if these slots are
+	 * recycled for another purpose: some DOSEMU versions stash fs
+	 * and gs in these slots manually.
+	 */
 	__u16 gs;
 	__u16 fs;
 	__u16 __pad0;
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/4] x86: sigcontext fixes, again Andy Lutomirski <luto@kernel.org> - 2015-10-26 02:30 +0100
  [PATCH v2 2/4] x86/signal/64: Fix SS if needed when delivering a 64-bit signal Andy Lutomirski <luto@kernel.org> - 2015-10-26 02:30 +0100
  [PATCH v2 1/4] x86/signal/64: Add a comment about sigcontext->fs and gs Andy Lutomirski <luto@kernel.org> - 2015-10-26 02:30 +0100
  [PATCH v2 3/4] x86/signal/64: Re-add support for SS in the 64-bit signal context Andy Lutomirski <luto@kernel.org> - 2015-10-26 02:30 +0100
  [PATCH v2 4/4] selftests/x86: Add tests for UC_SIGCONTEXT_SS and UC_STRICT_RESTORE_SS Andy Lutomirski <luto@kernel.org> - 2015-10-26 02:30 +0100
  Re: [PATCH v2 0/4] x86: sigcontext fixes, again Stas Sergeev <stsp@list.ru> - 2015-10-26 12:50 +0100
    Re: [PATCH v2 0/4] x86: sigcontext fixes, again Andy Lutomirski <luto@amacapital.net> - 2015-10-27 02:00 +0100
      Re: [PATCH v2 0/4] x86: sigcontext fixes, again Linus Torvalds <torvalds@linux-foundation.org> - 2015-10-27 23:40 +0100
        Re: [PATCH v2 0/4] x86: sigcontext fixes, again Toshi Kani <toshi.kani@hpe.com> - 2015-10-28 01:10 +0100
          Re: [PATCH v2 0/4] x86: sigcontext fixes, again Stas Sergeev <stsp@list.ru> - 2015-10-28 11:00 +0100
            Re: [PATCH v2 0/4] x86: sigcontext fixes, again Toshi Kani <toshi.kani@hpe.com> - 2015-10-28 17:40 +0100
              Re: [PATCH v2 0/4] x86: sigcontext fixes, again Toshi Kani <toshi.kani@hpe.com> - 2015-10-28 20:30 +0100
                Re: [PATCH v2 0/4] x86: sigcontext fixes, again Toshi Kani <toshi.kani@hpe.com> - 2015-10-29 00:00 +0100
                Re: [PATCH v2 0/4] x86: sigcontext fixes, again Stas Sergeev <stsp@list.ru> - 2015-10-31 13:50 +0100
      Re: [PATCH v2 0/4] x86: sigcontext fixes, again Andy Lutomirski <luto@amacapital.net> - 2015-10-31 01:00 +0100

csiph-web