From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 84749393A432; Wed, 12 Jan 2022 11:03:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 84749393A432 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org, newlib-cvs@sourceware.org Subject: [newlib-cygwin/cygwin-3_3-branch] posix_spawn: fix get/set uid/gid calls for 32 bit Cygwin X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/cygwin-3_3-branch X-Git-Oldrev: e22eca84c49c638a13a63254d653b3da4a8ec5e1 X-Git-Newrev: 50405603ea87dbab5de089ff1410bb843969ab0f Message-Id: <20220112110354.84749393A432@sourceware.org> Date: Wed, 12 Jan 2022 11:03:54 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jan 2022 11:03:54 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=50405603ea87dbab5de089ff1410bb843969ab0f commit 50405603ea87dbab5de089ff1410bb843969ab0f Author: Corinna Vinschen Date: Wed Jan 12 11:57:35 2022 +0100 posix_spawn: fix get/set uid/gid calls for 32 bit Cygwin 32 bit Cygwin still exports function calls to support old applications. E. g., when switching from 16 to 32 bit uid/gid values, new function like getuid32 have been added and the old getuid function still only provides 16 bit values. Newly built applications using getuid are actually calling getuid32. However, this link magic isn't performed inside Cygwin itself, so if newlib functions call getuid, they actually call the old getuid, not the new getuid32. This leads to truncated uid/gid values. https://cygwin.com/pipermail/cygwin/2022-January/250453.html reports how this leads to problems in posix_spawn. Fix this temporarily. i686 support will go away soon in Cygwin and the fix can be dropped. Signed-off-by: Corinna Vinschen Diff: --- newlib/libc/posix/posix_spawn.c | 11 +++++++++++ winsup/cygwin/release/3.3.4 | 3 +++ 2 files changed, 14 insertions(+) diff --git a/newlib/libc/posix/posix_spawn.c b/newlib/libc/posix/posix_spawn.c index 005471fde..cfec80394 100644 --- a/newlib/libc/posix/posix_spawn.c +++ b/newlib/libc/posix/posix_spawn.c @@ -146,6 +146,17 @@ typedef struct __posix_spawn_file_actions_entry { * Spawn routines */ +#if defined (__CYGWIN__) && defined (__i386__) +extern int getgid32 (void); +extern int getuid32 (void); +extern int setegid32 (gid_t egid); +extern int seteuid32 (uid_t euid); +#define setegid setegid32 +#define seteuid seteuid32 +#define getgid getgid32 +#define getuid getuid32 +#endif + static int process_spawnattr(const posix_spawnattr_t sa) { diff --git a/winsup/cygwin/release/3.3.4 b/winsup/cygwin/release/3.3.4 index 1982df0cf..7c37a575c 100644 --- a/winsup/cygwin/release/3.3.4 +++ b/winsup/cygwin/release/3.3.4 @@ -20,3 +20,6 @@ Bug Fixes - Ignore INHERIT ACEs when reading the DACL of non-directory files. Addresses: https://cygwin.com/pipermail/cygwin/2022-January/250363.html + +- Fix an "Invalid argument" problem in posix_spawn on i686. + Addresses: https://cygwin.com/pipermail/cygwin/2022-January/250453.html