mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-11 00:06:19 +00:00
Implements r_sys_aslr for NetBSD ##port (#17588)
ASLR on NetBSD is also settable via sysctl call.
This commit is contained in:
parent
52d5b867aa
commit
15e73666b2
@ -278,7 +278,7 @@ static void setASLR(RRunProfile *r, int enabled) {
|
||||
// for osxver>=10.7
|
||||
// "unset the MH_PIE bit in an already linked executable" with --no-pie flag of the script
|
||||
// the right way is to disable the aslr bit in the spawn call
|
||||
#elif __FreeBSD__
|
||||
#elif __FreeBSD__ || __NetBSD__
|
||||
r_sys_aslr (enabled);
|
||||
#else
|
||||
// not supported for this platform
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <string.h>
|
||||
#if defined(__NetBSD__)
|
||||
# include <sys/param.h>
|
||||
# include <sys/sysctl.h>
|
||||
# if __NetBSD_Prereq__(7,0,0)
|
||||
# define NETBSD_WITH_BACKTRACE
|
||||
# endif
|
||||
@ -553,6 +554,12 @@ R_API bool r_sys_aslr(int val) {
|
||||
ret = false;
|
||||
}
|
||||
#endif
|
||||
#elif __NetBSD__
|
||||
size_t vlen = sizeof (val);
|
||||
if (sysctlbyname ("security.pax.aslr.enabled", NULL, 0, &val, vlen) == -1) {
|
||||
eprintf ("Failed to set RVA\n");
|
||||
ret = false;
|
||||
}
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user