arch/sim: Remove executable bit from the normal heap
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
861220f649
commit
6efdd50d5a
@ -60,18 +60,18 @@ static atomic_int g_uordblks;
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void *host_allocheap(size_t sz)
|
||||
void *host_allocheap(size_t size, bool exec)
|
||||
{
|
||||
void *p;
|
||||
|
||||
#if defined(CONFIG_HOST_MACOS) && defined(CONFIG_HOST_ARM64)
|
||||
/* see: https://developer.apple.com/forums/thread/672804 */
|
||||
|
||||
p = host_uninterruptible(mmap, NULL, sz, PROT_READ | PROT_WRITE,
|
||||
p = host_uninterruptible(mmap, NULL, size, PROT_READ | PROT_WRITE,
|
||||
MAP_ANON | MAP_SHARED, -1, 0);
|
||||
#else
|
||||
p = host_uninterruptible(mmap, NULL, sz,
|
||||
PROT_READ | PROT_WRITE | PROT_EXEC,
|
||||
p = host_uninterruptible(mmap, NULL, size, PROT_READ | PROT_WRITE |
|
||||
(exec ? PROT_EXEC : 0),
|
||||
MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||
#endif
|
||||
|
||||
|
@ -475,7 +475,7 @@ void up_allocate_heap(void **heap_start, size_t *heap_size)
|
||||
* ARCH_HAVE_TEXT_HEAP mechanism can be an alternative.
|
||||
*/
|
||||
|
||||
uint8_t *sim_heap = host_allocheap(SIM_HEAP_SIZE);
|
||||
uint8_t *sim_heap = host_allocheap(SIM_HEAP_SIZE, false);
|
||||
|
||||
*heap_start = sim_heap;
|
||||
*heap_size = SIM_HEAP_SIZE;
|
||||
|
@ -216,7 +216,7 @@ int host_waitpid(pid_t pid);
|
||||
|
||||
/* sim_hostmemory.c *********************************************************/
|
||||
|
||||
void *host_allocheap(size_t sz);
|
||||
void *host_allocheap(size_t sz, bool exec);
|
||||
void host_freeheap(void *mem);
|
||||
void *host_allocshmem(const char *name, size_t size, int master);
|
||||
void host_freeshmem(void *mem);
|
||||
|
@ -49,7 +49,8 @@ void *up_textheap_memalign(size_t align, size_t size)
|
||||
{
|
||||
if (g_textheap == NULL)
|
||||
{
|
||||
g_textheap = mm_initialize("textheap", host_allocheap(SIM_HEAP_SIZE),
|
||||
g_textheap = mm_initialize("textheap",
|
||||
host_allocheap(SIM_HEAP_SIZE, true),
|
||||
SIM_HEAP_SIZE);
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void *host_allocheap(size_t sz)
|
||||
void *host_allocheap(size_t sz, bool exec)
|
||||
{
|
||||
return _aligned_malloc(sz, 8);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user