diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2007-04-15 13:24:03 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2007-04-15 13:24:03 +0000 |
commit | 66cd74a611b59e28f8078e5120346a280853773d (patch) | |
tree | 5706c178e936f3117fb4b3f995f299c12d73aaf1 | |
parent | f1d6e6dc7154b50a2720540d182833fb08ce7c1b (diff) | |
download | src-66cd74a611b59e28f8078e5120346a280853773d.tar.gz src-66cd74a611b59e28f8078e5120346a280853773d.zip |
Don't reset uio_offset to 0 before returning. Instead, refuse to service
requests where uio_offset is not 0 to begin with. This fixes a long-
standing bug where e.g. 'cat /proc/$$/regs' would loop forever.
MFC after: 3 weeks
Notes
Notes:
svn path=/head/; revision=168758
-rw-r--r-- | sys/fs/procfs/procfs_dbregs.c | 4 | ||||
-rw-r--r-- | sys/fs/procfs/procfs_regs.c | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/sys/fs/procfs/procfs_dbregs.c b/sys/fs/procfs/procfs_dbregs.c index c30f231c67a9..d985245528b9 100644 --- a/sys/fs/procfs/procfs_dbregs.c +++ b/sys/fs/procfs/procfs_dbregs.c @@ -95,6 +95,9 @@ procfs_doprocdbregs(PFS_FILL_ARGS) int wrap32 = 0; #endif + if (uio->uio_offset != 0) + return (0); + PROC_LOCK(p); KASSERT(p->p_lock > 0, ("proc not held")); if (p_candebug(td, p) != 0) { @@ -128,6 +131,5 @@ procfs_doprocdbregs(PFS_FILL_ARGS) } PROC_UNLOCK(p); - uio->uio_offset = 0; return (error); } diff --git a/sys/fs/procfs/procfs_regs.c b/sys/fs/procfs/procfs_regs.c index cba2b7bc14a4..481c05347160 100644 --- a/sys/fs/procfs/procfs_regs.c +++ b/sys/fs/procfs/procfs_regs.c @@ -89,8 +89,11 @@ procfs_doprocregs(PFS_FILL_ARGS) int wrap32 = 0; #endif + if (uio->uio_offset != 0) + return (0); + PROC_LOCK(p); - KASSERT(p->p_lock > 0, ("proc not held")); + PROC_ASSERT_HELD(p); if (p_candebug(td, p)) { PROC_UNLOCK(p); return (EPERM); @@ -122,6 +125,5 @@ procfs_doprocregs(PFS_FILL_ARGS) } PROC_UNLOCK(p); - uio->uio_offset = 0; return (error); } |