Revision 1e2e99f0e4aa6363e8515ed17011c210c8f1b52a authored by Jason Wessel on 06 July 2007, 09:39:50 UTC, committed by Linus Torvalds on 06 July 2007, 17:23:43 UTC
The commit 635cf99a80f4ebee59d70eb64bb85ce829e4591f introduced a regression. Executing a ptrace single step after certain int80 accesses will infinitely loop and never advance the PC. The TIF_SINGLESTEP check should be done on the return from the syscall and not before it. I loops on each single step on the pop right after the int80 which writes out to the console. At that point you can issue as many single steps as you want and it will not advance any further. The test case is below: /* Test whether singlestep through an int80 syscall works. */ #define _GNU_SOURCE #include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <sys/ptrace.h> #include <sys/wait.h> #include <sys/mman.h> #include <asm/user.h> #include <string.h> static int child, status; static struct user_regs_struct regs; static void do_child() { char str[80] = "child: int80 test\n"; ptrace(PTRACE_TRACEME, 0, 0, 0); kill(getpid(), SIGUSR1); write(fileno(stdout),str,strlen(str)); asm ("int $0x80" : : "a" (20)); /* getpid */ } static void do_parent() { unsigned long eip, expected = 0; again: waitpid(child, &status, 0); if (WIFEXITED(status) || WIFSIGNALED(status)) return; if (WIFSTOPPED(status)) { ptrace(PTRACE_GETREGS, child, 0, ®s); eip = regs.eip; if (expected) fprintf(stderr, "child stop @ %08lx, expected %08lx %s\n", eip, expected, eip == expected ? "" : " <== ERROR"); if (*(unsigned short *)eip == 0x80cd) { fprintf(stderr, "int 0x80 at %08x\n", (unsigned int)eip); expected = eip + 2; } else expected = 0; ptrace(PTRACE_SINGLESTEP, child, NULL, NULL); } goto again; } int main(int argc, char * const argv[]) { child = fork(); if (child) do_parent(); else do_child(); return 0; } Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Cc: Jeremy Fitzhardinge <jeremy@goop.org> Cc: <stable@kernel.org> Cc: Chuck Ebbert <76306.1226@compuserve.com> Acked-by: Andi Kleen <ak@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent ef7320e
File | Mode | Size |
---|---|---|
9p | ||
adfs | ||
affs | ||
afs | ||
autofs | ||
autofs4 | ||
befs | ||
bfs | ||
cifs | ||
coda | ||
configfs | ||
cramfs | ||
debugfs | ||
devpts | ||
dlm | ||
ecryptfs | ||
efs | ||
exportfs | ||
ext2 | ||
ext3 | ||
ext4 | ||
fat | ||
freevxfs | ||
fuse | ||
gfs2 | ||
hfs | ||
hfsplus | ||
hostfs | ||
hpfs | ||
hppfs | ||
hugetlbfs | ||
isofs | ||
jbd | ||
jbd2 | ||
jffs2 | ||
jfs | ||
lockd | ||
minix | ||
msdos | ||
ncpfs | ||
nfs | ||
nfs_common | ||
nfsd | ||
nls | ||
ntfs | ||
ocfs2 | ||
openpromfs | ||
partitions | ||
proc | ||
qnx4 | ||
ramfs | ||
reiserfs | ||
romfs | ||
smbfs | ||
sysfs | ||
sysv | ||
udf | ||
ufs | ||
vfat | ||
xfs | ||
Kconfig | -rw-r--r-- | 74.2 KB |
Kconfig.binfmt | -rw-r--r-- | 5.3 KB |
Makefile | -rw-r--r-- | 3.7 KB |
aio.c | -rw-r--r-- | 45.6 KB |
anon_inodes.c | -rw-r--r-- | 5.1 KB |
attr.c | -rw-r--r-- | 4.2 KB |
bad_inode.c | -rw-r--r-- | 7.9 KB |
binfmt_aout.c | -rw-r--r-- | 15.2 KB |
binfmt_elf.c | -rw-r--r-- | 47.0 KB |
binfmt_elf_fdpic.c | -rw-r--r-- | 46.7 KB |
binfmt_em86.c | -rw-r--r-- | 2.8 KB |
binfmt_flat.c | -rw-r--r-- | 26.5 KB |
binfmt_misc.c | -rw-r--r-- | 15.5 KB |
binfmt_script.c | -rw-r--r-- | 2.7 KB |
binfmt_som.c | -rw-r--r-- | 7.8 KB |
bio.c | -rw-r--r-- | 29.0 KB |
block_dev.c | -rw-r--r-- | 35.0 KB |
buffer.c | -rw-r--r-- | 78.7 KB |
char_dev.c | -rw-r--r-- | 13.2 KB |
compat.c | -rw-r--r-- | 54.1 KB |
compat_ioctl.c | -rw-r--r-- | 103.6 KB |
dcache.c | -rw-r--r-- | 55.4 KB |
dcookies.c | -rw-r--r-- | 6.4 KB |
direct-io.c | -rw-r--r-- | 34.7 KB |
dnotify.c | -rw-r--r-- | 4.3 KB |
dquot.c | -rw-r--r-- | 52.9 KB |
drop_caches.c | -rw-r--r-- | 1.4 KB |
eventfd.c | -rw-r--r-- | 5.1 KB |
eventpoll.c | -rw-r--r-- | 36.9 KB |
exec.c | -rw-r--r-- | 35.8 KB |
fcntl.c | -rw-r--r-- | 14.2 KB |
fifo.c | -rw-r--r-- | 3.1 KB |
file.c | -rw-r--r-- | 6.2 KB |
file_table.c | -rw-r--r-- | 6.8 KB |
filesystems.c | -rw-r--r-- | 5.5 KB |
fs-writeback.c | -rw-r--r-- | 20.0 KB |
generic_acl.c | -rw-r--r-- | 4.2 KB |
inode.c | -rw-r--r-- | 37.0 KB |
inotify.c | -rw-r--r-- | 19.3 KB |
inotify_user.c | -rw-r--r-- | 17.5 KB |
internal.h | -rw-r--r-- | 934 bytes |
ioctl.c | -rw-r--r-- | 4.1 KB |
ioprio.c | -rw-r--r-- | 4.7 KB |
libfs.c | -rw-r--r-- | 16.0 KB |
locks.c | -rw-r--r-- | 57.0 KB |
mbcache.c | -rw-r--r-- | 18.2 KB |
mpage.c | -rw-r--r-- | 20.3 KB |
namei.c | -rw-r--r-- | 68.0 KB |
namespace.c | -rw-r--r-- | 46.7 KB |
nfsctl.c | -rw-r--r-- | 2.4 KB |
no-block.c | -rw-r--r-- | 663 bytes |
open.c | -rw-r--r-- | 24.6 KB |
pipe.c | -rw-r--r-- | 22.4 KB |
pnode.c | -rw-r--r-- | 7.6 KB |
pnode.h | -rw-r--r-- | 1006 bytes |
posix_acl.c | -rw-r--r-- | 8.5 KB |
quota.c | -rw-r--r-- | 8.9 KB |
quota_v1.c | -rw-r--r-- | 5.7 KB |
quota_v2.c | -rw-r--r-- | 20.1 KB |
read_write.c | -rw-r--r-- | 17.6 KB |
read_write.h | -rw-r--r-- | 542 bytes |
readdir.c | -rw-r--r-- | 6.8 KB |
select.c | -rw-r--r-- | 20.4 KB |
seq_file.c | -rw-r--r-- | 9.6 KB |
signalfd.c | -rw-r--r-- | 9.6 KB |
splice.c | -rw-r--r-- | 35.4 KB |
stack.c | -rw-r--r-- | 1.1 KB |
stat.c | -rw-r--r-- | 10.6 KB |
super.c | -rw-r--r-- | 22.1 KB |
sync.c | -rw-r--r-- | 7.0 KB |
timerfd.c | -rw-r--r-- | 5.0 KB |
utimes.c | -rw-r--r-- | 4.8 KB |
xattr.c | -rw-r--r-- | 13.9 KB |
xattr_acl.c | -rw-r--r-- | 2.3 KB |
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...