Age | Commit message (Collapse) | Author | Files | Lines |
|
For architectures where XLEN is 32 bits, when detecting a null byte, a
word is read at a time. Once a null is found in the word, its precise
location is then determined. Make clear to the compiler that if the
first three bytes are not null, the last byte must be null, and does not
need to be read from the string, since its value is always zero.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: Eric Salem <ericsalem@gmail.com>
|
|
Check for unexpected output (Cygwin error messages). Combine multiple
error findings into one FAILURE line per test. Avoid a race in the
watchdog process. Print all outputs if the new -v option is used.
Signed-off-by: Christian Franke <christian.franke@t-online.de>
|
|
|
|
In the CCP_POSIX_TO_WIN_W path, when `from` is a device,
cygwin_conv_path would attempt to write to the `to` buffer before the
validation of the `size`. This resulted in an EFAULT error in the
common use-case of passing `to` as NULL and `size` as 0 to get the
required size of `to` for the conversion (as used in
cygwin_create_path). Instead, set a boolean and write to `to`
after validation.
Fixes: 43f65cdd7dae ("* Makefile.in (DLL_OFILES): Add fhandler_procsys.o.")
Addresses: https://cygwin.com/pipermail/cygwin/2025-April/258068.html
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
Add type posix_tnode. Change certain uses of "void" to "posix_tnode" in
both the prototypes and definitions of functions associated with <search.h>.
(Necessary changes to Cygwin's /usr/include/search.h will follow in a
separate patch to be sent to cygwin-patches.)
Reported-by: Collin Funk <collin.funk1@gmail.com>
Addresses: https://cygwin.com/pipermail/cygwin/2025-April/258032.html
Signed-off-by: Mark Geisert <mark@maxrnd.com>
Fixes: ec98d19a08c2 "* wininfo.h (wininfo::timer_active): Delete."
|
|
Add type posix_tnode. Change certain uses of "void" to "posix_tnode" in
both the prototypes and definitions of functions associated with <search.h>.
(Necessary changes to Newlib's /libc/include/search.h have already been
submitted in a patch sent to newlib@sourceware.org.)
Reported-by: Collin Funk <collin.funk1@gmail.com>
Addresses: https://cygwin.com/pipermail/cygwin/2025-April/258032.html
Signed-off-by: Mark Geisert <mark@maxrnd.com>
Fixes: ec98d19a08c2 "* wininfo.h (wininfo::timer_active): Delete."
|
|
... because cygserver-config no longer works due to the behaviour
change of -f option in 'ps'.
Addresses: https://cygwin.com/pipermail/cygwin/2025-April/258086.html
Fixes: 1ce9756ee61e ("Cygwin: ps -f: output command line")
Reported-by: Christian Lupien <Christian.Lupien@USherbrooke.ca>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
... Otherwise, the opportunity for cleanup the wakeup event handle etc.
may be lost because the user signal handler never returns if it calls
longjmp(). This results in handle leak because the wakeup event handle
will not be closed. This issue happens when the commnad e.g. "stress-ng
--mprotect 1 -t 5" is executed. Instead, call call_signal_handler()
after cleaning up if some signals are armed during waiting wakeup event.
This essentially reverts the commit d243e51ef1d3, however, the deadlock
fixed by that commit no longer occurs even reverting it for some reason.
This is probably due to the redesign of the signal queue.
In addition, do not touch "incyg" flag in _cygtls::call_signal_handler()
because the process is still in the cygwin function when a user signal
handler is called from the cygwin functions such as cygwait().
Addresses: https://sourceware.org/pipermail/cygwin/2025-March/257726.html
Fixes: d243e51ef1d3 ("Cygwin: signal: Fix deadlock between main thread and sig thread")
Fixes: 3a1ccfc8c7e6 ("* exceptions.cc (setup_handler): Remove locked flag. Use 'incyg' flag and in_exception function to determine when we're in a cygwin function.")
Reported-by: Christian Franke <Christian.Franke@t-online.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
The DL_info::dli_fname member is actually PATH_MAX bytes, so specify
that (larger) size to cygwin_conv_path rather than MAX_PATH.
Also, use a tmp_pathbuf for the GetModuleFileNameW buffer, so that any
buffer size limitation will definitely be due to the size of dli_fname,
and add a static_assert of the size of dli_fname so we can be sure we're
using the right size constant here.
Fixes: c8432a01c840 ("Implement dladdr() (partially)")
Addresses: https://github.com/rust-lang/backtrace-rs/pull/704#issuecomment-2833782574
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
Addresses: https://sourceware.org/pipermail/cygwin-patches/2025q2/013665.html
Fixes: 6758d2a3aae6 ("(clock_settime): New function.")
Signed-off-by: Christian Franke <christian.franke@t-online.de>
|
|
Avoid some deprecation warnings with recent python:
> .../newlib/doc/makedocbook.py:201: DeprecationWarning: 'count' is passed as positional argument
> .../newlib/doc/makedocbook.py:566: DeprecationWarning: 'count' is passed as positional argument
|
|
> stress-ng: 23:25:43.13 debug: [1338] invoked with 'stress-ng -v -M --oomable --timestamp --verify --temp-path /cygdrive/c/Users/RUNNER~1/AppData/Local/Temp/stress-ng.1237.5.d -t 5 --log-file /cygdrive/d/a/cygwin/cygwin/logs/clock --clock 2' by user 197108 'runneradmin'
> stress-ng: 23:25:43.14 debug: [1338] stress-ng 0.18.12
> stress-ng: 23:25:43.15 debug: [1338] system: CYGWIN_NT-10.0-20348 fv-az2222-241 3.7.0-api-358.x86_64 2025-04-10 23:13 UTC x86_64, gcc 12.4.0, Cygwin libc, little endian
> stress-ng: 23:25:43.15 debug: [1338] RAM total: 16.0G, RAM free: 13.8G, swap free: 2.9G
> stress-ng: 23:25:43.15 debug: [1338] temporary file path: '/cygdrive/c/Users/runneradmin/AppData/Local/Temp/stress-ng.1237.5.d'
> stress-ng: 23:25:43.15 debug: [1338] 4 processors online, 4 processors configured
> stress-ng: 23:25:43.15 info: [1338] setting to a 5 secs run per stressor
> stress-ng: 23:25:43.15 debug: [1338] cache allocate: using defaults, cannot determine cache level details
> stress-ng: 23:25:43.15 debug: [1338] cache allocate: shared cache buffer size: 2048K
> stress-ng: 23:25:43.15 info: [1338] dispatching hogs: 2 clock
> stress-ng: 23:25:43.15 debug: [1338] starting stressors
> stress-ng: 23:25:43.17 debug: [1338] 2 stressors started
> stress-ng: 23:25:43.41 debug: [1340] clock: [1340] started (instance 0 on CPU 2)
> stress-ng: 23:25:43.43 debug: [1341] clock: [1341] started (instance 1 on CPU 2)
> stress-ng: 00:00:00.-99 fail: [1340] clock: clock_settime was able to set an invalid negative time for timer 'CLOCK_REALTIME'
> stress-ng: 00:00:00.-99 fail: [1340] clock: clock_settime was able to set an invalid negative time for timer 'CLOCK_REALTIME_COARSE'
> stress-ng: 00:00:00.-99 fail: [1341] clock: clock_settime was able to set an invalid negative time for timer 'CLOCK_REALTIME'
> stress-ng: 00:00:00.-99 fail: [1341] clock: clock_settime was able to set an invalid negative time for timer 'CLOCK_REALTIME_COARSE'
> stress-ng: 23:25:48.39 debug: [1340] clock: [1340] exited (instance 0 on CPU 2)
> stress-ng: 23:25:48.39 error: [1338] clock: [1340] terminated with an error, exit status=2 (stressor failed)
> stress-ng: 23:25:48.39 debug: [1338] clock: [1340] terminated (stressor failed)
> stress-ng: 23:25:48.40 debug: [1341] clock: [1341] exited (instance 1 on CPU 2)
> stress-ng: 23:25:48.40 error: [1338] clock: [1341] terminated with an error, exit status=2 (stressor failed)
> stress-ng: 23:25:48.40 debug: [1338] clock: [1341] terminated (stressor failed)
> stress-ng: 23:25:48.40 debug: [1338] metrics-check: all stressor metrics validated and sane
> stress-ng: 23:25:48.41 metrc: [1338] stressor bogo ops real time usr time sys time bogo ops/s bogo ops/s CPU used per RSS Max
> stress-ng: 23:25:48.41 metrc: [1338] (secs) (secs) (secs) (real time) (usr+sys time) instance (%) (KB)
> stress-ng: 23:25:48.41 metrc: [1338] clock 158338 4.97 1.48 7.11 31888.38 18428.54 86.52 19992
> stress-ng: 23:25:48.41 info: [1338] skipped: 0
> stress-ng: 23:25:48.41 info: [1338] passed: 0
> stress-ng: 23:25:48.41 info: [1338] failed: 2: clock (2)
> stress-ng: 23:25:48.41 info: [1338] metrics untrustworthy: 0
> stress-ng: 23:25:48.41 info: [1338] unsuccessful run completed in 5.25 secs
>>>> FAILURE: clock (exit status 2)
|
|
v2:
Only echo the command in dryrun mode
Capture stress-ng stderr and stdout to a file
Normally only show the test output if it fails
Capture all test output in an artifact
|
|
v2:
Update comments, enable 'pty' test
Use taskkill instead of pskill
|
|
|
|
Update the macro check so that rv64e builds successfully.
Signed-off-by: Eric Salem <ericsalem@gmail.com>
|
|
Update the macro check so that rv64e builds successfully.
Signed-off-by: Eric Salem <ericsalem@gmail.com>
|
|
Seems to be needed now fedora-latest is F42.
|
|
For architectures where XLEN is 32 bits, when detecting a null byte, a
word is read at a time. Once a null is found in the word, its precise
location is then determined. Make clear to the compiler that if the
first three bytes are not null, the last byte must be null, and does not
need to be read from the source string, since its value is always zero.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: Eric Salem <ericsalem@gmail.com>
|
|
Don't try to change the file attributes for devices, e.g. /dev/null,
this can lead to confusion later.
Addresse: https://cygwin.com/pipermail/cygwin/2025-April/257940.html
Fixes: 2d81f6ebe3dc ("Cygwin: open: always fix up cached DOS file attributes after NtCreateFile")
Reported-by: Bruno Haible <bruno@clisp.org>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
Signed-off-by: Christian Franke <christian.franke@t-online.de>
|
|
Replace add instructions with addi where applicable in
the size optimized versions of memmove(), memset(), memcpy(),
and strcmp(). This change does not affect the functions themselves
and is only done to improve syntactic accuracy.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: m fally <marlene.fally@gmail.com>
|
|
Rename local labels to improve readability.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: m fally <marlene.fally@gmail.com>
|
|
Swap register t1 with a3, so that the affected instructions can be compressed.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Reviewed-by: m fally <marlene.fally@gmail.com>
Signed-off-by: Eric Salem <ericsalem@gmail.com>
|
|
Replace registers t1 and t2 with registers a3 and a4 respectively,
so that the affected instructions can be compressed.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: Mahmoud Abumandour <ma.mandourr@gmail.com>
|
|
Replace lb with lbu to avoid unnecessary sign extension.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: Mahmoud Abumandour <ma.mandourr@gmail.com>
|
|
Move the instruction that increments the remaining number of
bytes to be copied inbetween the load and store instructions.
This is done in order to relax the RAW dependency between the
load and store instructions.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: m fally <marlene.fally@gmail.com>
|
|
Replace lb with lbu to avoid unnecessary sign extension.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: m fally <marlene.fally@gmail.com>
|
|
Since the algorithm in this version of memmove() is different
from the original version, add comments to give a description.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Reviewed-by: Eric Salem <ericsalem@gmail.com>
Signed-off-by: m fally <marlene.fally@gmail.com>
|
|
Rename local lables so that the structure of the function is clearer.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: m fally <marlene.fally@gmail.com>
|
|
Change register t1 to register a4, so that the affected instructions
can be compressed. Since now we have less registers available, the
following changes need to be made:
In the previous version of this function, a4 was used to hold the offset
that needs to be added to source and destination addresses before copying
any data in the case of source address > destination address.
Since a4 now holds the destination address, this offset is not calculated
anymore. Instead, the value in a2 (the number of bytes to be copied) is added
to the source and destination addresses. Therefore, in the case of
source address > destination adress, a value of 1 needs to be subtracted
from both addresses before starting the copying process.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: m fally <marlene.fally@gmail.com>
|
|
Replace register t2 with register a5, so that lb/sb instructions can be compressed.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: m fally <marlene.fally@gmail.com>
|
|
Addresses: https://sourceware.org/pipermail/cygwin-patches/2025q2/013644.html
Fixes: 3e8a7eb1a868 ("sys/unistd.h: fix definition of setproctitle_init")
Reported-by: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
Co-authored-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
Due to a bug introduced by the commit 3312f2d21f13, when the parent
process exits before the child process exits, disable_master_thread
is wrongly set to true, that disables special key handling such as
Ctrl-C. With this patch, the disable_master_thread is set to true if
any of the following conditions is met.
- The parent process is not a cygwin process.
- The master process already died.
- The current process is the master process.
Otherwise, disable_master_thread remains false to keep special key
handling enabled.
Addresses: https://cygwin.com/pipermail/cygwin/2025-April/257909.html
Fixed: 3312f2d21f13 ("Cygwin: console: Redesign mode set strategy on close().")
Reported-by: Jeremy Drake <cygwin@jdrake.com>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
For a datagram socket received by recvfrom, the type param is not
assigned correctly, making fhandler_socket_local::connect() to return
WSAEPROTOTYPE.
Fixes: 2617a91597ca ("* fhandler_socket.cc (get_inet_addr): Handle abstract AF_LOCAL socket.")
Signed-off-by: Yuyi Wang <Strawberry_Str@hotmail.com>
|
|
LookupAccountSid might take a long time if an SID cannot be resolved.
While we know some SIDs never resolved by LookupAccountSid, we call it
anyway and only handle them after it returned with error.
(Partially?) fix this latency problem by skipping the LookupAccountSid
call for SID groups never resolved anyway.
Reported-by: LluĂs Batlle i Rossell <viric@viric.name>
Fixes: 1ca20a1cd208 ("Introduce reading passwd/group entries from SAM/AD.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
|
|
Previously, tcflow() and tcdrain() were missing from console and pty.
ioctl() command: TCXONC, TIOCINQ, and TCFLSH were also missing.
Due to this, "stress-ng --pty 1" failed. This patch implements them.
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
Signed-off-by: Christian Franke <christian.franke@t-online.de>
|
|
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
Previously, List<pthread_key>, which used fast_mutex, was used for
accessing all the valid pthread_key. This caused a deadlock when
another pthread_key_create() is called in the destructor registered
by the previous pthread_key_create(). This is because the
run_all_destructors() calls the desructor via keys.for_each() where
both for_each() and pthread_key_create() (that calls List_insert())
attempt to acquire the lock.
With this patch, use simple array of pthread_key instead and realize
quasi-lock-free access to that array refering to the glibc code.
Addresses: https://cygwin.com/pipermail/cygwin/2025-March/257705.html
Fixes: 1a821390d11d ("fix race condition in List_insert")
Reported-by: Yuyi Wang <Strawberry_Str@hotmail.com>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
|
|
If two threads try to create a file in parallel, only one of them
actually creates the file. So even if both threads first found the
file non-existant, fhandler_base::open will get io.Information ==
FILE_CREATED from NtCreateFile in one thread only, and the thread
just opening the just created file will continue with broken DOS file
attributes.
Make sure to fix up DOS attributes all the time, not only when the file
got created by this thread, but also when it has been just opened.
Fixes: 41de4b6fd735 ("Cygwin: fix up cached DOS file attributes after file creation")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
|
|
After the commit 84d77e5918e1 ("Cygwin: console: Disable
cons_master_thread in win32-input-mode") tcsetattr() no longer takes
effect for the console. This occurs because set_input_mode() and
set_output_mode() are now called in bg_check() only when the current
mode is not tty::cygwin. Before this commit, these functions were
always invoked in bg_check(), regardless of whether the current mode
was already tty::cygwin. As a result, the console mode was updated
every time read() or write() was called.
With this patch, set_input_mode() and set_output_mode() are called
in tcsetattr() to make it take effect.
Fixes: 84d77e5918e1 ("Cygwin: console: Disable cons_master_thread in win32-input-mode")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
Unlike GetModuleHandle, GetModuleHandleEx increments the reference count
by default unless the GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT flag
is passed.
Fixes: c8432a01c840 ("Implement dladdr() (partially)")
Addresses: https://cygwin.com/pipermail/cygwin/2025-April/257864.html
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
Previously, the callback registered by pthread_atfork() was called
in pthread::atforkchild() before _my_tls.fixup_after_fork(). This
caused misbehaviour if the callback used TLS-related functions.
More specifically, cygwait() for a mutex at the beginning of
fhandler_fifo_pipe::raw_write() failed because the event handle
_my_tls.signal_arrived, which is used in cygwait() internally and
designed to be initialized in _cygtls::fixup_after_fork(), was not
yet initialized at that point. Due to this problem, subprocesses
of CMake (versions >= 3.29.x) sometimes failed after the commit
7ed9adb356df ("Cygwin: pipe: Switch pipe mode to blocking mode by
default, 2024-09-05"). This commit triggered the issue because it
introduced cygwait() for the mutex in fhandler_fifo_pipe::raw_write().
This patch moves the pthread::atforkchild() at the end of the fork::
child(), i.e. after all initializations for child process is finished.
The reason why the issue happens not always but sometimes:
The event handle signal_arrived was never properly initialized when
fhandler_fifo_pipe::raw_write() was called from the callback. As a
result, its value was merely copied from the parent process during
a fork() operation. Since the event signal_arrived was not created
as inheritable, the handle value was fundamentally invalid. Despite
this, the issue only occurred occasionally. This inconsistency was
due to the handle value often coinciding with other existing handles
because of its small value, such as 0x1ac. As evidence of this, in
many cases where the issue did not manifest, the signal_arrived
handle was not even an event handle.
Addresses: https://cygwin.com/pipermail/cygwin/2025-March/257800.html
Addresses: https://github.com/msys2/msys2-runtime/issues/272
Fixes: f02b22dcee17 ("* fork.cc (frok::child): Change order of cleanup prior to return.")
Reported-by: Christoph Reiter <reiter.christoph@gmail.com>
Reviewed-by: Jeremy Drake <cygwin@jdrake.com>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
GCC 15 defaults to `-std=gnu23`, causing build failures in `testsuite`
due to outdated C function declarations. This patch updates the function
declarations to align with modern standards.
|
|
This was an oversight, the caller of GetArm64ProcAddress does check for
a NULL return, but it would have crashed in the memcmp before getting
there.
Fixes: 2c5f25035d9f ("Cygwin: add find_fast_cwd_pointer_aarch64.")
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
The sys/asm.h header file is included for certain assembly files, so
move the typedef to a separate header file due to the build breaking on
some systems. Also include the port's string header file (and move and
rename) instead of the system's version.
Addresses: https://sourceware.org/pipermail/newlib/2025/021591.html
Fixes: c3b9bb173c8c ("newlib: riscv: Add XLEN typedef and clean up types")
Reported-by: Jeff Law <jlaw@ventanamicro.com>
Suggested-by: Kito Cheng <kito.cheng@gmail.com>
Signed-off-by: Eric Salem <ericsalem@gmail.com>
|
|
The large code model assume the data may far away from the code, so we
must put the address of the target data wihin the `.text` section,
normally we will just put within the function or nearby the function to
prevent it out-of-range.
Report from riscv-gnu-toolchain:
https://github.com/riscv-collab/riscv-gnu-toolchain/issues/1699
Verified with riscv-gnu-toolchain with rv64gc.
|
|
This works for aarch64 hosts when the target is aarch64, x86_64, or i686,
with only a small #if block in one function that needs to care.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|