This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix get ERESTARTSYS with m32 in x86_64 when debug by GDB
- From: "H. Peter Anvin" <hpa at zytor dot com>
- To: Hui Zhu <hui_zhu at mentor dot com>, Hui Zhu <teawater at gmail dot com>, Mark Kettenis <mark dot kettenis at xs4all dot nl>
- Cc: pinskia at gmail dot com, Thomas Gleixner <tglx at linutronix dot de>, Ingo Molnar <mingo at redhat dot com>, x86 at kernel dot org, eparis at redhat dot com, ak at linux dot intel dot com, "linux-kernel at vger dot kernel dot org" <linux-kernel at vger dot kernel dot org>, "gdb at sourceware dot org" <gdb at sourceware dot org>, Pedro Alves <palves at redhat dot com>
- Date: Wed, 30 Apr 2014 13:43:07 -0700
- Subject: Re: [PATCH] Fix get ERESTARTSYS with m32 in x86_64 when debug by GDB
- Authentication-results: sourceware.org; auth=none
- References: <CANFwon0oLO+qCtpewc=BxKBOm05aBMpV=yG0CxwW1isWHfnZqw at mail dot gmail dot com> <53554846 dot 3070608 at zytor dot com> <CANFwon3zA9FMujmnN3nMiv8Zr8bU9o72XXa26dkePNq57U=JcQ at mail dot gmail dot com> <53608125 dot 2020103 at zytor dot com> <CA+=Sn1=y-smZOaD_yRxEwgu-PPaZYdQtB_RGPCA5-9wmB6=hvQ at mail dot gmail dot com> <536085B7 dot 5070002 at zytor dot com> <201404301335 dot s3UDZX4J017978 at glazunov dot sibelius dot xs4all dot nl> <CANFwon1OnRmXChO_uYa=ftJc8NqmvV7CRdM6hrWeyqXYUt417Q at mail dot gmail dot com> <53612647 dot 1040604 at mentor dot com>
On 04/30/2014 09:35 AM, Hui Zhu wrote:
>
> I sorry that previous patch has some format issue, post a new one.
>
> Signed-off-by: Hui Zhu <hui@codesourcery.com>
> ---
> --- a/arch/x86/kernel/ptrace.c
> +++ b/arch/x86/kernel/ptrace.c
> @@ -452,6 +452,23 @@ static int putreg(struct task_struct *ch
> if (child->thread.gs != value)
> return do_arch_prctl(child, ARCH_SET_GS, value);
> return 0;
> + case offsetof(struct user_regs_struct, orig_ax):
> + /*
> + * A 64-bit debugger setting orig_ax of a 32-bit inferior
> + * means to restore the state of the task restarting a
> + * 32-bit syscall.
> + * Make sure we interpret the -ERESTART* codes correctly
> + * in case the task is not actually still sitting at the
> + * exit from a 32-bit syscall with TS_COMPAT still set.
> + */
> + if (test_ti_thread_flag(task_thread_info(child), TIF_IA32)) {
> + struct pt_regs *regs = task_pt_regs(child);
> + regs->orig_ax = value;
> + if (syscall_get_nr(child, regs) >= 0)
> + task_thread_info(child)->status |= TS_COMPAT;
> + return 0;
> + }
> + break;
> #endif
> }
You still seems to have botched whitespace, and no patch description in
the same email so it can be automated.
-hpa