summaryrefslogtreecommitdiff
path: root/sys/src/9/port/devproc.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2014-02-08 03:50:41 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2014-02-08 03:50:41 +0100
commit6b146c70c2863bf1e9d5c4a35cbd8426c5a161e7 (patch)
tree0c683fb3d4ab300d91acfe33415974a152212ab4 /sys/src/9/port/devproc.c
parent43212f64320c2e136eb3d4adb5d3e8c31c637386 (diff)
pc64: handle negative file offsets when accessing kernel memory with devproc
file offset is 64 bit signed integer, negative offsets are invalid and rejected by the kernel. to still access kernel memory on amd64, we unconditionally clear the sign bit of the 64 bit offset in libmach and devproc sign extends the offset back to a 64 bit address.
Diffstat (limited to 'sys/src/9/port/devproc.c')
-rw-r--r--sys/src/9/port/devproc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/src/9/port/devproc.c b/sys/src/9/port/devproc.c
index 57ebebb1a..c49f5f677 100644
--- a/sys/src/9/port/devproc.c
+++ b/sys/src/9/port/devproc.c
@@ -708,6 +708,10 @@ procread(Chan *c, void *va, long n, vlong off)
Waitq *wq;
a = va;
+
+ /* sign extend 63 bit to 64 bit */
+ off <<= 1;
+ off >>= 1;
offset = off;
if(c->qid.type & QTDIR)