Arjan van de Ven
9f0cf4adb6
x86: Use __builtin_object_size() to validate the buffer size for copy_from_user()
...
gcc (4.x) supports the __builtin_object_size() builtin, which
reports the size of an object that a pointer point to, when known
at compile time. If the buffer size is not known at compile time, a
constant -1 is returned.
This patch uses this feature to add a sanity check to
copy_from_user(); if the target buffer is known to be smaller than
the copy size, the copy is aborted and a WARNing is emitted in
memory debug mode.
These extra checks compile away when the object size is not known,
or if both the buffer size and the copy length are constants.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com >
LKML-Reference: <20090926143301.2c396b94@infradead.org >
Signed-off-by: Ingo Molnar <mingo@elte.hu >
2009-09-26 16:25:41 +02:00
..
2009-09-12 11:51:14 +01:00
2009-09-04 02:16:14 -07:00
2009-08-07 10:39:56 -07:00
2009-09-19 00:51:34 -03:00
2009-09-17 09:47:22 +02:00
2009-08-27 22:05:39 -07:00
2009-09-22 07:54:33 -07:00
2009-09-23 10:11:08 -07:00
2009-09-23 07:39:38 -07:00
2009-09-20 05:55:36 -07:00
2009-08-25 16:07:58 +02:00
2009-08-24 14:56:30 +02:00
2009-08-24 14:56:30 +02:00
2009-08-24 14:56:30 +02:00
2009-08-24 14:56:30 +02:00
2009-09-23 07:39:29 -07:00
2009-09-22 13:32:45 +01:00
2009-09-23 07:39:46 -07:00
2009-09-09 11:19:00 -04:00
2009-09-15 20:49:33 -04:00
2009-09-23 06:46:38 -07:00
2009-09-19 02:14:45 -04:00
2009-09-20 16:09:20 +05:30
2009-09-23 07:39:29 -07:00
2009-09-01 01:14:07 -07:00
2009-09-01 19:47:20 -04:00
2009-09-15 09:50:47 -07:00
2009-09-16 15:18:52 +02:00
2009-09-05 11:30:42 -07:00
2009-09-11 14:33:31 +02:00
2009-08-21 09:26:15 -07:00
2009-09-11 14:33:32 +02:00
2009-09-14 08:24:53 +02:00
2009-09-22 07:17:38 -07:00
2009-09-21 15:14:51 +02:00
2009-08-28 20:25:24 +02:00
2009-09-23 07:39:29 -07:00
2009-09-26 16:25:41 +02:00
2009-09-26 16:25:41 +02:00
2009-08-15 19:02:07 +02:00
2009-09-01 12:45:14 -04:00
2009-09-23 07:39:28 -07:00
2009-09-14 12:34:07 +10:00
2009-09-19 13:13:31 -07:00
2009-09-01 01:24:30 -07:00
2009-09-18 09:48:52 -07:00
2009-09-04 20:40:25 +01:00
2009-09-19 12:50:38 -07:00
2009-09-04 20:40:34 +01:00
2009-08-28 14:24:10 +10:00
2009-09-08 21:17:48 -04:00
2009-09-14 17:41:42 -07:00
2009-08-22 17:52:13 -05:00
2009-09-02 23:07:39 -07:00
2009-09-23 07:39:29 -07:00
2009-09-12 14:48:40 +02:00
2009-09-22 07:17:47 -07:00
2009-09-22 07:17:25 -07:00
2009-09-18 07:25:44 +02:00
2009-09-20 16:58:35 +05:30
2009-08-17 21:33:49 -07:00
2009-09-22 07:17:25 -07:00
2009-09-23 07:39:29 -07:00
2009-08-25 13:44:04 +01:00
2009-09-23 07:39:46 -07:00
2009-09-11 13:23:18 -07:00
2009-09-19 13:13:31 -07:00
2009-09-01 01:13:31 -07:00
2009-09-17 15:15:11 +02:00
2009-08-14 15:59:30 +02:00
2009-09-22 07:17:42 -07:00
2009-09-19 00:16:14 -03:00
2009-09-18 22:45:43 +02:00
2009-08-12 22:13:15 -07:00
2009-09-01 17:52:57 -07:00
2009-08-28 14:40:24 -04:00
2009-09-11 12:54:58 -07:00
2009-08-19 23:08:24 +04:00
2009-09-07 01:56:33 -07:00
2009-09-15 02:37:40 -07:00
2009-09-21 14:28:04 +02:00
2009-08-21 15:30:12 -07:00
2009-09-11 16:40:10 +01:00
2009-09-14 17:55:15 -07:00
2009-08-26 15:41:16 -07:00
2009-09-23 07:39:41 -07:00
2009-09-11 13:21:31 -07:00
2009-08-29 15:53:00 +02:00
2009-08-17 22:38:04 -04:00
2009-09-23 07:39:58 -07:00
2009-09-10 10:46:47 +03:00
2009-09-23 07:39:30 -07:00
2009-09-02 21:29:22 +10:00
2009-09-02 21:29:22 +10:00
2009-09-19 13:13:17 -07:00
2009-09-23 07:39:29 -07:00
2009-08-27 14:29:16 +01:00
2009-09-15 23:51:31 -04:00
2009-09-22 07:17:33 -07:00
2009-09-18 21:22:08 +02:00
2009-09-10 08:33:20 +03:00
2009-09-10 08:33:16 +03:00
2009-09-01 19:47:20 -04:00
2009-08-19 21:46:09 -07:00
2009-09-22 07:17:48 -07:00
2009-08-31 17:30:14 -10:00
2009-08-17 08:37:18 +10:00
2009-09-23 07:39:42 -07:00
2009-08-18 20:13:03 -07:00
2009-09-23 07:39:41 -07:00
2009-09-22 07:17:35 -07:00
2009-09-19 12:50:38 -07:00
2009-09-21 15:14:56 +02:00
2009-09-22 07:17:37 -07:00
2009-08-18 16:31:13 -07:00
2009-09-23 07:39:42 -07:00
2009-09-22 07:17:42 -07:00
2009-09-22 07:17:31 -07:00
2009-09-22 07:17:39 -07:00
2009-09-23 07:39:43 -07:00
2009-09-18 21:22:08 +02:00
2009-09-21 15:14:51 +02:00
2009-09-15 02:39:20 -07:00
2009-09-17 20:53:52 -07:00
2009-09-14 17:02:50 -07:00
2009-09-22 07:54:33 -07:00
2009-08-09 15:06:19 -04:00
2009-08-12 08:21:39 -07:00
2009-08-14 09:13:43 -04:00
2009-08-19 23:08:22 +04:00
2009-08-07 10:39:55 -07:00
2009-09-15 02:37:40 -07:00
2009-09-22 07:17:38 -07:00
2009-09-20 16:57:50 +05:30
2009-09-22 07:17:38 -07:00
2009-08-22 13:07:09 +02:00
2009-09-14 17:39:12 -07:00
2009-09-18 22:45:50 +02:00
2009-09-15 09:50:48 -07:00
2009-09-09 14:19:11 -07:00
2009-09-15 09:39:44 -07:00
2009-08-14 15:00:53 +09:00
2009-09-21 14:34:11 +02:00
2009-09-21 14:34:11 +02:00
2009-09-11 12:55:10 -07:00
2009-08-23 00:04:44 +02:00
2009-09-14 20:27:00 +02:00
2009-09-22 07:17:49 -07:00
2009-09-22 07:17:47 -07:00
2009-09-21 14:28:04 +02:00
2009-09-23 07:39:41 -07:00
2009-09-22 07:17:24 -07:00
2009-09-19 08:53:22 +02:00
2009-09-19 08:53:22 +02:00
2009-09-19 08:53:22 +02:00
2009-08-23 19:13:02 -07:00
2009-09-01 12:48:21 -04:00
2009-09-04 19:42:22 -04:00
2009-09-22 07:17:31 -07:00
2009-09-09 03:42:23 -07:00
2009-09-15 02:44:17 -07:00
2009-09-23 09:46:15 -07:00
2009-09-10 10:11:24 +10:00
2009-09-15 11:37:33 +10:00
2009-09-19 13:13:19 -07:00
2009-09-23 11:24:57 -07:00
2009-09-19 13:13:30 -07:00
2009-08-28 19:57:33 -04:00
2009-08-28 19:57:30 -04:00
2009-08-24 19:52:38 +09:00
2009-09-15 09:50:49 -07:00
2009-09-14 20:19:06 +03:00
2009-08-31 18:08:51 +02:00
2009-08-31 18:08:51 +02:00
2009-09-22 07:17:25 -07:00
2009-09-23 09:21:05 -07:00
2009-09-18 09:48:52 -07:00
2009-09-01 18:25:07 -07:00
2009-09-02 01:03:43 -07:00
2009-09-15 10:17:30 +02:00
2009-08-30 22:26:34 +02:00
2009-09-16 16:44:33 +02:00
2009-08-26 08:29:02 +02:00
2009-09-15 09:50:47 -07:00
2009-09-19 13:13:35 -07:00
2009-09-23 07:39:48 -07:00
2009-09-23 06:46:23 -07:00
2009-09-23 06:46:39 -07:00
2009-08-26 12:39:29 +01:00
2009-09-23 09:52:18 +10:00
2009-09-19 00:18:36 -03:00
2009-09-23 22:26:32 +09:30
2009-09-23 22:26:32 +09:30
2009-09-23 22:26:36 +09:30
2009-09-23 07:39:29 -07:00
2009-09-23 22:26:32 +09:30
2009-09-23 22:26:32 +09:30
2009-09-23 22:26:32 +09:30
2009-09-23 22:26:32 +09:30
2009-09-23 22:26:31 +09:30
2009-08-14 15:00:52 +09:00
2009-09-22 07:17:30 -07:00
2009-09-19 13:13:25 -07:00
2009-09-19 13:13:26 -07:00
2009-09-15 16:51:30 +02:00
2009-09-04 20:20:58 +04:00
2009-09-23 03:49:27 +04:00
2009-09-21 15:14:53 +02:00
2009-09-16 15:18:52 +02:00
2009-09-10 10:11:22 +10:00