diff options
author | des <des@FreeBSD.org> | 2007-04-15 13:24:03 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2007-04-15 13:24:03 +0000 |
commit | 5fa10252a885e480eb714df227ec05c73b35b0f2 (patch) | |
tree | 5706c178e936f3117fb4b3f995f299c12d73aaf1 /sys | |
parent | 577cabcb8a99b40c61326ef06c7e3e070d3ae1aa (diff) | |
download | FreeBSD-src-5fa10252a885e480eb714df227ec05c73b35b0f2.zip FreeBSD-src-5fa10252a885e480eb714df227ec05c73b35b0f2.tar.gz |
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
Diffstat (limited to 'sys')
-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 c30f231..d985245 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 cba2b7b..481c053 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); } |