libroot: make all areas executable for old binaries

* If at least one image is either B_HAIKU_ABI_GCC_2_ANCIENT or
   B_HAIKU_ABI_GCC_2_BEOS almost all areas are marked as executable.
 * B_EXECUTE_AREA and B_STACK_AREA are made public. The former is enforced since
   the introduction of DEP and apps need it to correctly set area protection.
   The latter is currently needed only to recognize stack areas and fix their
   protection in compatibility mode, but may also be useful if an app wants
   to use sigaltstack from POSIX API.
This commit is contained in:
Pawel Dziepak
2013-05-15 00:06:39 +02:00
parent 37848383ca
commit 5d0a1da8bf
13 changed files with 99 additions and 21 deletions
+5
View File
@@ -85,6 +85,11 @@ typedef struct area_info {
/* area protection */
#define B_READ_AREA 1
#define B_WRITE_AREA 2
#define B_EXECUTE_AREA 4
#define B_STACK_AREA 8
// "stack" protection is not available on most platforms - it's used
// to only commit memory as needed, and have guard pages at the
// bottom of the stack.
extern area_id create_area(const char *name, void **startAddress,
uint32 addressSpec, size_t size, uint32 lock,
+5 -1
View File
@@ -18,6 +18,8 @@ struct real_time_data;
extern "C" {
#endif
extern int __gCompatibilityMode;
extern char _single_threaded;
/* This determines if a process runs single threaded or not */
@@ -31,7 +33,7 @@ status_t __flatten_process_args(const char* const* args, int32 argCount,
size_t* _flatSize);
void _call_atexit_hooks_for_range(addr_t start, addr_t size);
void __init_env(const struct user_space_program_args *args);
void __init_heap(void);
status_t __init_heap(void);
void __init_heap_post_env(void);
void __init_time(addr_t commPageTable);
@@ -42,6 +44,8 @@ void __init_pwd_backend(void);
void __reinit_pwd_backend_after_fork(void);
void* __arch_get_caller(void);
void __set_stack_protection(void);
#ifdef __cplusplus
}
@@ -52,6 +52,7 @@ struct rld_export {
const struct user_space_program_args *program_args;
const void* commpage_address;
int abi_version;
};
extern struct rld_export *__gRuntimeLoader;
-7
View File
@@ -15,13 +15,6 @@
// Note: the VM probably won't support all combinations - it will try
// its best, but create_area() will fail if it has to.
// Of course, the exact behaviour will be documented somewhere...
#define B_EXECUTE_AREA 0x04
#define B_STACK_AREA 0x08
// "stack" protection is not available on most platforms - it's used
// to only commit memory as needed, and have guard pages at the
// bottom of the stack.
// "execute" protection is currently ignored, but nevertheless, you
// should use it if you require to execute code in that area.
#define B_KERNEL_EXECUTE_AREA 0x40
#define B_KERNEL_STACK_AREA 0x80