Re: [PATCH v2] Cygwin: add api version check to c++ malloc struct override.

2025-08-04 Thread Jeremy Drake via Cygwin-patches
On Mon, 4 Aug 2025, Corinna Vinschen wrote: > On Aug 2 11:18, Jeremy Drake via Cygwin-patches wrote: > > This prevents memory corruption if a newer app or dll is used with an > > older cygwin dll. This is an unsupported scenario, but it's still a > > good idea to

[PATCH v2] Cygwin: add api version check to c++ malloc struct override.

2025-08-02 Thread Jeremy Drake via Cygwin-patches
This prevents memory corruption if a newer app or dll is used with an older cygwin dll. This is an unsupported scenario, but it's still a good idea to avoid corrupting memory if possible. Fixes: 7d5c55faa1 ("Cygwin: add wrappers for newer new/delete overloads") Co-authored-by: Corinna Vinschen S

Re: [PATCH] Cygwin: add api version check to c++ malloc struct override.

2025-08-02 Thread Jeremy Drake via Cygwin-patches
On Sat, 2 Aug 2025, Corinna Vinschen wrote: > On Aug 1 12:18, Jeremy Drake via Cygwin-patches wrote: > > This prevents memory corruption if a newer app or dll is used with an > > older cygwin dll. This is an unsupported scenario, but it's still a > > good idea to

[PATCH] Cygwin: add api version check to c++ malloc struct override.

2025-08-01 Thread Jeremy Drake via Cygwin-patches
This prevents memory corruption if a newer app or dll is used with an older cygwin dll. This is an unsupported scenario, but it's still a good idea to avoid corrupting memory if possible. Fixes: 7d5c55faa1 ("Cygwin: add wrappers for newer new/delete overloads") Co-authored-by: Corinna Vinschen S

Re: [PATCH] Cygwin: add wrappers for newer new/delete overloads

2025-08-01 Thread Jeremy Drake via Cygwin-patches
On Fri, 1 Aug 2025, Corinna Vinschen wrote: > On Aug 1 10:00, Corinna Vinschen wrote: > > On Jul 31 14:05, Jeremy Drake via Cygwin-patches wrote: > > > 3) running from dynamically loaded DLL's startup > > > newu would contain values from exe's startup, no

Re: [PATCH] Cygwin: add wrappers for newer new/delete overloads

2025-07-31 Thread Jeremy Drake via Cygwin-patches
On Thu, 31 Jul 2025, Corinna Vinschen wrote: > On Jul 31 12:05, Jeremy Drake via Cygwin-patches wrote: > > I noticed that dll_crt0_1 calls check_sanity_and_sync which performs some > > checking on the per_process struct from the application, including if the > > application&#

Re: [PATCH] Cygwin: add wrappers for newer new/delete overloads

2025-07-31 Thread Jeremy Drake via Cygwin-patches
On Thu, 31 Jul 2025, Corinna Vinschen wrote: > > > > The sticking point would be libstdc++-6.dll once it is rebuilt with > > > > the additional --wrap arguments in GCC, because it would define all > > > > the operators and thus be incompatbile with older dll versions. > > and the new libstdc++

Re: [PATCH] Cygwin: add wrappers for newer new/delete overloads

2025-07-31 Thread Jeremy Drake via Cygwin-patches
On Thu, 31 Jul 2025, Jeremy Drake via Cygwin-patches wrote: > On Thu, 31 Jul 2025, Corinna Vinschen wrote: > > > As I said, newer apps against older DLL is not exactly supported, > > vice versa should be. > > > > The problem is that the usual

Re: [PATCH] Cygwin: add wrappers for newer new/delete overloads

