Cygwin: shared: Fix access permissions setting in open_shared().
After the commit62f11a5a57
, 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:62f11a5a57
("Cygwin: open_shared: don't reuse shared_locations parameter as output") Fixes:fb16f490bf
("Cygwin: open_shared: try harder allocating a shared region") Reviewed-by: Corinna Vinschen <corinna@vinschen.de> Signedd-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
This commit is contained in:
parent
efba30dd1d
commit
c3eab1e295
|
@ -148,8 +148,7 @@ open_shared (const WCHAR *name, int n, HANDLE& shared_h, DWORD size,
|
||||||
if (name)
|
if (name)
|
||||||
mapname = shared_name (map_buf, name, n);
|
mapname = shared_name (map_buf, name, n);
|
||||||
if (m == SH_JUSTOPEN)
|
if (m == SH_JUSTOPEN)
|
||||||
shared_h = OpenFileMappingW (FILE_MAP_READ | FILE_MAP_WRITE, FALSE,
|
shared_h = OpenFileMappingW (access, FALSE, mapname);
|
||||||
mapname);
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
created = true;
|
created = true;
|
||||||
|
@ -175,8 +174,7 @@ open_shared (const WCHAR *name, int n, HANDLE& shared_h, DWORD size,
|
||||||
Note that we don't actually *need* fixed addresses. The only
|
Note that we don't actually *need* fixed addresses. The only
|
||||||
advantage is reproducibility to help /proc/<PID>/maps along. */
|
advantage is reproducibility to help /proc/<PID>/maps along. */
|
||||||
addr = (void *) region_address[m];
|
addr = (void *) region_address[m];
|
||||||
shared = MapViewOfFileEx (shared_h, FILE_MAP_READ | FILE_MAP_WRITE,
|
shared = MapViewOfFileEx (shared_h, access, 0, 0, 0, addr);
|
||||||
0, 0, 0, addr);
|
|
||||||
}
|
}
|
||||||
/* Also catch the unlikely case that a fixed region can't be mapped at the
|
/* Also catch the unlikely case that a fixed region can't be mapped at the
|
||||||
fixed address. */
|
fixed address. */
|
||||||
|
@ -190,8 +188,7 @@ open_shared (const WCHAR *name, int n, HANDLE& shared_h, DWORD size,
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
addr = (void *) next_address;
|
addr = (void *) next_address;
|
||||||
shared = MapViewOfFileEx (shared_h, FILE_MAP_READ | FILE_MAP_WRITE,
|
shared = MapViewOfFileEx (shared_h, access, 0, 0, 0, addr);
|
||||||
0, 0, 0, addr);
|
|
||||||
next_address += wincap.allocation_granularity ();
|
next_address += wincap.allocation_granularity ();
|
||||||
if (next_address >= SHARED_REGIONS_ADDRESS_HIGH)
|
if (next_address >= SHARED_REGIONS_ADDRESS_HIGH)
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,3 +17,6 @@ Bug Fixes
|
||||||
|
|
||||||
- Fix memory leak in printf() regarding gdtoa-based _ldtoa_r().
|
- Fix memory leak in printf() regarding gdtoa-based _ldtoa_r().
|
||||||
Addresses: https://cygwin.com/pipermail/cygwin/2023-July/254054.html
|
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.
|
||||||
|
|
Loading…
Reference in New Issue