Skip to contentSkip to conversation

ptrace denies access to EFLAGS_RF

DISCUSSION Chuck Ebbert 2 participants 2 messages Jan 6, 2006 – Jan 12, 2006 ptrace support

lore
Share & tools
lore
#0 lore raw

In-Reply-To: <[email protected]>

Quoted 5 lines · Stephane Eranian

To my surprise, applying the same fix to the x86_64 does not solve the problem on my Opteron box. I verified that the offset (144) matches with what the kernel is expecting. Somehow the RF is lost or not set in the proper location. I cannot make forward progress once I reach the breakpoint.

I sent this to Andi this morning. Does it work for you?

 arch/x86_64/ia32/ptrace32.c |    9 ++++++---
 arch/x86_64/kernel/ptrace.c |    9 ++++++---
 2 files changed, 12 insertions(+), 6 deletions(-)
arch/x86_64/ia32/ptrace32.c +6 -3
@@ -28,9 +28,12 @@
 #include <asm/i387.h>
 #include <asm/fpu32.h>
 
-/* determines which flags the user has access to. */
-/* 1 = access 0 = no access */
-#define FLAG_MASK 0x44dd5UL
+/*
+ * Determines which flags the user has access to [1 = access, 0 = no access].
+ * Prohibits changing ID(21), VIP(20), VIF(19), VM(17), IOPL(12-13), IF(9).
+ * Also masks reserved bits (31-22, 15, 5, 3, 1).
+ */
+#define FLAG_MASK 0x54dd5UL
 
 #define R32(l,q) \
 	case offsetof(struct user32, regs.l): stack[offsetof(struct pt_regs, q)/8] = val; break
arch/x86_64/kernel/ptrace.c +6 -3
@@ -36,9 +36,12 @@
  * in exit.c or in signal.c.
  */
 
-/* determines which flags the user has access to. */
-/* 1 = access 0 = no access */
-#define FLAG_MASK 0x44dd5UL
+/*
+ * Determines which flags the user has access to [1 = access, 0 = no access].
+ * Prohibits changing ID(21), VIP(20), VIF(19), VM(17), IOPL(12-13), IF(9).
+ * Also masks reserved bits (63-22, 15, 5, 3, 1).
+ */
+#define FLAG_MASK 0x54dd5UL
 
 /* set's the trap flag. */
 #define TRAP_FLAG 0x100UL
Signature · 2 lines
Chuck
Currently reading: _Thud!_ by Terry Pratchett
#1 lore raw

Chuck,

I tired today with 2.6.15-git8 and now it works just fine on my Opteron box.

Thanks for your help.

Quoted 59 lines · Chuck Ebbert

In-Reply-To: <[email protected]>

Quoted 5 lines · Stephane Eranian

To my surprise, applying the same fix to the x86_64 does not solve the problem on my Opteron box. I verified that the offset (144) matches with what the kernel is expecting. Somehow the RF is lost or not set in the proper location. I cannot make forward progress once I reach the breakpoint.

I sent this to Andi this morning. Does it work for you?

 arch/x86_64/ia32/ptrace32.c |    9 ++++++---
 arch/x86_64/kernel/ptrace.c |    9 ++++++---
 2 files changed, 12 insertions(+), 6 deletions(-)
arch/x86_64/ia32/ptrace32.c +6 -3
@@ -28,9 +28,12 @@
 #include <asm/i387.h>
 #include <asm/fpu32.h>
 
-/* determines which flags the user has access to. */
-/* 1 = access 0 = no access */
-#define FLAG_MASK 0x44dd5UL
+/*
+ * Determines which flags the user has access to [1 = access, 0 = no access].
+ * Prohibits changing ID(21), VIP(20), VIF(19), VM(17), IOPL(12-13), IF(9).
+ * Also masks reserved bits (31-22, 15, 5, 3, 1).
+ */
+#define FLAG_MASK 0x54dd5UL
 
 #define R32(l,q) \
 	case offsetof(struct user32, regs.l): stack[offsetof(struct pt_regs, q)/8] = val; break
arch/x86_64/kernel/ptrace.c +6 -3
@@ -36,9 +36,12 @@
  * in exit.c or in signal.c.
  */
 
-/* determines which flags the user has access to. */
-/* 1 = access 0 = no access */
-#define FLAG_MASK 0x44dd5UL
+/*
+ * Determines which flags the user has access to [1 = access, 0 = no access].
+ * Prohibits changing ID(21), VIP(20), VIF(19), VM(17), IOPL(12-13), IF(9).
+ * Also masks reserved bits (63-22, 15, 5, 3, 1).
+ */
+#define FLAG_MASK 0x54dd5UL
 
 /* set's the trap flag. */
 #define TRAP_FLAG 0x100UL
Signature · 2 lines
Chuck
Currently reading: _Thud!_ by Terry Pratchett
Signature · 1 line
-Stephane