CHROMIUM: md: dm-bootcache: reinitialize bio structure
[cascardo/linux.git] / kernel / compat.c
index d2c67aa..54a6f32 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/posix-timers.h>
 #include <linux/times.h>
 #include <linux/ptrace.h>
+#include <linux/prctl.h>
 #include <linux/gfp.h>
 
 #include <asm/uaccess.h>
@@ -1223,6 +1224,28 @@ compat_sys_sysinfo(struct compat_sysinfo __user *info)
        return 0;
 }
 
+/* Note: it is necessary to treat option as an unsigned int,
+ * with the corresponding cast to a signed int to ensure that the
+ * proper conversion (sign extension) between the register representation
+ * of a signed int (msr in 32-bit mode) and the register representation
+ * of a signed int (msr in 64-bit mode) is performed.
+ */
+asmlinkage long compat_sys_prctl(u32 option, u32 arg2, u32 arg3,
+                                u32 arg4, u32 arg5)
+{
+       unsigned long a2 = arg2;
+
+       /* PR_SET_PTRACER_ANY is -1, so can't do an unsigned extension */
+       if (option == PR_SET_PTRACER && arg2 == (u32) PR_SET_PTRACER_ANY)
+               a2 = PR_SET_PTRACER_ANY;
+
+       return sys_prctl((int)option,
+                        (unsigned long) a2,
+                        (unsigned long) arg3,
+                        (unsigned long) arg4,
+                        (unsigned long) arg5);
+}
+
 /*
  * Allocate user-space memory for the duration of a single system call,
  * in order to marshall parameters inside a compat thunk.