--- freem/src/mumps.c 2025/04/15 16:49:36 1.22 +++ freem/src/mumps.c 2025/04/16 05:33:15 1.23 @@ -1,5 +1,5 @@ /* - * $Id: mumps.c,v 1.22 2025/04/15 16:49:36 snw Exp $ + * $Id: mumps.c,v 1.23 2025/04/16 05:33:15 snw Exp $ * main module of freem * * @@ -24,6 +24,9 @@ * along with FreeM. If not, see . * * $Log: mumps.c,v $ + * 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 * Make use of logprintf throughout codebase * @@ -116,7 +119,9 @@ #include #include #include "log.h" - +#if defined(__FreeBSD__) +# include +#endif #if defined(HAVE_GETOPT_H) # include #endif @@ -192,6 +197,13 @@ int main (int argc, char **argv, char ** char cli_rtn_name[256]; char env_ena[25]; + +#if defined(__FreeBSD__) + int prcdta = PROC_ASLR_FORCE_DISABLE; + if (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 routine_mode = FALSE; strcpy (m_dialect, "FREEM");