From: Manfred Spraul <manfred@colorfullife.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] fix put_user for 80386
Date: Sat, 12 Mar 2005 17:55:57 +0100 [thread overview]
Message-ID: <42331F1D.6090202@colorfullife.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 474 bytes --]
Hi,
Linus noticed that put_user doesn't to the manual page table lookup that
is required for cpus without a working WP flag. The solution is simple:
if CONFIG_X86_WP_WORKS_OK is not set, then the put_user macros must call
__copy_to_user_ll(). That function contains the required checks.
This is already implemented for __put_user_size(), somehow I overlooked
__put_user_{1,2,4,8,X}.
What do you think?
Patch against 2.6.11-mm2, test booted with bochs.
--
Manfred
[-- Attachment #2: patch-uaccess-80386 --]
[-- Type: text/plain, Size: 796 bytes --]
--- 2.6/include/asm-i386/uaccess.h 2005-03-12 01:05:49.000000000 +0100
+++ build-2.6/include/asm-i386/uaccess.h 2005-03-12 17:37:27.938115959 +0100
@@ -217,6 +217,8 @@
*
* Returns zero on success, or -EFAULT on error.
*/
+#ifdef CONFIG_X86_WP_WORKS_OK
+
#define put_user(x,ptr) \
({ int __ret_pu; \
__chk_user_ptr(ptr); \
@@ -230,6 +232,21 @@
__ret_pu; \
})
+#else
+#define put_user(x,ptr) \
+({ \
+ int __ret_pu; \
+ __typeof__(*(ptr)) __pus_tmp = x; \
+ __ret_pu=0; \
+ if(unlikely(__copy_to_user_ll(ptr, &__pus_tmp, \
+ sizeof(*(ptr))) != 0)) \
+ __ret_pu=-EFAULT; \
+ __ret_pu; \
+ })
+
+
+#endif
+
/**
* __get_user: - Get a simple variable from user space, with less checking.
* @x: Variable to store result.
reply other threads:[~2005-03-12 16:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42331F1D.6090202@colorfullife.com \
--to=manfred@colorfullife.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox