Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 329499 | Differences between
and this patch

Collapse All | Expand All

(-)file_not_specified_in_diff (-27 / +2 lines)
Line  Link Here
0
-- a/src/closures.c
0
++ b/src/closures.c
Lines 447-454 Link Here
447
dlmmap (void *start, size_t length, int prot,
447
dlmmap (void *start, size_t length, int prot,
448
	int flags, int fd, off_t offset)
448
	int flags, int fd, off_t offset)
449
{
449
{
450
  void *ptr;
451
452
  assert (start == NULL && length % malloc_getpagesize == 0
450
  assert (start == NULL && length % malloc_getpagesize == 0
453
	  && prot == (PROT_READ | PROT_WRITE)
451
	  && prot == (PROT_READ | PROT_WRITE)
454
	  && flags == (MAP_PRIVATE | MAP_ANONYMOUS)
452
	  && flags == (MAP_PRIVATE | MAP_ANONYMOUS)
Lines 457-486 Link Here
457
#if FFI_CLOSURE_TEST
455
#if FFI_CLOSURE_TEST
458
  printf ("mapping in %zi\n", length);
456
  printf ("mapping in %zi\n", length);
459
#endif
457
#endif
460
458
  return mmap (start, length, PROT_READ | PROT_WRITE, flags, fd, offset);
461
  if (execfd == -1 && !is_selinux_enabled ())
462
    {
463
      ptr = mmap (start, length, prot | PROT_EXEC, flags, fd, offset);
464
465
      if (ptr != MFAIL || (errno != EPERM && errno != EACCES))
466
	/* Cool, no need to mess with separate segments.  */
467
	return ptr;
468
469
      /* If MREMAP_DUP is ever introduced and implemented, try mmap
470
	 with ((prot & ~PROT_WRITE) | PROT_EXEC) and mremap with
471
	 MREMAP_DUP and prot at this point.  */
472
    }
473
474
  if (execsize == 0 || execfd == -1)
475
    {
476
      pthread_mutex_lock (&open_temp_exec_file_mutex);
477
      ptr = dlmmap_locked (start, length, prot, flags, offset);
478
      pthread_mutex_unlock (&open_temp_exec_file_mutex);
479
480
      return ptr;
481
    }
482
483
  return dlmmap_locked (start, length, prot, flags, offset);
484
}
459
}
485
460
486
/* Release memory at the given address, as well as the corresponding
461
/* Release memory at the given address, as well as the corresponding

Return to bug 329499