From: Roland McGrath <roland@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
jan.kratochvil@redhat.com, Oleg Nesterov <oleg@redhat.com>,
x86@kernel.org, linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH 0/4] x86: clean up orig_ax handling
Date: Tue, 22 Sep 2009 23:18:34 -0700 (PDT) [thread overview]
Message-ID: <20090923061834.BE13A22@magilla.sf.frob.com> (raw)
In-Reply-To: Roland McGrath's message of Tuesday, 22 September 2009 19:40:49 -0700 <20090923024049.AA85913F37@magilla.sf.frob.com>
Here is the aforementioned other tack on this.
I said earlier that getreg() (i.e. 64-bit ptrace/core-dump fetches)
should sign-extend the low 32 bits of orig_ax up. But I've changed my
mind. It's true that today you can store 0xffffffff via either 64-bit
ptrace or 32-bit ptrace and then read back -1 via 64-bit ptrace. (This
wasn't always so, and so we can hope that no debugger really depends on
it.) What seems more important is that tracing and core dumps correctly
show the full orig_ax value incoming in %rax from userland, since
%rax=__NR_foo|(1UL<<32) behaves differently (i.e. -ENOSYS) than
%eax=_NR_foo in actual fact when user-mode does "syscall" with those
values. In a bogon case like that, you would like to have traces/dumps
tell you why the task is not making a proper syscall rather than lie
about what register bits it entered the kernel with.
Patches 1-3 change no ptrace-tests outcomes, i.e. don't regress on the
test cases that went with the original sign-extension changes. They
reintroduce e.g. the ability to blindly read and write back the whole
regset when at syscall-entry tracing with %rax=__NR_foo|(1UL<<32) and
have that fail with -ENOSYS as it would without tracing rather than
perturb the tracee to call sys_foo instead. (Not that this is useful.)
Patch 4 does Linus's fix for the outstanding bug. I've verified it works.
Thanks,
Roland
---
The following changes since commit 7fa07729e439a6184bd824746d06a49cca553f15:
Linus Torvalds (1):
Merge branch 'perf-fixes-for-linus' of git://git.kernel.org/.../tip/linux-2.6-tip
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/frob/linux-2.6-roland.git x86/orig_ax
Roland McGrath (4):
asm-generic: syscall_get_nr returns int
x86: syscall_get_nr returns int
x86: ptrace: do not sign-extend orig_ax on write
x86: ptrace: set TS_COMPAT when 32-bit ptrace sets orig_eax>=0
arch/x86/include/asm/syscall.h | 14 +++++++-------
arch/x86/kernel/ptrace.c | 21 ++++++++-------------
include/asm-generic/syscall.h | 8 ++++++--
3 files changed, 21 insertions(+), 22 deletions(-)
next prev parent reply other threads:[~2009-09-23 6:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-23 0:46 [PATCH] x86: ptrace: sign-extend eax with orig_eax>=0 Roland McGrath
2009-09-23 1:31 ` Linus Torvalds
2009-09-23 2:40 ` Roland McGrath
2009-09-23 6:18 ` Roland McGrath [this message]
2009-09-23 6:19 ` [PATCH 1/4] asm-generic: syscall_get_nr returns int Roland McGrath
2009-09-23 6:20 ` [PATCH 2/4] x86: " Roland McGrath
2009-09-23 6:20 ` [PATCH 3/4] x86: ptrace: do not sign-extend orig_ax on write Roland McGrath
2009-09-23 6:21 ` [PATCH 4/4] x86: ptrace: set TS_COMPAT when 32-bit ptrace sets orig_eax>=0 Roland McGrath
2009-09-23 15:41 ` [PATCH 0/4] x86: clean up orig_ax handling Ingo Molnar
2009-09-23 15:53 ` Linus Torvalds
2009-09-23 16:21 ` Ingo Molnar
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=20090923061834.BE13A22@magilla.sf.frob.com \
--to=roland@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=jan.kratochvil@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--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