The patch titled i386-pda: Fix places where using %gs changes the usermode ABI has been added to the -mm tree. Its filename is i386-pda-fix-places-where-using-%gs-changes-the-usermode-abi.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: i386-pda: Fix places where using %gs changes the usermode ABI From: Jeremy Fitzhardinge <jeremy@xxxxxxxx> There are a few places where the change in struct pt_regs and the use of %gs affect the userspace ABI. These are primarily debugging interfaces where thread state can be inspected or extracted. Signed-off-by: Jeremy Fitzhardinge <jeremy@xxxxxxxxxxxxx> Cc: Chuck Ebbert <76306.1226@xxxxxxxxxxxxxx> Cc: Zachary Amsden <zach@xxxxxxxxxx> Cc: Jan Beulich <jbeulich@xxxxxxxxxx> Cc: Andi Kleen <ak@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- arch/i386/kernel/process.c | 6 +++--- arch/i386/kernel/ptrace.c | 18 ++++++------------ include/asm-i386/elf.h | 2 +- include/asm-i386/unwind.h | 1 + 4 files changed, 11 insertions(+), 16 deletions(-) diff -puN arch/i386/kernel/process.c~i386-pda-fix-places-where-using-%gs-changes-the-usermode-abi arch/i386/kernel/process.c --- a/arch/i386/kernel/process.c~i386-pda-fix-places-where-using-%gs-changes-the-usermode-abi +++ a/arch/i386/kernel/process.c @@ -313,8 +313,8 @@ void show_regs(struct pt_regs * regs) regs->eax,regs->ebx,regs->ecx,regs->edx); printk("ESI: %08lx EDI: %08lx EBP: %08lx", regs->esi, regs->edi, regs->ebp); - printk(" DS: %04x ES: %04x\n", - 0xffff & regs->xds,0xffff & regs->xes); + printk(" DS: %04x ES: %04x GS: %04x\n", + 0xffff & regs->xds,0xffff & regs->xes, 0xffff & regs->xgs); cr0 = read_cr0(); cr2 = read_cr2(); @@ -511,7 +511,7 @@ void dump_thread(struct pt_regs * regs, dump->regs.ds = regs->xds; dump->regs.es = regs->xes; savesegment(fs,dump->regs.fs); - savesegment(gs,dump->regs.gs); + dump->regs.gs = regs->xgs; dump->regs.orig_eax = regs->orig_eax; dump->regs.eip = regs->eip; dump->regs.cs = regs->xcs; diff -puN arch/i386/kernel/ptrace.c~i386-pda-fix-places-where-using-%gs-changes-the-usermode-abi arch/i386/kernel/ptrace.c --- a/arch/i386/kernel/ptrace.c~i386-pda-fix-places-where-using-%gs-changes-the-usermode-abi +++ a/arch/i386/kernel/ptrace.c @@ -94,13 +94,9 @@ static int putreg(struct task_struct *ch return -EIO; child->thread.fs = value; return 0; - case GS: - if (value && (value & 3) != 3) - return -EIO; - child->thread.gs = value; - return 0; case DS: case ES: + case GS: if (value && (value & 3) != 3) return -EIO; value &= 0xffff; @@ -116,8 +112,8 @@ static int putreg(struct task_struct *ch value |= get_stack_long(child, EFL_OFFSET) & ~FLAG_MASK; break; } - if (regno > GS*4) - regno -= 2*4; + if (regno > ES*4) + regno -= 1*4; put_stack_long(child, regno - sizeof(struct pt_regs), value); return 0; } @@ -131,18 +127,16 @@ static unsigned long getreg(struct task_ case FS: retval = child->thread.fs; break; - case GS: - retval = child->thread.gs; - break; case DS: case ES: + case GS: case SS: case CS: retval = 0xffff; /* fall through */ default: - if (regno > GS*4) - regno -= 2*4; + if (regno > ES*4) + regno -= 1*4; regno = regno - sizeof(struct pt_regs); retval &= get_stack_long(child, regno); } diff -puN include/asm-i386/elf.h~i386-pda-fix-places-where-using-%gs-changes-the-usermode-abi include/asm-i386/elf.h --- a/include/asm-i386/elf.h~i386-pda-fix-places-where-using-%gs-changes-the-usermode-abi +++ a/include/asm-i386/elf.h @@ -91,7 +91,7 @@ typedef struct user_fxsr_struct elf_fpxr pr_reg[7] = regs->xds; \ pr_reg[8] = regs->xes; \ savesegment(fs,pr_reg[9]); \ - savesegment(gs,pr_reg[10]); \ + pr_reg[10] = regs->xgs; \ pr_reg[11] = regs->orig_eax; \ pr_reg[12] = regs->eip; \ pr_reg[13] = regs->xcs; \ diff -puN include/asm-i386/unwind.h~i386-pda-fix-places-where-using-%gs-changes-the-usermode-abi include/asm-i386/unwind.h --- a/include/asm-i386/unwind.h~i386-pda-fix-places-where-using-%gs-changes-the-usermode-abi +++ a/include/asm-i386/unwind.h @@ -71,6 +71,7 @@ static inline void arch_unw_init_blocked info->regs.xss = __KERNEL_DS; info->regs.xds = __USER_DS; info->regs.xes = __USER_DS; + info->regs.xgs = __KERNEL_PDA; } extern asmlinkage int arch_unwind_init_running(struct unwind_frame_info *, _ Patches currently in -mm which might be from jeremy@xxxxxxxx are x86-remove-default_ldt-and-simplify-ldt-setting.patch i386-use-asm-offsets-for-the-offsets-of-registers-into-the-pt_regs-struct-rather-than-having-hard-coded-constants.patch i386-pda-basic-definitions-for-i386-pda.patch i386-pda-initialize-the-per-cpu-data-area.patch i386-pda-use-%gs-as-the-pda-base-segment-in-the-kernel.patch i386-pda-fix-places-where-using-%gs-changes-the-usermode-abi.patch i386-pda-update-sys_vm86-to-cope-with-changed-pt_regs-and-%gs-usage.patch i386-pda-implement-smp_processor_id-with-the-pda.patch i386-pda-implement-current-with-the-pda.patch i386-pda-store-the-interrupt-regs-pointer-in-the-pda.patch generic-bug-implementation.patch generic-bug-for-i386.patch generic-bug-for-x86-64.patch generic-bug-for-powerpc.patch uml-add-generic-bug-support.patch use-generic-bug-for-ppc.patch bug-test-1.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html