From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: hpa@zytor.com
Cc: pinskia@gmail.com, teawater@gmail.com, tglx@linutronix.de,
mingo@redhat.com, x86@kernel.org, eparis@redhat.com,
ak@linux.intel.com, linux-kernel@vger.kernel.org,
gdb@sourceware.org
Subject: Re: [PATCH] Fix get ERESTARTSYS with m32 in x86_64 when debug by GDB
Date: Wed, 30 Apr 2014 16:28:00 -0000 [thread overview]
Message-ID: <201404301335.s3UDZX4J017978@glazunov.sibelius.xs4all.nl> (raw)
In-Reply-To: <536085B7.5070002@zytor.com> (hpa@zytor.com)
> Date: Tue, 29 Apr 2014 22:10:15 -0700
> From: "H. Peter Anvin" <hpa@zytor.com>
>
> On 04/29/2014 10:08 PM, Andrew Pinski wrote:
> >
> > restoring the values is hard since even the ptrace interface does not
> > allow for that.
> >
>
> So that begs the ultimate question, which is: given the fact that there
> is *state missing* from the state vector (this is the core of the
> problem), is there a way we can add that state so that gdb will be able
> to save and restore it?
Carrying around additional state in GDB is complicated; I'd rather
avoid it.
arch/x86/kernel/ptrace.c:putreg32() has this bit of code:
case offsetof(struct user32, regs.orig_eax):
/*
* A 32-bit debugger setting orig_eax 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.
*/
regs->orig_ax = value;
if (syscall_get_nr(child, regs) >= 0)
task_thread_info(child)->status |= TS_COMPAT;
break;
which gets used for 32-bit compat ptrace(2). Perhaps the same logic
should be added to putreg() if the child is a 32-bit process?
If (and only if) the goal of that TS_COMPAT flag solely is to trigger
the error code sign-extension in arch/x86/asm/syscall.h:syscall_get_error(),
we could work around to problem in GDB by checking "orig_ax" to see if
we're continuing an interrupted system call and sign extend the error
code in the real "eax" register if we are.
next prev parent reply other threads:[~2014-04-30 13:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-21 16:33 Hui Zhu
2014-04-22 12:37 ` H. Peter Anvin
2014-04-30 4:51 ` Hui Zhu
2014-04-30 5:08 ` H. Peter Anvin
2014-04-30 5:10 ` Andrew Pinski
2014-04-30 8:44 ` H. Peter Anvin
2014-04-30 16:28 ` Mark Kettenis [this message]
2014-04-30 16:35 ` Hui Zhu
2014-04-30 17:49 ` Hui Zhu
2014-04-30 20:44 ` H. Peter Anvin
2014-04-30 16:35 ` H. Peter Anvin
2014-04-30 20:43 ` Pedro Alves
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=201404301335.s3UDZX4J017978@glazunov.sibelius.xs4all.nl \
--to=mark.kettenis@xs4all.nl \
--cc=ak@linux.intel.com \
--cc=eparis@redhat.com \
--cc=gdb@sourceware.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pinskia@gmail.com \
--cc=teawater@gmail.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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