Age | Commit message (Collapse) | Author | Files | Lines |
|
This will allow Cygwin to examine and handle the posix_spawnattr_t and
posix_spawn_file_actions_t arguments itself.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
|
|
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
|
|
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
|
|
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
|
|
Currently, _cygtls::sigmask is set in call_signal_handler(), but this
is too late to effectively prevent a masked signal from being armed.
With this patch, deltamask, which is set in _cygtls::interrupt_setup()
in advance, is also checked as well as sigmask to determine if the
signal can be armed.
Fixes: 0d675c5d7f24 ("* exceptions.cc (interrupt_setup): Don't set signal mask here or races occur with main thread. Set it in sigdelayed instead.")
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
This patch partially reverts the commit b7097ab39ed0 because it
seems to cause issues when longjmp is used within a signal handler.
The problem that the commit addressed no longer occurs even if this
change is reverted.
Fixes: b7097ab39ed0 ("Cygwin: signal: Revive toggling incyg flag in call_signal_handler()")
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
When the thread is suspended and Rip (instruction pointer) points to
an instruction that causes an exception, modifying Rip and calling
ResumeThread() may sometimes result in a crash. To prevent this,
advance execution by a single instruction by setting the trap flag
(TF) before calling ResumeThread() as a workaround. This will trigger
either STATUS_SINGLE_STEP or the exception caused by the instruction
that Rip originally pointed to. By suspending the targeted thread
within exception::handle(), Rip no longer points to the problematic
instruction, allowing safe handling of the interrupt. As a result,
Rip can be adjusted appropriately, and the thread can resume
execution without unexpected crashes.
Addresses: https://cygwin.com/pipermail/cygwin/2025-May/258153.html
Fixes: 1fd5e000ace5 ("import winsup-2000-02-17 snapshot")
Reported-by: Christian Franke <Christian.Franke@t-online.de>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
Per https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/limits.h.html,
these limits.h constants should not be defined if the implementation
does not have an inherent limit. These are based on available memory
for RTEMS.
|
|
Issue 8 added these symbols which which previously BSD extensions.
|
|
|
|
After inherited permissons were removed, apparently there were no
permissions left allowing access, and GHA recently started failing on
actions/checkout with EPERM.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
The __inln prototype was defined as:
extern char * __inln ();
In old versions of C, this meant "this function takes an unspecified
number of parameters". This seems to have changed, as GCC 14 now
considers that the function took zero parameters.
As the code called it with one parameter, GCC would then issue an error
saying that the incorrect number of parameters was passed.
Address this issue by changing the prototype of the __inln function.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
|
|
(cherry picked from commit 77ece859685a59a692ea910d170d2ba83bcd5de4)
|
|
In e04891d67a (Cygwin: fetch_account_from_windows: skip LookupAccountSid
for SIDs known to fail, 2025-04-10), several SIDs acquired a shortcut
where a potentially expensive `LookupAccountSid()` call is avoided for
SIDs that "cannot be resolved".
However, as reported by Robert Fensterman (and independently discovered
by myself), some of the SIDs that received this special shortcut _do_
get resolved by `LookupAccountSid()` calls: AzureAD users' SIDs.
With those SIDs, that newly-introduced shortcut actually does more harm
than good because there is no other way to retrieve the desired
information, resulting in permission problems.
One symptom of this is that `mintty` can no longer access `/dev/ptmx`
and simply errors out with "Error: Could not fork child process: There
are no available terminals (-1)".
Another symptom is that `tmux` is no longer able to create new sessions.
Yet another symptom is new files are unintentionally written with
restricted permissions (copying an `.exe` file, for example, disallows
the copied version to be executed).
The most likely reason why AzureAD SIDs were included in above-mentioned
commit is that special AzureAD _group_ SIDs are not recognized by
`LookupAccountSid()`, as per the code comment for the `azure_grp_sid`
variable. It is plausible that this fact was mistaken to extend to all
AzureAD SIDs, a notion disproved by the counter example of my personal
experience with my own AzureAD user account. Unfortunately, the only way
to find out whether `LookupAccountSid()` works with a given AzureAD SID
or not is to call that function.
To make regular AzureAD user accounts work again, let's just drop the
AzureAD part from that special shortcut.
My understanding of the other SIDs handled by that shortcut (Capability
SIDs, IIS APPPOOL and Samba user/group SIDs) is insufficient to
determine whether they, too, can be resolved by `LookupAccountSid()` in
some cases (and would therefore equally need to be excluded from that
shortcut). At least as far as the Capability SIDs go, I am rather
confident from reading the context (the commit's message, as well as the
report that led to that commit) that the shortcut is safe, and I could
imagine that the same is true for IIS APPPOOL and Samba SIDs. Absent any
further insight, I therefore decided to leave the rest of e04891d67a
(Cygwin: fetch_account_from_windows: skip LookupAccountSid for SIDs
known to fail, 2025-04-10) intact.
Reported-by: Robert Fensterman <minnmass@gmail.com>
Fixes: e04891d67a (Cygwin: fetch_account_from_windows: skip LookupAccountSid for SIDs known to fail, 2025-04-10)
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
|
Zb* extension support
Reworks the mismatch handling to use Zbb's ctz/clz instructions for
faster byte difference detection, significantly improving performance on
Zbb-capable targets. Non-Zbb targets retain the original logic for
compatibility.
Signed-off-by: puranikvinit <kvp933.vinit@gmail.com>
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
|
|
with Zb* extension support
Introduces conditional use of the orc.b instruction from the Zbb
extension for null byte detection, falling back to the original logic
for non-Zbb targets. This reduces cycles in the hot path for supported
architectures.
Signed-off-by: puranikvinit <kvp933.vinit@gmail.com>
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
|
|
Replaces temporary registers (t0) with compressed registers (a4) in the
null detection loop, reducing instruction count and code size in
speed-optimized builds while maintaining identical logic.
Signed-off-by: puranikvinit <kvp933.vinit@gmail.com>
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
|
|
Renames labels in strcmp.S to use descriptive .L prefixes (e.g.,
.Lcompare, .Lreturn_diff) instead of numeric labels (e.g., 1f, 2f). This
improves maintainability and aligns with modern assembly conventions
without affecting functionality.
Signed-off-by: puranikvinit <kvp933.vinit@gmail.com>
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
|
|
This patch optimizes the RISC-V setjmp implementation in
newlib/libc/machine/riscv/setjmp.S for 32-bit targets. It reduces code
size by using doubleword store/load instructions (sd/ld) when the Zilsd
or Zclsd extensions are available for saving and
restoring s0-s11 registers, while preserving the original
single-word instructions (REG_S/REG_L) for compatibility with other
configurations.
Signed-off-by: puranikvinit <kvp933.vinit@gmail.com>
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
RISC-V: setjmp: reduce code size for register load/store with Zilsd
|
|
Pointer arithmetic overflow is undefined behavior, so use a signed type
to avoid it.
Signed-off-by: Eric Salem <ericsalem@gmail.com>
|
|
This hasn't been substantially revised since (at least) 2004, and
doesn't really represent normal usage of modern gcc and binutils.
|
|
To get correct results, it's currently neccessary to install cygwin
using -j1, as cygwin install rules must run after newlib install rules,
as they overwrite things installed by them.
Also make the installation with sys symlinks, as upload-artifact
currently can't handle the default (WSL) symlinks (stat fails EACCESS).
Also workaround an issue with download-artifact by removing the libg.a
symlink before unpacking the artifact, since otherwise that also fails
(open fails EPERM).
|
|
Align the whitespace of the size optimized implementation of memset()
to match the speed optimized version.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: Eric Salem <ericsalem@gmail.com>
|
|
The RISC-V Zba, Zbkb, and Zilsd/Zclsd extensions provide instructions
optimized for bit and load/store operations. Use them when available for
the RISC-V port. Also increase loop unrolling for faster performance.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: Eric Salem <ericsalem@gmail.com>
|
|
Add a code path for when source and dest are differently aligned.
If misaligned access is slow or prohibited, and the alignments of the
source and destination are different, we align the destination to do
XLEN stores. This uses only one aligned store for every four (or eight
for XLEN == 64) bytes of data.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: Mahmoud Abumandour <ma.mandourr@gmail.com>
|
|
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: Mahmoud Abumandour <ma.mandourr@gmail.com>
|
|
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: Mahmoud Abumandour <ma.mandourr@gmail.com>
|
|
(cherry picked from commit dd10a32cd887b994aa5593bbbb67ecb7164a61ce)
|
|
|
|
This fixes a compile error with GCC 15.
|
|
This fixes a compile error with GCC 15.
|
|
@direntry automatically generates START/END-INFO-DIR-ENTRY. Specifying
them again in the source causes install-info to choke on the resulting
info file:
install-info: START-INFO-DIR-ENTRY without matching END-INFO-DIR-ENTRY
|
|
With recent GCC changes that have elevated some warnings to error by
default the rs6000 sim code errors out with:
libgloss/rs6000/sim-inbyte.c:22:7: error: implicit declaration of function 'read' [-Wimplicit-function-declaration]
libgloss/rs6000/sim-sbrk.c:26:7: error: implicit declaration of function 'brk'; did you mean 'sbrk'? [-Wimplicit-function-declaration]
libgloss/rs6000/sim-abort.c:19:3: error: implicit declaration of function 'write' [-Wimplicit-function-declaration]
libgloss/rs6000/sim-abort.c:20:3: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
libgloss/rs6000/sim-print.c:29:3: error: implicit declaration of function 'write' [-Wimplicit-function-declaration]
libgloss/rs6000/mvme-print.c:34:11: error: implicit declaration of function '__pcrlf' [-Wimplicit-function-declaration]
libgloss/rs6000/mvme-print.c:44:19: error: implicit declaration of function '__outln' [-Wimplicit-function-declaration]
libgloss/rs6000/mvme-print.c:53:15: error: implicit declaration of function '__outstr' [-Wimplicit-function-declaration]
libgloss/rs6000/mbx-print.c:29:3: error: implicit declaration of function 'write' [-Wimplicit-function-declaration]
Add extern declarations to avoid the errors.
|
|
The RegionSize member of the MEMORY_BASIC_INFORMATION struct is of type
SIZE_T, and it may be larger than will fit in a DWORD (I observed
0x200000000). This resulted in an error due to trying to reserve 0
bytes from VirtualAllloc.
Fixes: 8d777a13fcf4 ("* dll_init.cc (reserve_at, release_at): New functions.")
Addresses: https://cygwin.com/pipermail/cygwin/2025-May/258154.html
Reported-by: Yuyi Wang <Strawberry_Str@hotmail.com>
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
The merged below patch modifies the __ieee754_sqrtf and __ieee754_sqrt functions to use a shared implementation, replacing the original fsqrt.d[s] instruction usage.
patch:https://sourceware.org/git/?p=newlib-cygwin.git;a=commit;h=d572c4482b473d7725be0f9380d4f5d8342e4390
Signed-off-by: Songhe Zhu <zhusonghe@eswincomputing.com>
|
|
Two new C files were added to the RISC-V build, so regenerate the
relevant configuration file.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: Eric Salem <ericsalem@gmail.com>
|
|
The RISC-V Zbb, Zbkb, and Zilsd extensions provide instructions
optimized for bit and load/store operations. Use them when available for
the RISC-V port.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: Eric Salem <ericsalem@gmail.com>
|
|
Copy stock implementations of memchr() and memrchr() to the RISC-V port.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: Eric Salem <ericsalem@gmail.com>
|
|
This fixes constantly replaying the exception if we have a segfault
while a debugger is already attached, e.g. stracing a segv, see:
https://cygwin.com/pipermail/cygwin/2025-May/258144.html
Future work:
The 'debugging' static in exception::handle(), which makes us replay the
exception the next half a million times it's hit seems like cruft, maybe
we should look at if it's possible to remove that?
Fixes: 91457377d6c9 ("Cygwin: Make 'ulimit -c' control writing a coredump")
Reported-by: Christian Franke <Christian.Franke@t-online.de>
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
|
|
Currently, opening both side of fifo in a process hangs if the
read side is opened first. The following test case exhibit the
hang while it works in linux.
#include <unistd.h>
#include <pthread.h>
#include <sys/stat.h>
#include <fcntl.h>
#define fifo1 "/tmp/fifo-test"
void *thr1(void *)
{
int fd;
usleep(100000);
fd = open(fifo1, O_WRONLY);
write(fd, "A", 1);
usleep(100000);
close(fd);
return NULL;
}
int main()
{
int fd;
pthread_t th;
char c;
mkfifo(fifo1, 0600);
pthread_create(&th, NULL, thr1, NULL);
fd = open(fifo1, O_RDONLY);
pthread_join(th, NULL);
read(fd, &c, 1);
write(1, &c, 1);
close(fd);
unlink(fifo1);
return 0;
}
The mechanism of hang is as follows. The main thread tries to open
the fifo for reading, but fhandler_fifo::open blocks until it detects
that someone is opening the fifo for writing. The other thread wants
to do that, but it never gets to the point of calling fhandler_fifo::
open because it is stuck waiting for the lock on cygheap->fdtab.
To fix this, this patch delays the construction of the cygheap_fdnew
object fd until after fhandler_fifo::open has been called.
Fixes: df63bd490a52 ("* cygheap.h (cygheap_fdmanip): New class: simplifies locking and retrieval of fds from cygheap->fdtab.")
Reviewd-by: Ken Brown <kbrown@cornell.edu>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
|
|
In the commit 0bfd91d57863, the behaviour of the tty::restore was
changed so that the console mode is set to the previouslly stored
console mode. Therefore, the console mode for the background non-
cygwin app should not be set to tty::restore anymore in setup_for_
non_cygwin_app(). This should have been fixed in that commit.
This patch belatedly fixes it.
Fixes: 0bfd91d57863 ("Cygwin: console: tty::restore really restores the previous mode")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
... and restore it when app exits. The commit 0bfd91d57863 has a bug
that the console mode is stored into the shared memory when both:
(1) cygwin process is started from non-cygwin process.
(2) cygwin process started from non-cygwin process exits.
(1) is intended, but (2) is not. Due to (2), the stored console mode
is unexpectedly broken when the cygwin process exits. Then the mode
restored will be not as expected. This causes undesired console mode
in the use case that cygwin and non-cygwin apps are mixed.
With this patch, the console mode will stored only in the case (1).
This is done by putting the code, which stores the console mode, into
fhandler_console::open() rather than fhandler_console::set_input_mode()
and fhandler_console::set_output_mode().
Fixes: 0bfd91d57863 ("Cygwin: console: tty::restore really restores the previous mode")
Reported-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
Some of the stress-ng tests appear to be flaky on arm64.
|
|
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
Explicitly specify that `from` and `to` are NUL-terminated strings, that
NULL is permitted in `to` when `size` is 0, and that `to` is not
written to in the event of an error (unless it was a fault while writing
to `to`).
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
Fixed in 38d22e4ba4e95d1be79055267610117f4ee249be
This reverts commit d9e9405becbac3c8bc0c9f23f822fb2339990fab.
|
|
Use an output variable from cygwin-install-action to inform where we
unpack the just-built cygwin artifact, because apparently the Windows
ARM64 runners have a different configuration (no D: drive).
Also, drop unused 'target' variable from that matrix
|
|
The commit 68991cda8185 dropped toggling incyg flag in the function
call_signal_handler(). However this seems to cause another problem
that the command "stress-ng --kill 0 -t 5" sometimes leaves child
processes hanging. With this patch additional mechanism to determin
whether the target thread is inside cygwin1.dll has been introduced
instead. This mechanism utilizes _cygtls::inside_kernel() function
with additional argument to return true if the code is in the cygwin
DLL even if incyg flag is not set.
Fixes: 68991cda8185 ("Cygwin: signal: Do not handle signals while waiting for wakeup evt")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|