From: Camm Maguire Date: Thu, 11 Aug 2022 17:16:42 +0000 (+0100) Subject: X-Git-Tag: archive/raspbian/2.7.1-4+rpi1~1^2~1^2~116 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=4bf9ac8630471f02e05edc09150202fca959b34b;p=gcl27.git TODO: Put a short summary on the line above and replace this paragraph with a longer explanation of this change. Complete the meta-information with other relevant fields (see below for details). To make it easier, the information below has been extracted from the changelog. Adjust it or drop it. gcl (2.6.12-21) unstable; urgency=medium * Version_2_6_13pre26 Gbp-Pq: Name Version_2_6_13pre27 --- diff --git a/h/att_ext.h b/h/att_ext.h index e241b7c..8c8f393 100755 --- a/h/att_ext.h +++ b/h/att_ext.h @@ -217,6 +217,10 @@ frame_ptr frs_sch_catch(); /* gbc.c */ EXTER bool GBC_enable; +#ifdef CAN_UNRANDOMIZE_SBRK +EXTER bool gcl_unrandomized; +#endif + /* let.c */ /* lex.c */ diff --git a/h/gnuwin95.h b/h/gnuwin95.h index 10d7514..a4b9c71 100755 --- a/h/gnuwin95.h +++ b/h/gnuwin95.h @@ -7,15 +7,6 @@ #define DBEGIN_TY unsigned long extern DBEGIN_TY _dbegin; - - -/* define if there is no _cleanup, do here what needs - to be done before calling unexec - */ -#define CLEANUP_CODE \ - setbuf(stdin,0); \ - setbuf(stdout,0); - /* size to use for mallocs done */ /* #define BABY_MALLOC_SIZE 0x5000 */ diff --git a/h/linux.h b/h/linux.h index 169af5e..04f62b7 100644 --- a/h/linux.h +++ b/h/linux.h @@ -130,10 +130,6 @@ do { int c = 0; \ #define SET_SESSION_ID() (setpgrp() ? -1 : 0) -#define CLEANUP_CODE \ - setbuf(stdin,0); \ - setbuf(stdout,0); - #include #include #define GET_FULL_PATH_SELF(a_) do {\ diff --git a/h/mingw.h b/h/mingw.h index e9ac954..065fdf4 100755 --- a/h/mingw.h +++ b/h/mingw.h @@ -47,13 +47,6 @@ #define DBEGIN_TY unsigned int extern DBEGIN_TY _stacktop, _stackbottom, _dbegin; -/* define if there is no _cleanup, do here what needs - to be done before calling unexec - */ -#define CLEANUP_CODE \ - setbuf(stdin,0); \ - setbuf(stdout,0); - #define NO_SYS_PARAM_H #define NO_SYS_TIMES_H diff --git a/o/alloc.c b/o/alloc.c index 154043f..daad17f 100644 --- a/o/alloc.c +++ b/o/alloc.c @@ -1796,6 +1796,10 @@ malloc(size_t size) { if (!gcl_alloc_initialized) gcl_init_alloc(&size); +#ifdef CAN_UNRANDOMIZE_SBRK + else if (!gcl_unrandomized) + return sbrk(size); +#endif CHECK_INTERRUPT; diff --git a/o/main.c b/o/main.c index 5cd142e..dc10a68 100755 --- a/o/main.c +++ b/o/main.c @@ -412,16 +412,18 @@ DEFVAR("*CODE-BLOCK-RESERVE*",sSAcode_block_reserveA,SI,Cnil,""); #define HAVE_GCL_CLEANUP +#ifdef CAN_UNRANDOMIZE_SBRK +bool gcl_unrandomized=FALSE; +#endif + void gcl_cleanup(int gc) { if (getenv("GCL_WAIT")) sleep(30); -#ifdef CLEANUP_CODE - CLEANUP_CODE -#elif defined(USE_CLEANUP) - {extern void _cleanup(void);_cleanup();} +#if defined(USE_CLEANUP) + {extern void _cleanup(void);_cleanup();} #endif #ifdef GCL_GPROF @@ -440,6 +442,10 @@ gcl_cleanup(int gc) { cs_org=0; initial_sbrk=core_end; +#ifdef CAN_UNRANDOMIZE_SBRK + gcl_unrandomized=FALSE; +#endif + } close_pool(); @@ -450,6 +456,13 @@ gcl_cleanup(int gc) { int main(int argc, char **argv, char **envp) { +#ifdef CAN_UNRANDOMIZE_SBRK +#include +#include +#include "unrandomize.h" + gcl_unrandomized=TRUE; +#endif + gcl_init_alloc(&argv); #ifdef GET_FULL_PATH_SELF @@ -465,12 +478,6 @@ main(int argc, char **argv, char **envp) { #endif *argv=kcl_self; -#ifdef CAN_UNRANDOMIZE_SBRK -#include -#include -#include "unrandomize.h" -#endif - setbuf(stdin, stdin_buf); setbuf(stdout, stdout_buf); #ifdef _WIN32