2025-07-31 Thread Jeremy Drake via Cygwin-patches
On Thu, 31 Jul 2025, Corinna Vinschen wrote: > On Jul 30 11:27, Jeremy Drake via Cygwin-patches wrote: > > On Wed, 30 Jul 2025, Corinna Vinschen wrote: > > > > > On Jul 25 16:10, Jeremy Drake via Cygwin-patches wrote: > > > > A sized delete (with a std::size_

Re: [PATCH] Cygwin: add wrappers for newer new/delete overloads

2025-07-30 Thread Jeremy Drake via Cygwin-patches
On Wed, 30 Jul 2025, Corinna Vinschen wrote: > On Jul 25 16:10, Jeremy Drake via Cygwin-patches wrote: > > A sized delete (with a std::size_t parameter) was added in C++14 (but > > doesn't combine with nothrow_t) > > > > An aligned new/delete (with a std::align_val

Re: [PATCH v5] Cygwin: mkimport: implement AArch64 +/-4GB relocations

2025-07-25 Thread Jeremy Drake via Cygwin-patches
On Fri, 25 Jul 2025, Radek Barton wrote: > Hello > > Sending version with the comment updated and indentation fixed. > > Radek > > --- > From 494dfb736813385179e083864e1610284ca43ec8 Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?Radek=20Barto=C5=88?= > Date: Sat, 19 Jul 2025 19:17:12 +0200 > Subject

[PATCH] Cygwin: add wrappers for newer new/delete overloads

2025-07-25 Thread Jeremy Drake via Cygwin-patches
A sized delete (with a std::size_t parameter) was added in C++14 (but doesn't combine with nothrow_t) An aligned new/delete (with a std::align_val_t parameter) was added in C++17, and combinations with the sized delete and nothrow_t variants. Signed-off-by: Jeremy Drake --- I added #pragma GCC d

Re: [PATCH v4] Cygwin: mkimport: implement AArch64 +/-4GB relocations

2025-07-25 Thread Jeremy Drake via Cygwin-patches
On Fri, 25 Jul 2025, Radek Barton wrote: > Hello. > > Sending another version with suggestion to use more strict conditions for > instructions detection applied. Sorry to keep nitpicking... > Radek > > --- > From fed90421a5c9c8539a7aad92588730f0a84fd306 Mon Sep 17 00:00:00 2001 > From: =?UTF-8?

Re: [PATCH v3] Cygwin: mkimport: implement AArch64 +/-4GB relocations

2025-07-24 Thread Jeremy Drake via Cygwin-patches
On Thu, 24 Jul 2025, Radek Barton wrote: > Hello. > > Thank you for noticing. Here's the fixed version. > > Radek > > --- > From 353e7120b660a5bf5abdff7afbd652c666c66bf8 Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?Radek=20Barto=C5=88?= > Date: Sat, 19 Jul 2025 19:17:12 +0200 > Subject: [PATCH v3]

Re: [PATCH 4/5] Cygwin: add fast-path for posix_spawn(p)

2025-07-24 Thread Jeremy Drake via Cygwin-patches
On Thu, 24 Jul 2025, Corinna Vinschen wrote: > On Jul 7 12:45, Corinna Vinschen wrote: > > On Jul 4 15:59, Jeremy Drake via Cygwin-patches wrote: > > > On Fri, 4 Jul 2025, Jeremy Drake via Cygwin-patches wrote: > > > > On Fri, 4 Jul 2025, Corinna Vinschen wrote:

Re: [EXTERNAL] Re: [PATCH] Cygwin: mkimport: implement AArch64 +/-4GB relocations

2025-07-22 Thread Jeremy Drake via Cygwin-patches
On Tue, 22 Jul 2025, Corinna Vinschen wrote: > On Jul 22 09:12, Radek Barton via Cygwin-patches wrote: > > Hello. > > > > Thank you for this insight. So, if I build tcsh using AArch64 Cygwin > > GNU toolchain, I should see if this behaves correctly with debugger? > > Yes, that would probably be he

Re: [PATCH] Cygwin: mkimport: implement AArch64 +/-4GB relocations

2025-07-21 Thread Jeremy Drake via Cygwin-patches
On Mon, 21 Jul 2025, Corinna Vinschen wrote: > Jeremy? > > On Jul 21 07:56, Radek Barton via Cygwin-patches wrote: > > Hello. > > > > Sending a patch with AArch64 +/-4GB relocations in mkimport as promised at  > > https://sourceware.org/pipermail/cygwin-patches/2025q3/014155.html > > > > Radek > >

Re: [PATCH] Cygwin: console: Set ENABLE_PROCESSED_INPUT when disable_master_thread

2025-07-17 Thread Jeremy Drake via Cygwin-patches
On Thu, 17 Jul 2025, Johannes Schindelin wrote: > > There's also the new "STC" repository that also runs in CI, that seems > > to be more intended for regression tests, but that doesn't have any mingw > > builds yet. > > Oh, you mean the stress tests? From my work in the Git project, I probably >

Re: [PATCH] Cygwin: testsuite: link cygload with --disable-high-entropy-va

2025-07-15 Thread Jeremy Drake via Cygwin-patches
Is this OK to push? On Wed, 9 Jul 2025, Jeremy Drake via Cygwin-patches wrote: > This is a mingw program meant to demonstrate loading the Cygwin dll in a > non-Cygwin process, but the Cygwin dll still initializes the cygheap on > load in that case. Without --disable-high-entropy-va

Re: [PATCH v2] Cygwin: mkimport: port to support AArch64

2025-07-15 Thread Jeremy Drake via Cygwin-patches
On Thu, 10 Jul 2025, Radek Barton via Cygwin-patches wrote: > Hello. > > Sending the same patch with more detailed commit message. > > Radek > --- > From e5060aa9afc7346301b7f394515d7a280b3c703d Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?Radek=20Barto=C5=88?= > Date: Mon, 9 Jun 2025 08:45:27 +020

Re: [PATCH] Cygwin: malloc_wrapper: port to AArch64

2025-07-14 Thread Jeremy Drake via Cygwin-patches
On Mon, 14 Jul 2025, Brian Inglis wrote: > On 2025-07-14 12:10, Jeremy Drake via Cygwin-patches wrote: > > On Mon, 14 Jul 2025, Jeremy Drake wrote: > > > On Thu, 10 Jul 2025, Radek Barton via Cygwin-patches wrote: > > > > This patch implements `import_address` fun

Re: [PATCH] Cygwin: malloc_wrapper: port to AArch64

2025-07-14 Thread Jeremy Drake via Cygwin-patches
On Mon, 14 Jul 2025, Jeremy Drake wrote: > On Thu, 10 Jul 2025, Radek Barton via Cygwin-patches wrote: > > > Hello. > > > > This patch implements `import_address` function by decoding `adr` AArch64 > > instructions to get > > target address. > > Out of curiosity, can you elaborate on when `adr` i

Re: [PATCH] Cygwin: malloc_wrapper: port to AArch64

2025-07-14 Thread Jeremy Drake via Cygwin-patches
On Thu, 10 Jul 2025, Radek Barton via Cygwin-patches wrote: > Hello. > > This patch implements `import_address` function by decoding `adr` AArch64 > instructions to get > target address. Out of curiosity, can you elaborate on when `adr` is used rather than `adrp`/`add` pair? I know adr has much

Re: [PATCH] Cygwin: winchild: fix missing stdlib.h

2025-07-11 Thread Jeremy Drake via Cygwin-patches
On Fri, 11 Jul 2025, Radek Barton via Cygwin-patches wrote: > Hello. > > The `posix_spawn/winchild` test was added recently by > 2af1914b6ad673a2041cf94cc8e78e1bdec57a27 commit. It fails to build for AArch64 > due to missing `stdlib.h` header where `malloc` and `free` functions are > defined. Th

Re: [EXTERNAL] [PATCH] Cygwin: testsuite: link cygload with --disable-high-entropy-va

2025-07-10 Thread Jeremy Drake via Cygwin-patches
structures. > > Radek > > > From: Cygwin-patches > on behalf of > Jeremy Drake via Cygwin-patches > Sent: Wednesday, July 9, 2025 8:47 PM > To: cygwin-patches@cygwin.com > Subject: [EXTERNAL] [PATCH] Cygwin: testsuite: link

[PATCH] Cygwin: testsuite: link cygload with --disable-high-entropy-va

2025-07-09 Thread Jeremy Drake via Cygwin-patches
This is a mingw program meant to demonstrate loading the Cygwin dll in a non-Cygwin process, but the Cygwin dll still initializes the cygheap on load in that case. Without --disable-high-entropy-va, Windows may occasionally locate the PEB, TEB, and/or stacks in the address space that Cygwin tries

[PATCH] Cygwin: testsuite: test posix_spawn_file_actions_addopen with O_CLOEXEC

2025-07-08 Thread Jeremy Drake via Cygwin-patches
This was previously not handled correctly by newlib. Signed-off-by: Jeremy Drake --- This requires a newlib fix (https://sourceware.org/pipermail/newlib/2025/021971.html) to pass on Cygwin. It passes on Linux. winsup/testsuite/winsup.api/posix_spawn/fds.c | 10 ++ 1 file changed, 10 in

Re: [PATCH 4/5] Cygwin: add fast-path for posix_spawn(p)

2025-07-07 Thread Jeremy Drake via Cygwin-patches
On Mon, 7 Jul 2025, Corinna Vinschen wrote: > On Jul 4 15:59, Jeremy Drake via Cygwin-patches wrote: > > On Fri, 4 Jul 2025, Jeremy Drake via Cygwin-patches wrote: > > > On Fri, 4 Jul 2025, Corinna Vinschen wrote: > > > > I see what you mean. The question o

Re: [PATCH 4/5] Cygwin: add fast-path for posix_spawn(p)

2025-07-07 Thread Jeremy Drake via Cygwin-patches
On Mon, 7 Jul 2025, Corinna Vinschen wrote: > On Jul 7 12:16, Jeremy Drake via Cygwin-patches wrote: > > On Mon, 7 Jul 2025, Corinna Vinschen wrote: > > > All good points. We should actually see what the Austin Group comes up > > > with and then we can reconsider.

Re: [PATCH 4/5] Cygwin: add fast-path for posix_spawn(p)

2025-07-07 Thread Jeremy Drake via Cygwin-patches
On Mon, 7 Jul 2025, Corinna Vinschen wrote: > https://austingroupbugs.net/view.php?id=1935 > > > > I'm sorry if I'm sounding frustrated. I am just trying to debate to find > > > the best implementation. I think that having two versions of processing > > > the file actions is asking for inconsist

[PATCH] Cygwin: spawn: apply PID_NEW_PG flag to spawned child

2025-07-07 Thread Jeremy Drake via Cygwin-patches
Previously, it was always applied to "myself", which is only appropriate in the case of _P_OVERLAY (aka exec). Apply the flag to "myself" only in that case, and apply it to the new child instead in other cases. Also, clear the flag from "myself" in the case of a failed exec. Fixes: 8d8724ee1b5a (

Re: [PATCH] Cygwin: console: Set ENABLE_PROCESSED_INPUT when disable_master_thread

2025-07-07 Thread Jeremy Drake via Cygwin-patches
On Mon, 7 Jul 2025, Johannes Schindelin wrote: > fix by a regression test in `winsup/testsuite/`? > > For several days, I tried to find a way to reproduce a way to reproduce > the SSH hang using combinations of Cygwin programs and MINGW > programs/Node.JS scripts and did not find any. FWIW I don't

Re: [PATCH 4/5] Cygwin: add fast-path for posix_spawn(p)

2025-07-04 Thread Jeremy Drake via Cygwin-patches
On Fri, 4 Jul 2025, Jeremy Drake via Cygwin-patches wrote: > On Fri, 4 Jul 2025, Corinna Vinschen wrote: > > > On Jul 3 12:03, Jeremy Drake via Cygwin-patches wrote: > > > On Thu, 3 Jul 2025, Jeremy Drake via Cygwin-patches wrote: > > > > > > > > htt

Re: [PATCH 4/5] Cygwin: add fast-path for posix_spawn(p)

2025-07-04 Thread Jeremy Drake via Cygwin-patches
On Fri, 4 Jul 2025, Corinna Vinschen wrote: > On Jul 3 12:03, Jeremy Drake via Cygwin-patches wrote: > > On Thu, 3 Jul 2025, Jeremy Drake via Cygwin-patches wrote: > > > > > > https://pubs.opengroup.org/onlinepubs/9799919799/functions/posix_spawn_file_actions_addclose

Re: [PATCH 4/5] Cygwin: add fast-path for posix_spawn(p)

2025-07-03 Thread Jeremy Drake via Cygwin-patches
On Thu, 3 Jul 2025, Jeremy Drake via Cygwin-patches wrote: > On Thu, 3 Jul 2025, Corinna Vinschen wrote: > > > On Jul 2 22:51, Jeremy Drake via Cygwin-patches wrote: > > > On Wed, 2 Jul 2025, Corinna Vinschen wrote: > > > > > > > One problem is that y

Re: [PATCH 1/3] Cygwin: testsuite: add a mingw test program to spawn

2025-07-03 Thread Jeremy Drake via Cygwin-patches
On Thu, 3 Jul 2025, Corinna Vinschen wrote: > On Jul 2 10:37, Jeremy Drake via Cygwin-patches wrote: > > On Wed, 2 Jul 2025, Corinna Vinschen wrote: > > > > > On Jun 30 10:11, Jeremy Drake via Cygwin-patches wrote: > > > > On Mon, 30 Jun 2025, Corinna Vinsche

Re: [PATCH 4/5] Cygwin: add fast-path for posix_spawn(p)

2025-07-03 Thread Jeremy Drake via Cygwin-patches
On Thu, 3 Jul 2025, Corinna Vinschen wrote: > On Jul 2 22:51, Jeremy Drake via Cygwin-patches wrote: > > On Wed, 2 Jul 2025, Corinna Vinschen wrote: > > > > > One problem is that you dup and open files in the parent, which are > > > supposed to be dup'ed and

Re: [PATCH 4/5] Cygwin: add fast-path for posix_spawn(p)

2025-07-02 Thread Jeremy Drake via Cygwin-patches
On Wed, 2 Jul 2025, Corinna Vinschen wrote: > One problem is that you dup and open files in the parent, which are > supposed to be dup'ed and opened in the child. That's ok for a native > child, because we can't just hook into the native child process as Linux' > clone3 call does. > > But general

Re: [PATCH v2 2/6] Cygwin: add ability to pass cwd to child process

2025-07-02 Thread Jeremy Drake via Cygwin-patches
On Wed, 2 Jul 2025, Corinna Vinschen wrote: > On Jul 1 16:43, Jeremy Drake via Cygwin-patches wrote: > > This will be used by posix_spawn_fileaction_add_(f)chdir. > > > > The int cwdfd is placed such that it fits into space previously unused > > due to alignment in

Re: [PATCH 1/3] Cygwin: testsuite: add a mingw test program to spawn

2025-07-02 Thread Jeremy Drake via Cygwin-patches
On Wed, 2 Jul 2025, Corinna Vinschen wrote: > On Jun 30 10:11, Jeremy Drake via Cygwin-patches wrote: > > On Mon, 30 Jun 2025, Corinna Vinschen wrote: > > > > > On Jun 27 10:34, Jeremy Drake via Cygwin-patches wrote: > > > > On Fri, 27 Jun 2025, Corinna Vinsche

Re: [PATCH 4/5] Cygwin: add fast-path for posix_spawn(p)

2025-07-01 Thread Jeremy Drake via Cygwin-patches
On Mon, 30 Jun 2025, Jeremy Drake via Cygwin-patches wrote: > I probably won't be able to get back to really working on this for at > least a week, but I'm hoping to at least get some comments written today. Well, I did manage to get a new revision out before my mini-vacation,

[PATCH v2 5/6] Cygwin: posix_spawn: add fastpath support for SETSIGMASK and SETSIGDEF.

2025-07-01 Thread Jeremy Drake via Cygwin-patches
the sigmask was already a member of the child_info, so this just needed an arg to allow overriding the value copied from cygheap. The signal handlers are referenced by two pointers, global_sigs which is used by the signal routines, and cygheap->sigs which is only used during process launch and sta

[PATCH v2 6/6] Cygwin: add pgroup support to posix_spawn fast path

2025-07-01 Thread Jeremy Drake via Cygwin-patches
Tweak proc_subproc PROC_ADD_CHILD to only initialize vchild->pgid if it's not already set. The error checking of setpgid is lacking with respect to the POSIX standard, but this code replicates what setpgid does. This attribute is used by ninja, so is worth adding to the fast path. Signed-off-by:

[PATCH v2 4/6] Cygwin: add fast-path for posix_spawn(p)

2025-07-01 Thread Jeremy Drake via Cygwin-patches
Currently just file actions are supported in the fast path, open/dup2 with a target fd of stdin/out/err, close of any fd, and chdir and fchdir. These were chosen as the least-common-denominator of functionality supported for any child process, as they are allowed to be specified via CreateProcess.

[PATCH v2 3/6] Cygwin: hook posix_spawn/posix_spawnp

2025-07-01 Thread Jeremy Drake via Cygwin-patches
This will allow checking for and optimizing cases that can easily be implemented using ch_spawn instead of using a full fork/exec. Signed-off-by: Jeremy Drake --- winsup/cygwin/cygwin.din | 4 ++-- winsup/cygwin/spawn.cc | 35 +++ 2 files changed, 37 insertions

[PATCH v2 2/6] Cygwin: add ability to pass cwd to child process

2025-07-01 Thread Jeremy Drake via Cygwin-patches
This will be used by posix_spawn_fileaction_add_(f)chdir. The int cwdfd is placed such that it fits into space previously unused due to alignment in the cygheap_exec_info class. This uses a file descriptor rather than a path both because it is easier to marshal to the child and because this shoul

[PATCH v2 1/6] Cygwin: allow redirecting stderr in ch_spawn

2025-07-01 Thread Jeremy Drake via Cygwin-patches
stdin and stdout were alreadly allowed for popen, but implementing posix_spawn in terms of spawn would require stderr as well. Replace the conveniently-located 4 filler bytes with int __stderr so that child_info_spawn doesn't have to grow. Introduce a struct for passing additional args to ch_work

[PATCH v2 0/6] posix_spawn fast path

2025-07-01 Thread Jeremy Drake via Cygwin-patches
This patch series implements a "fast path" for posix_spawn and posix_spawnp which spawns the child directly, rather than forking and then execing after processing actions dictated by posix_spawnattr_t and posix_file_actions_t. The actions supported in the fast path are least-common-denominator fil

RE: [PATCH V2] Aarch64: Optimize pthread_wrapper by eliminating x19 and streamlining register usage

2025-07-01 Thread Jeremy Drake via Cygwin-patches
On Tue, 1 Jul 2025, Thirumalai Nagalingam wrote: > Hi Jeremy, > > Please find this revised version of the previous patch. > The main issue being addressed is a segfault caused by accessing > `wrapper_arg` on the stack after it had been deallocated by VirtualFree. > This resulted in invalid memory

Re: [PATCH] Aarch64: Optimize pthread_wrapper by eliminating x19 and streamlining register usage

2025-07-01 Thread Jeremy Drake via Cygwin-patches
On Tue, 1 Jul 2025, Thirumalai Nagalingam wrote: > Hi all, > > This patch fixes existing issues in my earlier commit > [https://github.com/cygwin/cygwin/commit/f4ba145056dbe99adf4dbe632bec035e006539f8] > and optimizes the AArch64 thread startup sequence by eliminating the use > of register x19 and

Re: [PATCH] Cygwin: CI: cygstress: update for stress-ng 0.19.02 and current Cygwin

2025-07-01 Thread Jeremy Drake via Cygwin-patches
On Tue, 1 Jul 2025, Christian Franke wrote: - fp# WORKS,CI + fp# FAILS # TODO Cygwin: "terminated on signal: 11" (x86_64 on arm64 only), please see: +# https://sourceware.org/pipermail/cygwin/2025-June/258332.html - memcpy# WORKS

Re: [PATCH 1/5] Cygwin: allow redirecting stderr in ch_spawn

2025-06-30 Thread Jeremy Drake via Cygwin-patches
On Mon, 30 Jun 2025, Corinna Vinschen wrote: > On Jun 27 16:32, Jeremy Drake via Cygwin-patches wrote: > > On Fri, 27 Jun 2025, Corinna Vinschen wrote: > > > > It's getting kind of silly how many args this function has. The > > construction of this function (us

Re: [PATCH 4/5] Cygwin: add fast-path for posix_spawn(p)

2025-06-30 Thread Jeremy Drake via Cygwin-patches
(I kind of cut up bits of quoting to try to address my thoughts/motivations better) On Mon, 30 Jun 2025, Corinna Vinschen wrote: > On Jun 27 11:44, Jeremy Drake via Cygwin-patches wrote: > > On Fri, 27 Jun 2025, Corinna Vinschen wrote: > > > > > H. So we only may d

Re: [PATCH 1/3] Cygwin: testsuite: add a mingw test program to spawn

2025-06-30 Thread Jeremy Drake via Cygwin-patches
On Mon, 30 Jun 2025, Corinna Vinschen wrote: > On Jun 27 10:34, Jeremy Drake via Cygwin-patches wrote: > > On Fri, 27 Jun 2025, Corinna Vinschen wrote: > > > > > On Jun 26 13:31, Jeremy Drake via Cygwin-patches wrote: > > > > BTW, I noticed while editing mingw

Re: [PATCH 1/5] Cygwin: allow redirecting stderr in ch_spawn

2025-06-27 Thread Jeremy Drake via Cygwin-patches
On Fri, 27 Jun 2025, Corinna Vinschen wrote: > On Jun 27 13:14, Corinna Vinschen wrote: > > On Jun 26 16:55, Jeremy Drake via Cygwin-patches wrote: > > > stdin and stdout were alreadly allowed for popen, but implementing > > > posix_spawn in terms of spawn w

Re: [PATCH 3/3] Cygwin: testsuite: test passing directory fd to child

2025-06-27 Thread Jeremy Drake via Cygwin-patches
On Fri, 27 Jun 2025, Corinna Vinschen wrote: > On Jun 26 13:34, Jeremy Drake via Cygwin-patches wrote: > > It doesn't make a whole lot of sense to redirect stdin/out/err to/from a > > directory handle, but test it anyway. > > I disagree. There's nothing wrong i

Re: [PATCH 4/5] Cygwin: add fast-path for posix_spawn(p)

2025-06-27 Thread Jeremy Drake via Cygwin-patches
On Fri, 27 Jun 2025, Corinna Vinschen wrote: > On Jun 26 16:59, Jeremy Drake via Cygwin-patches wrote: > > Currently just file actions open/close/dup2 are supported in the fast > > path. > > I'm wondering about that a bit, see below. > > Also, ETOOSHORTCOMMI

Re: [PATCH 1/3] Cygwin: testsuite: add a mingw test program to spawn

2025-06-27 Thread Jeremy Drake via Cygwin-patches
On Fri, 27 Jun 2025, Corinna Vinschen wrote: > On Jun 26 13:31, Jeremy Drake via Cygwin-patches wrote: > > BTW, I noticed while editing mingw/Makefile.am, shouldn't cygload have > > -Wl,--disable-high-entropy-va in LDFLAGS? > > Why? With high-entropy-va, it has been

Re: [PATCH] Cygwin: testsuite: test relative path to exe after addchdir.

2025-06-27 Thread Jeremy Drake via Cygwin-patches
On Fri, 27 Jun 2025, Corinna Vinschen wrote: > On Jun 26 13:29, Jeremy Drake via Cygwin-patches wrote: > > This is apparently relative to the new cwd, but my implementation is > > currently treating it as relative to the parent's cwd, so it's worth > > testing. >

Re: [PATCH 0/5] posix_spawn fast path

2025-06-26 Thread Jeremy Drake via Cygwin-patches
On Thu, 26 Jun 2025, Jeremy Drake via Cygwin-patches wrote: > I *thought* this was all finally good to go, but while working on > posix_spawn tests today I found that it does not properly handle the case > where an (f)chdir file action is present and the path/file argument is > relati

[PATCH 5/5] Cygwin: posix_spawn: add fastpath support for SETSIGMASK and SETSIGDEF.

2025-06-26 Thread Jeremy Drake via Cygwin-patches
Signed-off-by: Jeremy Drake --- winsup/cygwin/local_includes/child_info.h | 3 +- winsup/cygwin/spawn.cc| 53 --- 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/winsup/cygwin/local_includes/child_info.h b/winsup/cygwin/local_includes/ch

[PATCH 4/5] Cygwin: add fast-path for posix_spawn(p)

2025-06-26 Thread Jeremy Drake via Cygwin-patches
Currently just file actions open/close/dup2 are supported in the fast path. Signed-off-by: Jeremy Drake --- winsup/cygwin/spawn.cc | 126 + 1 file changed, 126 insertions(+) diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 63b6233255..7b

[PATCH 3/5] Cygwin: hook posix_spawn/posix_spawnp

2025-06-26 Thread Jeremy Drake via Cygwin-patches
This will allow checking for and optimizing cases that can easily be implemented using ch_spawn instead of using a full fork/exec. Signed-off-by: Jeremy Drake --- winsup/cygwin/cygwin.din | 4 ++-- winsup/cygwin/spawn.cc | 35 +++ 2 files changed, 37 insertions

[PATCH 2/5] Cygwin: add ability to pass cwd to child process

2025-06-26 Thread Jeremy Drake via Cygwin-patches
This will be used by posix_spawn_fileaction_add_(f)chdir. This implementation is not quite complete enough for posix_spawn, as it also needs to treat relative paths to the program as relative to the specified CWD. Signed-off-by: Jeremy Drake --- winsup/cygwin/dcrt0.cc| 19 ++

[PATCH 1/5] Cygwin: allow redirecting stderr in ch_spawn

2025-06-26 Thread Jeremy Drake via Cygwin-patches
stdin and stdout were alreadly allowed for popen, but implementing posix_spawn in terms of spawn would require stderr as well. Signed-off-by: Jeremy Drake --- winsup/cygwin/dcrt0.cc| 2 ++ winsup/cygwin/local_includes/child_info.h | 6 +++--- winsup/cygwin/spawn.cc

[PATCH 0/5] posix_spawn fast path

2025-06-26 Thread Jeremy Drake via Cygwin-patches
I *thought* this was all finally good to go, but while working on posix_spawn tests today I found that it does not properly handle the case where an (f)chdir file action is present and the path/file argument is relative. In that case, it should be relative to the child's cwd, not the parent's. As

[PATCH] Cygwin: testsuite: test relative path to exe after addchdir.

2025-06-26 Thread Jeremy Drake via Cygwin-patches
This is apparently relative to the new cwd, but my implementation is currently treating it as relative to the parent's cwd, so it's worth testing. Signed-off-by: Jeremy Drake --- winsup/testsuite/winsup.api/posix_spawn/errors.c | 8 1 file changed, 8 insertions(+) diff --git a/winsup/t

[PATCH 3/3] Cygwin: testsuite: test passing directory fd to child

2025-06-26 Thread Jeremy Drake via Cygwin-patches
It doesn't make a whole lot of sense to redirect stdin/out/err to/from a directory handle, but test it anyway. Signed-off-by: Jeremy Drake --- winsup/testsuite/winsup.api/posix_spawn/chdir.c | 12 winsup/testsuite/winsup.api/posix_spawn/win32.c | 11 +++ 2 files changed, 23

[PATCH 2/3] Cygwin: testsuite: test posix_spawn of a non-Cygwin executable.

2025-06-26 Thread Jeremy Drake via Cygwin-patches
Test CWD and redirection of standard handles. Signed-off-by: Jeremy Drake --- winsup/testsuite/Makefile.am | 1 + .../testsuite/winsup.api/posix_spawn/win32.c | 170 ++ 2 files changed, 171 insertions(+) create mode 100644 winsup/testsuite/winsup.api/posix_sp

[PATCH 1/3] Cygwin: testsuite: add a mingw test program to spawn

2025-06-26 Thread Jeremy Drake via Cygwin-patches
This program is currently meant to test standard file handles and current working directory (since these are settable via posix_spawn), but could be extended to add additional checks if other cygwin-to-win32 process properties need to be tested. Change cygrun environment variable to mingwtestdir,

[PATCH] Cygwin: testsuite: include sys/stat.h for chmod in posix_spawn/errors.c

2025-06-26 Thread Jeremy Drake via Cygwin-patches
This is required on Linux. Signed-off-by: Jeremy Drake --- winsup/testsuite/winsup.api/posix_spawn/errors.c | 1 + 1 file changed, 1 insertion(+) diff --git a/winsup/testsuite/winsup.api/posix_spawn/errors.c b/winsup/testsuite/winsup.api/posix_spawn/errors.c index 2fc3217bc0..3fbc2cbf99 100644

Re: [PATCH] Aarch64: Fix register load order in `ldp` in commit f4ba145

2025-06-25 Thread Jeremy Drake via Cygwin-patches
On Wed, 25 Jun 2025, Thirumalai Nagalingam wrote: > - ldp x0, x10, [x19, #16] // x0 = stackaddr, x10 = stackbase \n\ > + ldp x10, x0, [x19, #24] // x0 = stackaddr, x10 = stackbase \n\ I am very confused about this. The struct layout: struct pthread_wrapper_arg { LPTHREAD_ST

Re: [PATCH] Cygwin: define OUTPUT_FORMAT and SEARCH_DIR for AArch64

2025-06-24 Thread Jeremy Drake via Cygwin-patches
On Tue, 24 Jun 2025, Radek Barton via Cygwin-patches wrote: > Hello. > > This change defines `OUTPUT_FORMAT` and `SEARCH_DIR` in > `winsup/cygwin/cygwin.sc.in` file for AArch64. > > Radek > > --- > From 420a2c9bd13c338c037e583b663ccdabf4c02cd4 Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?Radek=20Ba

Re: [PATCH] Cygwin: define ___CTOR_LIST__ and ___DTOR_LIST__ for AArch64

2025-06-24 Thread Jeremy Drake via Cygwin-patches
On Tue, 24 Jun 2025, Radek Barton via Cygwin-patches wrote: > Hello. > > This change defines `___CTOR_LIST__` and `___DTOR_LIST__` for AArch64 in > the same way as for x86_x64 as AArch64 uses `pei-aarch64-little` and x86_x64 > uses `pei-x86-64` COFF formats, which both are defined at > https:

Re: [PATCH v3] Cygwin: stack base initialization for AArch64

2025-06-24 Thread Jeremy Drake via Cygwin-patches
On Tue, 24 Jun 2025, Radek Barton via Cygwin-patches wrote: > Hello > > Finally we've managed to rule out that the regressions were actually > introduced by > https://sourceware.org/pipermail/cygwin-patches/2025q2/013832.html, Thiru > will send the fix soon. I'm curious to see what this was.

[PATCH] Cygwin: testsuite: test posix_file_actions_add(f)chdir

2025-06-24 Thread Jeremy Drake via Cygwin-patches
Also test their interaction with addopen, as opens added subsequent to a chdir need to be relative to that new cwd. In order for the tests to compile on Linux, define O_SEARCH to O_PATH if O_SEARCH is not defined, and use the *chdir_np names instead of the now-standardized *chdir. Signed-off-by:

Re: [PATCH v2 0/4] Add tests for posix_spawn

2025-06-23 Thread Jeremy Drake via Cygwin-patches
On Mon, 23 Jun 2025, Corinna Vinschen wrote: > On Jun 20 11:00, Jeremy Drake via Cygwin-patches wrote: > > I got all of the tests that I had written ported to run within the > > winsup/testsuite context. I did not include a test for NULL envp, since > > that seems to no

Re: [PATCH] Cygwin: stack base initialization for AArch64

2025-06-21 Thread Jeremy Drake via Cygwin-patches
On Wed, 18 Jun 2025, Jeremy Drake via Cygwin-patches wrote: > On Wed, 18 Jun 2025, Radek Barton via Cygwin-patches wrote: > > > -#ifdef __x86_64__ > > /* Set stack pointer to new address. Set frame pointer to > > stack pointer and subtract 3

Re: [RFC PATCH 1/3] Cygwin: allow redirecting stderr in ch_spawn

2025-06-21 Thread Jeremy Drake via Cygwin-patches
On Tue, 17 Jun 2025, Corinna Vinschen wrote: > On May 29 10:57, Jeremy Drake via Cygwin-patches wrote: > > stdin and stdout were alreadly allowed for popen, but implementing > > posix_spawn in terms of spawn would require stderr as well. > > --- > > winsup/cygwin/dcrt

RE: [PATCH V4] Cygwin: Aarch64: Add inline assembly pthread wrapper

2025-06-20 Thread Jeremy Drake via Cygwin-patches
On Thu, 19 Jun 2025, Jeremy Drake via Cygwin-patches wrote: > On Thu, 19 Jun 2025, Thirumalai Nagalingam wrote: > > > Hi Jeremy, > > > > Thanks again for the quick follow-up. `ldr` is the correct choice here, > > it's a nice idea for reducing loads. >

[PATCH v2 4/4] Cygwin: testsuite: test posix_spawn_file_actions.

2025-06-20 Thread Jeremy Drake via Cygwin-patches
There are still more that could be tested, such as (f)chdir. Signed-off-by: Jeremy Drake --- winsup/testsuite/Makefile.am | 1 + winsup/testsuite/winsup.api/posix_spawn/fds.c | 124 ++ 2 files changed, 125 insertions(+) create mode 100644 winsup/testsuite/wins

[PATCH v2 3/4] Cygwin: testsuite: test signal mask and ignore options.

2025-06-20 Thread Jeremy Drake via Cygwin-patches
Test both that SIG_IGN and sigprocmask are inherited by default, and that posix_spawnattr options can prevent this. Signed-off-by: Jeremy Drake --- winsup/testsuite/Makefile.am | 1 + .../winsup.api/posix_spawn/signals.c | 82 +++ .../testsuite/winsup.a

[PATCH v2 2/4] Cygwin: testsuite: test posix_spawnp

2025-06-20 Thread Jeremy Drake via Cygwin-patches
Given the limited binaries available (sh, ls, sleep), use sh -c true Signed-off-by: Jeremy Drake --- winsup/testsuite/Makefile.am | 1 + .../testsuite/winsup.api/posix_spawn/spawnp.c | 25 +++ 2 files changed, 26 insertions(+) create mode 100644 winsup/testsuit

[PATCH v2 1/4] Cygwin: testsuite: add posix_spawn tests

2025-06-20 Thread Jeremy Drake via Cygwin-patches
Currently just a couple of tests of error conditions, but I have more tests to add. Signed-off-by: Jeremy Drake --- winsup/testsuite/Makefile.am | 1 + .../testsuite/winsup.api/posix_spawn/errors.c | 57 +++ .../testsuite/winsup.api/posix_spawn/test.h | 38 +++

[PATCH v2 0/4] Add tests for posix_spawn

2025-06-20 Thread Jeremy Drake via Cygwin-patches
I got all of the tests that I had written ported to run within the winsup/testsuite context. I did not include a test for NULL envp, since that seems to not be specified by the POSIX standard, and behavior differs between Cygwin and Linux. More tests could be added (notably for posix_spawn_file_a

RE: [PATCH V4] Cygwin: Aarch64: Add inline assembly pthread wrapper

2025-06-19 Thread Jeremy Drake via Cygwin-patches
On Thu, 19 Jun 2025, Thirumalai Nagalingam wrote: > Hi Jeremy, > > Thanks again for the quick follow-up. `ldr` is the correct choice here, it's > a nice idea for reducing loads. > I've updated the patch to use it for loading stackaddr and stackbase. > Also added the Signed-off-by line to the comm

RE: [PATCH V2] Cygwin: Aarch64: Add inline assembly pthread wrapper

2025-06-19 Thread Jeremy Drake via Cygwin-patches
On Thu, 19 Jun 2025, Thirumalai Nagalingam wrote: > Hi, > > Thanks for the feedback. > As per your request, I've included the updated patch v2 both inline below and > as an attachment for easier review. > > Q1 - 32-byte shadow area on AArch64 > You're correct - unlike x64 Windows, the AArch64 (AR

Re: [PATCH] Cygwin: obtain stack base on AArch64

2025-06-19 Thread Jeremy Drake via Cygwin-patches
On Thu, 19 Jun 2025, Corinna Vinschen wrote: > On Jun 18 10:36, Jeremy Drake via Cygwin-patches wrote: > > On Wed, 18 Jun 2025, Radek Barton via Cygwin-patches wrote: > > > > > Hello. > > > > > > This patch ports reading of stack base from TEB on A

Re: [PATCH v3] Cygwin: implement spinlock pause for AArch64

2025-06-19 Thread Jeremy Drake via Cygwin-patches
On Thu, 19 Jun 2025, Radek Barton wrote: > Hello. > > Sending new version with Signed-off-by header. > > Radek > > --- > From 2726b40ae1b41586e410105d5fd5149f8e7f6b92 Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?Radek=20Barto=C5=88?= > Date: Thu, 5 Jun 2025 12:41:37 +0200 > Subject: [PATCH v3] Cygw

Re: [PATCH] Cygwin: obtain stack pointer on AArch64

2025-06-19 Thread Jeremy Drake via Cygwin-patches
On Wed, 18 Jun 2025, Jeremy Drake via Cygwin-patches wrote: > On Wed, 18 Jun 2025, Radek Barton via Cygwin-patches wrote: > > > Hello. > > > > This patch ports stack pointer reading to AArch64 at fork.cc and cygtls..h. > > > > Radek > > > > --- &

Re: [PATCH] Cygwin: Aarch64: Add inline assembly pthread wrapper

2025-06-18 Thread Jeremy Drake via Cygwin-patches
On Wed, 18 Jun 2025, Jeremy Drake via Cygwin-patches wrote: > > + mov x0, sp// x0 = new stack pointer > > \n\ > > This seems wrong. Shouldn't it be >mov x0, [x19, #16]// x0 = wrapper_arg.stackaddr

Re: [PATCH] Cygwin: Aarch64: Add inline assembly pthread wrapper

2025-06-18 Thread Jeremy Drake via Cygwin-patches
On Thu, 5 Jun 2025, Thirumalai Nagalingam wrote: > Hello, > > Please find my patch attached for review. Please either send patches via something like git send-email that puts the patch in the body, or if you can't send patches in that way without some mail software mangling them, please include t

Re: [PATCH] Cygwin: obtain stack base on AArch64

2025-06-18 Thread Jeremy Drake via Cygwin-patches
On Wed, 18 Jun 2025, Radek Barton via Cygwin-patches wrote: > Hello. > > This patch ports reading of stack base from TEB on AArch64 at cygload.cc and > __getreent. > > Radek > > --- > From 08f9be50573a085fd3e5cb840455ea5fc3b1e82a Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?Radek=20Barto=C5=88?= >

Re: [PATCH] Cygwin: obtain stack pointer on AArch64

2025-06-18 Thread Jeremy Drake via Cygwin-patches
On Wed, 18 Jun 2025, Radek Barton via Cygwin-patches wrote: > Hello. > > This patch ports stack pointer reading to AArch64 at fork.cc and cygtls.h. > > Radek > > --- > From cc920233d50fe38f22610cb51f219e3c9b566109 Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?Radek=20Barto=C5=88?= > Date: Fri, 6 Jun

Re: [PATCH] Cygwin: stack base initialization for AArch64

2025-06-18 Thread Jeremy Drake via Cygwin-patches
On Wed, 18 Jun 2025, Radek Barton via Cygwin-patches wrote: > Hello. > > This patch ports stack base initialization at dcrt0.cc to AArch64. > > Radek > > --- > From 5d470261d9b865bf709f9f4d8da350e3536e6251 Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?Radek=20Barto=C5=88?= > Date: Thu, 5 Jun 2025 13

Re: [PATCH v2] Cygwin: implement spinlock pause for AArch64

2025-06-18 Thread Jeremy Drake via Cygwin-patches
On Mon, 16 Jun 2025, Radek Barton via Cygwin-patches wrote: > Hello. > > Thank you for your insights. The patch has ben changed according to your > suggestions. > > Radek > > --- > From b055fb898c8f09ee1ae598c4c7d85ab2673d7a4c Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?Radek=20Barto=C5=88?= > Da

Re: [PATCH v2] Cygwin: testsuite: add posix_spawn tests

2025-06-17 Thread Jeremy Drake via Cygwin-patches
On Tue, 17 Jun 2025, Jeremy Drake via Cygwin-patches wrote: > Currently just a couple of tests of error conditions, but I have more > tests to add. > > Signed-off-by: Jeremy Drake > --- > > v2: wrap some lines, and add a test for ENOEXEC error (it does NOT fall > ba

[PATCH v2] Cygwin: testsuite: add posix_spawn tests

2025-06-17 Thread Jeremy Drake via Cygwin-patches
Currently just a couple of tests of error conditions, but I have more tests to add. Signed-off-by: Jeremy Drake --- v2: wrap some lines, and add a test for ENOEXEC error (it does NOT fall back to invoking the shell). winsup/testsuite/Makefile.am | 1 + .../testsuite/winsup.ap

[PATCH] Cygwin: testsuite: add posix_spawn tests

2025-06-17 Thread Jeremy Drake via Cygwin-patches
Currently just a couple of tests of error conditions, but I have more tests to add. Signed-off-by: Jeremy Drake --- 1) is testsuite subject to the same review requirements or can I push more tests as I refactor them from my more monolithic test program? 2) This may have revealed a bug (or, non-

Re: [PATCH] Cygwin: make pthread initializer macros constinit compliant

2025-06-17 Thread Jeremy Drake via Cygwin-patches
On Tue, 17 Jun 2025, Corinna Vinschen wrote: > Actually Cygwin doesn't use the PTHREAD macros at all outside C++ code. libc/msgcat.c... Also I didn't check newlib, but I don't know if that counts (defines __INSIDE_CYGWIN__) or not. The only usages that seemed to trigger the "relocation truncated

  1   2   3   4   >