Skip to content

Fix dotdot native symlink #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from

Conversation

dscho
Copy link
Member

@dscho dscho commented Jun 19, 2025

No description provided.

jon-turney and others added 9 commits June 5, 2025 13:07
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>
(cherry picked from commit 2029784e05d9805aa074dcadb99c31311790b7ac)
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: 1fd5e00 ("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>
(cherry picked from commit f305ca916ad25870fb010334e4fcaf93057c78b9)
This patch partially reverts the commit b7097ab 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: b7097ab ("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>
(cherry picked from commit 9c3e1e9ea9d2d930fef1ae6a62e61b101c1e047c)
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: 0d675c5 ("* 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>
(cherry picked from commit 364226a4caaa277d86fcc0c58ef862cb23a50603)
(cherry picked from commit 83af2fd6d1018bfe1c08c0028f65076f57684474)
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
In order to avoid a restriction on any reinterpret_cast-like behavior in
constinit expressions, use assembly and the linker to define symbols
with the not-valid-address addresses.

Due to being built with -mcmodel=small, this linker trick does not
always work in the Cygwin DLL, specifically in the cases where they are
used in comparisons (==).  As a result, leave the case where the
symbols would have had to have been classes rather than structs as casts
of integers.  If Cygwin ever needs these to be constinit compliant, it
may need to move to the medium code model or add some other workaround.

Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
(cherry picked from commit 5be6ebd4d5c3492c539e662cc8849c284a456e7d)
When running

	CYGWIN=winsymlinks:nativestrict ln -s .. abc

the counter-intuitive result is _not_ a symbolic link to `..`, but
instead to `../../$(basename "$PWD")`.

The reason for this is that the search for the longest common prefix
assumes that the link target is not a strict prefix of the parent
directory of the link itself.

Let's fix that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho
Copy link
Member Author

dscho commented Jun 24, 2025

Duplicate of #101

@dscho dscho marked this as a duplicate of #101 Jun 24, 2025
@dscho dscho closed this Jun 24, 2025
@dscho dscho deleted the fix-dotdot-native_symlink branch June 24, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants