Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:lafenghu
grub
grub-0.97-protexec.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File grub-0.97-protexec.patch of Package grub
Index: grub-0.97/grub/asmstub.c =================================================================== --- grub-0.97.orig/grub/asmstub.c +++ grub-0.97/grub/asmstub.c @@ -43,6 +43,8 @@ int grub_stage2 (void); #include <termios.h> #include <signal.h> +#include <sys/mman.h> + #ifdef __linux__ # include <sys/ioctl.h> /* ioctl */ # if !defined(__GLIBC__) || \ @@ -142,14 +144,30 @@ grub_stage2 (void) } assert (grub_scratch_mem == 0); - scratch = malloc (0x100000 + EXTENDED_MEMSIZE + 15); +#ifdef MAP_32BIT +#define MY_MAP_SET MAP_PRIVATE | MAP_GROWSDOWN | MAP_ANONYMOUS | MAP_32BIT +#else +#define MY_MAP_SET MAP_PRIVATE | MAP_GROWSDOWN | MAP_ANONYMOUS +#endif + scratch = mmap(NULL, + 0x100000 + EXTENDED_MEMSIZE + 15, + PROT_EXEC | PROT_READ | PROT_WRITE, + MY_MAP_SET, + -1, + 0); + assert (scratch); grub_scratch_mem = (char *) ((((int) scratch) >> 4) << 4); /* FIXME: simulate the memory holes using mprot, if available. */ assert (disks == 0); - disks = malloc (NUM_DISKS * sizeof (*disks)); + disks = mmap(NULL, + NUM_DISKS * sizeof (*disks), + PROT_EXEC | PROT_READ | PROT_WRITE, + MY_MAP_SET, + -1, + 0); assert (disks); /* Initialize DISKS. */ for (i = 0; i < NUM_DISKS; i++) @@ -215,9 +233,9 @@ grub_stage2 (void) /* Release memory. */ restore_device_map (device_map); device_map = 0; - free (disks); + munmap(disks, NUM_DISKS * sizeof (*disks)); disks = 0; - free (scratch); + munmap(scratch, 0x100000 + EXTENDED_MEMSIZE + 15); grub_scratch_mem = 0; if (serial_device)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor