Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

IOCTL_PRIVCMD_GET_MACH2PHYS_START_MFN is a read, not a write. (save/restore, part 2)



This is one of those one-character changes that I find myself making
surprisingly often:

Index: sys/arch/xen/include/xenio.h
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/include/xenio.h,v
retrieving revision 1.2.2.1
diff -u -p -r1.2.2.1 xenio.h
--- sys/arch/xen/include/xenio.h        28 May 2005 13:52:41 -0000      1.2.2.1
+++ sys/arch/xen/include/xenio.h        8 Sep 2005 01:20:44 -0000
@@ -83,7 +83,7 @@ typedef struct privcmd_blkmsg
 #define IOCTL_PRIVCMD_MMAPBATCH        \
     _IOW('P', 3, privcmd_mmapbatch_t)
 #define IOCTL_PRIVCMD_GET_MACH2PHYS_START_MFN \
-    _IOW('P', 4, unsigned long)
+    _IOR('P', 4, unsigned long)
 
 /*
  * @cmd: IOCTL_PRIVCMD_INITDOMAIN_EVTCHN

The purpose of that ioctl is to get an unsigned long from the kernel,
not to send one in; a look at the ~1 line of code implementing it in
privcmd.c will confirm this.  I have not attempted to provide binary
compatibility because it's completely broken the way it is: the
copyout won't happen because the read flag isn't set in the ioctl
selector, so the user process will get whatever uninitialized value
was in the memory before, which completely defeats the purpose.

This also affects pkgsrc, which has a copy of xenio.h; but this isn't
terribly useful without two very minor changes to xentools's libxc,
which I'll be sending mail about shortly.

-- 
(let ((C call-with-current-continuation)) (apply (lambda (x y) (x y)) (map
((lambda (r) ((C C) (lambda (s) (r (lambda l (apply (s s) l))))))  (lambda
(f) (lambda (l) (if (null? l) C (lambda (k) (display (car l)) ((f (cdr l))
(C k)))))))    '((#\J #\d #\D #\v #\s) (#\e #\space #\a #\i #\newline)))))




Home | Main Index | Thread Index | Old Index