kernel-hardening.lists.openwall.com archive mirror
 help / color / mirror / Atom feed
* [kernel-hardening] [PATCH 1/3] fix LIST_POISON{1,2} offset
@ 2015-07-26 13:43 Vasily Kulikov
  2015-07-26 13:45 ` [kernel-hardening] [PATCH 2/3] use POISON_POINTER_DELTA for poison pointers Vasily Kulikov
  0 siblings, 1 reply; 4+ messages in thread
From: Vasily Kulikov @ 2015-07-26 13:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Randy Dunlap, Andrew Morton, kernel-hardening, Ingo Molnar

Poison pointer values should be small enough to find a room in
non-mmap'able/hardly-mmap'able space.  E.g. on x86 "poison pointer
space" is located starting from 0x0.  Given unprivileged users cannot
mmap anything below mmap_min_addr, it should be safe to use poison
pointers lower than mmap_min_addr.

The current poison pointer values of LIST_POISON{1,2} might be
too big for mmap_min_addr values equal or less than 1 MB (common case,
e.g. Ubuntu uses only 0x10000).  There is little point to use such a big
value given the "poison pointer space" below 1 MB is not yet exhausted.
Changing it to a smaller value solves the problem for small
mmap_min_addr setups.

The values are suggested by Solar Designer:
http://www.openwall.com/lists/oss-security/2015/05/02/6

Signed-off-by: Vasily Kulikov <segoon@openwall.com> 
---
 include/linux/poison.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/poison.h b/include/linux/poison.h
index 7b2a7fc..ee697b9 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -19,8 +19,8 @@
  * under normal circumstances, used to verify that nobody uses
  * non-initialized list entries.
  */
-#define LIST_POISON1  ((void *) 0x00100100 + POISON_POINTER_DELTA)
-#define LIST_POISON2  ((void *) 0x00200200 + POISON_POINTER_DELTA)
+#define LIST_POISON1  ((void *) 0x100 + POISON_POINTER_DELTA)
+#define LIST_POISON2  ((void *) 0x200 + POISON_POINTER_DELTA)
 
 /********** include/linux/timer.h **********/
 /*
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [kernel-hardening] [PATCH 2/3] use POISON_POINTER_DELTA for poison pointers
  2015-07-26 13:43 [kernel-hardening] [PATCH 1/3] fix LIST_POISON{1,2} offset Vasily Kulikov
@ 2015-07-26 13:45 ` Vasily Kulikov
  2015-07-26 13:46   ` [kernel-hardening] [PATCH 3/3] remove not-used poison pointer macros Vasily Kulikov
  2015-07-26 18:42   ` [kernel-hardening] Re: [PATCH 2/3] use POISON_POINTER_DELTA for poison pointers Thomas Gleixner
  0 siblings, 2 replies; 4+ messages in thread
From: Vasily Kulikov @ 2015-07-26 13:45 UTC (permalink / raw)
  To: linux-kernel
  Cc: Randy Dunlap, Andrew Morton, kernel-hardening, Thomas Gleixner,
	Kirill A. Shutemov

TIMER_ENTRY_STATIC and TAIL_MAPPING are defined as poison pointers which
should point to nowhere.  Redefine them using POISON_POINTER_DELTA arithmetics
to make sure they really point to non-mappable area declared by the
target architecture.

Signed-off-by: Vasily Kulikov <segoon@openwall.com> 
---
 include/linux/poison.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/poison.h b/include/linux/poison.h
index ee697b9..a721bcd 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -27,14 +27,14 @@
  * Magic number "tsta" to indicate a static timer initializer
  * for the object debugging code.
  */
-#define TIMER_ENTRY_STATIC	((void *) 0x74737461)
+#define TIMER_ENTRY_STATIC	((void *) 0x300 + POISON_POINTER_DELTA)
 
 /********** mm/debug-pagealloc.c **********/
 #define PAGE_POISON 0xaa
 
 /********** mm/page_alloc.c ************/
 
