From a23ea4904fb3af905879842792d6b365655d7bba Mon Sep 17 00:00:00 2001 From: Aleksander Czajczynski Date: Sun, 29 Dec 2024 00:27:36 +0100 Subject: [PATCH] 2024-12-29 00:28 UTC+0100 Aleksander Czajczynski (hb fki.pl) * src/rtl/hbproces.c ! in process creating functions like hb_processRun(), *Open(), on Android: don't use setuid( getuid() ) method for resetting attributes as it rises "Bad system call" and the process is not executed. This fixes building Harbour in hbmk2 stage on Android device itself (for example using Termux) and can fix deploying multi-process Android apps. For devices older than Android 8, where the kernel was not hardened, please report any regresions, if you have such multi-process deployments. * ChangeLog.txt % stripped spaces before EOLs --- ChangeLog.txt | 20 +++++++++++++++++--- src/rtl/hbproces.c | 15 +++++++++++++-- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 021d94cb13..a91480b9b4 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,20 @@ Entries may not always be in chronological/commit order. See license at the end of file. */ +2024-12-29 00:28 UTC+0100 Aleksander Czajczynski (hb fki.pl) + * src/rtl/hbproces.c + ! in process creating functions like hb_processRun(), *Open(), + on Android: don't use setuid( getuid() ) method for resetting + attributes as it rises "Bad system call" and the process is not + executed. This fixes building Harbour in hbmk2 stage on Android + device itself (for example using Termux) and can fix deploying + multi-process Android apps. For devices older than Android 8, + where the kernel was not hardened, please report any regresions, + if you have such multi-process deployments. + + * ChangeLog.txt + % stripped spaces before EOLs + 2024-12-19 10:24 UTC+0100 Aleksander Czajczynski (hb fki.pl) * contrib/rddsql/sqlbase.c % cleanup unnecessary braces @@ -17,8 +31,8 @@ 2024-12-18 21:48 UTC-0800 Eric Lendvai (harbour.wiki) * contrib/rddsql/sqlbase.c * contrib/rddsql/sqlmix.c - + added support to timestamp field type. - You can now use "@" in DbCreate as the timestamp field type. + + added support to timestamp field type. + You can now use "@" in DbCreate as the timestamp field type. Thanks to Grigory Filatov for fixing crash! 2024-12-17 03:07 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) @@ -1420,7 +1434,7 @@ 2021-04-01 15:55 UTC-0300 Marco Aurelio V (marcoprodata/at/gmail.com) * contrib/hbpgsql/tpostgre.prg ! corrected buggy in refresh method when execute commands to change - struct + struct [REVERTED] 2021-03-31 23:43 UTC+0200 Aleksander Czajczynski (hb fki.pl) diff --git a/src/rtl/hbproces.c b/src/rtl/hbproces.c index 83bed65291..2100d70de1 100644 --- a/src/rtl/hbproces.c +++ b/src/rtl/hbproces.c @@ -423,9 +423,15 @@ static int hb_fsProcessExec( const char * pszFileName, for( i = 3; i < iMaxFD; ++i ) hb_fsClose( i ); } - /* reset extended process attributes */ + +#if ! defined( __BIONIC__ ) + /* reset extended process attributes + * except on Android libc, where in practice + * this method raises "Bad system call" exception + */ ( void ) setuid( getuid() ); ( void ) setgid( getgid() ); +#endif /* execute command */ execvp( argv[ 0 ], argv ); @@ -846,9 +852,14 @@ HB_FHANDLE hb_fsProcessOpen( const char * pszFileName, hb_fsClose( i ); } - /* reset extended process attributes */ +# if ! defined( __BIONIC__ ) + /* reset extended process attributes + * except on Android libc, where in practice + * this method raises "Bad system call" exception + */ if( setuid( getuid() ) == -1 ) {} if( setgid( getgid() ) == -1 ) {} +# endif /* execute command */ {