version 1.22, 2025/04/15 16:49:36
|
version 1.24, 2025/04/16 05:37:06
|
Line 24
|
Line 24
|
* along with FreeM. If not, see <https://www.gnu.org/licenses/>. |
* along with FreeM. If not, see <https://www.gnu.org/licenses/>. |
* |
* |
* $Log$ |
* $Log$ |
|
* Revision 1.24 2025/04/16 05:37:06 snw |
|
* Refine FreeBSD ASLR fix |
|
* |
|
* Revision 1.23 2025/04/16 05:33:15 snw |
|
* Try to use procctl function to fix ASLR problem on FreeBSD |
|
* |
* Revision 1.22 2025/04/15 16:49:36 snw |
* Revision 1.22 2025/04/15 16:49:36 snw |
* Make use of logprintf throughout codebase |
* Make use of logprintf throughout codebase |
* |
* |
Line 116
|
Line 122
|
#include <pwd.h> |
#include <pwd.h> |
#include <grp.h> |
#include <grp.h> |
#include "log.h" |
#include "log.h" |
|
#if defined(__FreeBSD__) |
|
# include <sys/procctl.h> |
|
#endif |
#if defined(HAVE_GETOPT_H) |
#if defined(HAVE_GETOPT_H) |
# include <getopt.h> |
# include <getopt.h> |
#endif |
#endif |
Line 210 int main (int argc, char **argv, char **
|
Line 218 int main (int argc, char **argv, char **
|
strcpy (stack0, argv[0]); |
strcpy (stack0, argv[0]); |
stcnv_c2m (stack0); |
stcnv_c2m (stack0); |
|
|
|
#if defined(__FreeBSD__) |
|
int prcdta = PROC_ASLR_FORCE_DISABLE; |
|
#endif |
|
|
/* strncpy (config_file, SYSCONFDIR"/freem.conf", 100); */ |
/* strncpy (config_file, SYSCONFDIR"/freem.conf", 100); */ |
|
|
Line 751 int main (int argc, char **argv, char **
|
Line 762 int main (int argc, char **argv, char **
|
} |
} |
} |
} |
|
|
|
#if defined(__FreeBSD__) |
|
if ((first_process == FALSE) && (procctl (P_PID, getpid (), PROC_ASLR_CTL, &prcdta) == -1)) { |
|
fprintf (stderr, "freem: could not disable address space layout randomization for pid %ld; program operation may be unreliable [error %s]\n", getpid(), strerror (errno)); |
|
} |
|
#endif |
|
|
|
|
if (first_process == TRUE) { |
if (first_process == TRUE) { |
|
|
char verstr[500]; |
char verstr[500]; |