-#define TAIL_MAPPING	((void *) 0x01014A11 + POISON_POINTER_DELTA)
+#define TAIL_MAPPING	((void *) 0x400 + POISON_POINTER_DELTA)
 
 /********** mm/slab.c **********/
 /*
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [kernel-hardening] [PATCH 3/3] remove not-used poison pointer macros
  2015-07-26 13:45 ` [kernel-hardening] [PATCH 2/3] use POISON_POINTER_DELTA for poison pointers Vasily Kulikov
@ 2015-07-26 13:46   ` Vasily Kulikov
  2015-07-26 18:42   ` [kernel-hardening] Re: [PATCH 2/3] use POISON_POINTER_DELTA for poison pointers Thomas Gleixner
  1 sibling, 0 replies; 4+ messages in thread
From: Vasily Kulikov @ 2015-07-26 13:46 UTC (permalink / raw)
  To: linux-kernel; +Cc: Randy Dunlap, Andrew Morton, kernel-hardening

Signed-off-by: Vasily Kulikov <segoon@openwall.com> 
---
 include/linux/poison.h | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/include/linux/poison.h b/include/linux/poison.h
index a721bcd..4a27153 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -73,10 +73,6 @@
 #define ATM_POISON_FREE		0x12
 #define ATM_POISON		0xdeadbeef
 
-/********** net/ **********/
-#define NEIGHBOR_DEAD		0xdeadbeef
-#define NETFILTER_LINK_POISON	0xdead57ac
-
 /********** kernel/mutexes **********/
 #define MUTEX_DEBUG_INIT	0x11
 #define MUTEX_DEBUG_FREE	0x22
@@ -87,7 +83,4 @@
 /********** security/ **********/
 #define KEY_DESTROY		0xbd
 
-/********** sound/oss/ **********/
-#define OSS_POISON_FREE		0xAB
-
 #endif
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [kernel-hardening] Re: [PATCH 2/3] use POISON_POINTER_DELTA for poison pointers
  2015-07-26 13:45 ` [kernel-hardening] [PATCH 2/3] use POISON_POINTER_DELTA for poison pointers Vasily Kulikov
  2015-07-26 13:46   ` [kernel-hardening] [PATCH 3/3] remove not-used poison pointer macros Vasily Kulikov
@ 2015-07-26 18:42   ` Thomas Gleixner
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2015-07-26 18:42 UTC (permalink / raw)
  To: Vasily Kulikov
  Cc: linux-kernel, Randy Dunlap, Andrew Morton, kernel-hardening,
	Kirill A. Shutemov

On Sun, 26 Jul 2015, Vasily Kulikov wrote:
> TIMER_ENTRY_STATIC and TAIL_MAPPING are defined as poison pointers which
> should point to nowhere.  Redefine them using POISON_POINTER_DELTA arithmetics
> to make sure they really point to non-mappable area declared by the
> target architecture.
> 
> Signed-off-by: Vasily Kulikov <segoon@openwall.com> 
> ---
>  include/linux/poison.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/poison.h b/include/linux/poison.h
> index ee697b9..a721bcd 100644
> --- a/include/linux/poison.h
> +++ b/include/linux/poison.h
> @@ -27,14 +27,14 @@
>   * Magic number "tsta" to indicate a static timer initializer
>   * for the object debugging code.
>   */
> -#define TIMER_ENTRY_STATIC	((void *) 0x74737461)
> +#define TIMER_ENTRY_STATIC	((void *) 0x300 + POISON_POINTER_DELTA)

Acked-by: Thomas Gleixner <tglx@linutronix.de>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-07-26 18:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-26 13:43 [kernel-hardening] [PATCH 1/3] fix LIST_POISON{1,2} offset Vasily Kulikov
2015-07-26 13:45 ` [kernel-hardening] [PATCH 2/3] use POISON_POINTER_DELTA for poison pointers Vasily Kulikov
2015-07-26 13:46   ` [kernel-hardening] [PATCH 3/3] remove not-used poison pointer macros Vasily Kulikov
2015-07-26 18:42   ` [kernel-hardening] Re: [PATCH 2/3] use POISON_POINTER_DELTA for poison pointers Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).