Re: [RFC PATCH 1/1] MIPS: Enable VDSO randomization.

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

 



Hello.

On 19-04-2014 13:33, Prem Karat wrote:

Based on commit 1091458d09e1a (mmap randomization)

For 32-bit address spaces randomize within a
16MB space, for 64-bit within a 256MB space.

Signed-off-by: Prem Karat <pkarat@xxxxxxxxxx>
[...]

@@ -67,7 +69,18 @@ subsys_initcall(init_vdso);

  static unsigned long vdso_addr(unsigned long start)
  {
-	return STACK_TOP;
+	unsigned long offset = 0UL;
+
+	if (current->flags & PF_RANDOMIZE) {
+		offset = get_random_int();
+		offset = offset << PAGE_SHIFT;

   Why not:

		offset <<= PAGE_SHIFT;

+		if (TASK_IS_32BIT_ADDR)
+			offset &= 0xfffffful;
+		else
+			offset &= 0xffffffful;
+	}
+
+	return (STACK_TOP + offset);

   Parens not needed.

WBR, Sergei



[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux