From: Pauli Date: Fri, 17 Aug 2018 04:35:37 +0000 (+1000) Subject: Check getauxval on systems that have it when checking for setuid execution. X-Git-Tag: OpenSSL_1_1_1-pre9~5 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=756510c102885005c2fc31eb01e3a6b95f8ed985;p=oweals%2Fopenssl.git Check getauxval on systems that have it when checking for setuid execution. Reviewed-by: Kurt Roeckx Reviewed-by: Matthias St. Pierre (Merged from https://github.com/openssl/openssl/pull/6993) --- diff --git a/crypto/uid.c b/crypto/uid.c index 4e1890f2d2..b2bfee32b5 100644 --- a/crypto/uid.c +++ b/crypto/uid.c @@ -31,12 +31,18 @@ int OPENSSL_issetugid(void) # include OPENSSL_UNISTD # include +# if defined(__GLIBC__) && defined(__GLIBC_PREREQ) +# if __GLIBC_PREREQ(2, 16) +# include +# endif +# endif + int OPENSSL_issetugid(void) { - if (getuid() != geteuid()) - return 1; - if (getgid() != getegid()) - return 1; - return 0; +# ifdef AT_SECURE + return getauxval(AT_SECURE) != 0; +# else + return getuid() != geteuid() || getgid() != getegid(); +# endif } #endif