public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: shared: Fix access permissions setting in open_shared().
@ 2023-08-16 13:12 Takashi Yano
0 siblings, 0 replies; only message in thread
From: Takashi Yano @ 2023-08-16 13:12 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=65d34484e9097fd9036dd577028423355cb5f5bc
commit 65d34484e9097fd9036dd577028423355cb5f5bc
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date: Wed Aug 16 08:00:27 2023 +0900
Cygwin: shared: Fix access permissions setting in open_shared().
After the commit 93508e5bb841, the access permissions argument passed
to open_shared() is ignored and always replaced with (FILE_MAP_READ |
FILE_MAP_WRITE). This causes the weird behaviour that sshd service
process loses its cygwin PID. This triggers the failure in pty that
transfer_input() does not work properly.
This patch resumes the access permission settings to fix that.
Fixes: 93508e5bb841 ("Cygwin: open_shared: don't reuse shared_locations parameter as output")
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signedd-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Diff:
---
winsup/cygwin/mm/shared.cc | 6 ++----
winsup/cygwin/release/3.4.8 | 3 +++
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/winsup/cygwin/mm/shared.cc b/winsup/cygwin/mm/shared.cc
index 40cdd4722..7977df382 100644
--- a/winsup/cygwin/mm/shared.cc
+++ b/winsup/cygwin/mm/shared.cc
@@ -139,8 +139,7 @@ open_shared (const WCHAR *name, int n, HANDLE& shared_h, DWORD size,
if (name)
mapname = shared_name (map_buf, name, n);
if (m == SH_JUSTOPEN)
- shared_h = OpenFileMappingW (FILE_MAP_READ | FILE_MAP_WRITE, FALSE,
- mapname);
+ shared_h = OpenFileMappingW (access, FALSE, mapname);
else
{
created = true;
@@ -165,8 +164,7 @@ open_shared (const WCHAR *name, int n, HANDLE& shared_h, DWORD size,
do
{
addr = (void *) next_address;
- shared = MapViewOfFileEx (shared_h, FILE_MAP_READ | FILE_MAP_WRITE,
- 0, 0, 0, addr);
+ shared = MapViewOfFileEx (shared_h, access, 0, 0, 0, addr);
next_address += wincap.allocation_granularity ();
if (next_address >= SHARED_REGIONS_ADDRESS_HIGH)
{
diff --git a/winsup/cygwin/release/3.4.8 b/winsup/cygwin/release/3.4.8
index 448831c65..8cd3eb14b 100644
--- a/winsup/cygwin/release/3.4.8
+++ b/winsup/cygwin/release/3.4.8
@@ -17,3 +17,6 @@ Bug Fixes
- Fix memory leak in printf() regarding gdtoa-based _ldtoa_r().
Addresses: https://cygwin.com/pipermail/cygwin/2023-July/254054.html
+
+- Fix a bug introduced in cygwin 3.4.5 that open_shared() does not set
+ access permissions as requested by its argument.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-08-16 13:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-16 13:12 [newlib-cygwin] Cygwin: shared: Fix access permissions setting in open_shared() Takashi Yano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).