aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/sys_sparc_64.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc/kernel/sys_sparc_64.c')
-rw-r--r--arch/sparc/kernel/sys_sparc_64.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index f836f4e93afe..908b47a5ee24 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -360,20 +360,25 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u
360} 360}
361EXPORT_SYMBOL(get_fb_unmapped_area); 361EXPORT_SYMBOL(get_fb_unmapped_area);
362 362
363/* Essentially the same as PowerPC... */ 363/* Essentially the same as PowerPC. */
364void arch_pick_mmap_layout(struct mm_struct *mm) 364static unsigned long mmap_rnd(void)
365{ 365{
366 unsigned long random_factor = 0UL; 366 unsigned long rnd = 0UL;
367 unsigned long gap;
368 367
369 if (current->flags & PF_RANDOMIZE) { 368 if (current->flags & PF_RANDOMIZE) {
370 random_factor = get_random_int(); 369 unsigned long val = get_random_int();
371 if (test_thread_flag(TIF_32BIT)) 370 if (test_thread_flag(TIF_32BIT))
372 random_factor &= ((1 * 1024 * 1024) - 1); 371 rnd = (val % (1UL << (22UL-PAGE_SHIFT)));
373 else 372 else
374 random_factor = ((random_factor << PAGE_SHIFT) & 373 rnd = (val % (1UL << (29UL-PAGE_SHIFT)));
375 0xffffffffUL);
376 } 374 }
375 return (rnd << PAGE_SHIFT) * 2;
376}
377
378void arch_pick_mmap_layout(struct mm_struct *mm)
379{
380 unsigned long random_factor = mmap_rnd();
381 unsigned long gap;
377 382
378 /* 383 /*
379 * Fall back to the standard layout if the personality 384 * Fall back to the standard layout if the personality
@@ -455,7 +460,7 @@ SYSCALL_DEFINE6(sparc_ipc, unsigned int, call, int, first, unsigned long, second
455 default: 460 default:
456 err = -ENOSYS; 461 err = -ENOSYS;
457 goto out; 462 goto out;
458 }; 463 }
459 } 464 }
460 if (call <= MSGCTL) { 465 if (call <= MSGCTL) {
461 switch (call) { 466 switch (call) {
@@ -476,7 +481,7 @@ SYSCALL_DEFINE6(sparc_ipc, unsigned int, call, int, first, unsigned long, second
476 default: 481 default:
477 err = -ENOSYS; 482 err = -ENOSYS;
478 goto out; 483 goto out;
479 }; 484 }
480 } 485 }
481 if (call <= SHMCTL) { 486 if (call <= SHMCTL) {
482 switch (call) { 487 switch (call) {
@@ -502,7 +507,7 @@ SYSCALL_DEFINE6(sparc_ipc, unsigned int, call, int, first, unsigned long, second
502 default: 507 default:
503 err = -ENOSYS; 508 err = -ENOSYS;
504 goto out; 509 goto out;
505 }; 510 }
506 } else { 511 } else {
507 err = -ENOSYS; 512 err = -ENOSYS;
508 } 513 }