Commit Graph

485 Commits

Author SHA1 Message Date
Corinna Vinschen 1b7fcf22be Cygwin: ioctl: TIOCINQ: always return number of chars in the inbound queue
So far ioctl(TIOCINQ) could end up returning -1 with errno set to EINVAL
if a non-zero device error mask has been returned by ClearCommError.
This doesn't reflect Linux behaviour, which always returns the number of
chars in the inbound queue, independent of any I/O error condition.
EINVAL was a pretty weird error code to use in this scenario, too.

Fix this by dropping all checking for device errors in the TIOCINQ
case.  Just return the number of chars in the inbound queue.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-03-02 17:05:59 +01:00
Takashi Yano 17528b9d2c Cygwin: console: Fix segfault on shared_console_info access.
- Accessing shared_console_info before initialization causes access
  violation because it is a NULL pointer. The cause of the problem
  reported in https://cygwin.com/ml/cygwin/2020-02/msg00197.html is
  this NULL pointer access in request_xterm_mode_output() when it is
  called from close(). This patch makes sure that shared_console_info
  is not NULL before calling request_xterm_mode_output().
2020-02-24 19:41:16 +01:00
Corinna Vinschen bf33f72d43 Cygwin: add release message for NUL character bugs
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-02-21 10:57:21 +01:00
Corinna Vinschen 592b03b3ba Cygwin: add @cjksingle to release docs
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-02-18 11:35:42 +01:00
Corinna Vinschen 40245925ce Cygwin: rename NSIG to _NSIG, change visibility of NSIG to MISC
NSIG is a deprecated symbol only visible under MISC visibility.
_NSIG is used widely instead, and on most systems NSIG is
defined in terms of _NSIG.

Follow suit: Change NSIG to _NSIG throughout and change visiblity
of NSIG to be defined only in __MISC_VISIBLE case.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-02-18 11:25:12 +01:00
Corinna Vinschen f3793803a7 Cygwin: move 3.1.3 to 3.1.4 release document
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-02-18 11:22:57 +01:00
Ken Brown 1cc07f3a3e Cygwin: document recent changes 2020-01-30 09:43:19 -05:00
Corinna Vinschen 6d79e0a588 add pseudo console fixes to release text
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-01-22 11:05:51 +01:00
Ken Brown 4261a8f5ca Cygwin: document recent changes 2020-01-20 09:47:41 -05:00
Ken Brown 85aff2830a Cygwin: normalize_win32_path: allow drive without trailing backslash
Commit 283cb372, "Cygwin: normalize_win32_path: improve error
checking", required a prefix '\\?\' or '\??\' in the source path to be
followed by 'UNC\' or 'X:\', where X is a drive letter.  That was too
restrictive, since it disallowed the paths '\\?\X: and '\??\X:'.  This
caused problems when a user tried to use the root of a drive as the
Cygwin installation root, as reported here:

  https://cygwin.com/ml/cygwin/2020-01/msg00111.html

Modify the requirement so that '\??\X:' and '\\?\X:' are now allowed
as source paths, without a trailing backslash.
2020-01-17 07:37:29 -05:00
Takashi Yano b3e78186d1 Cygwin: pty: Revise the code for setting code page of pseudo console.
- Fix the problem which overrides the code page setting, reported
  in https://www.cygwin.com/ml/cygwin/2019-12/msg00292.html.
2020-01-13 17:00:14 +01:00
Mark Geisert 7b6414d459 Cygwin: Add missing Linux #define of CPU_SETSIZE
Though our implementation of cpu sets doesn't need it, software from
Linux environments expects this definition to be present.  It's
documented on the Linux CPU_SET(3) man page but was left out due to
oversight.

Addresses https://cygwin.com/ml/cygwin/2019-12/msg00248.html
2020-01-13 16:32:51 +01:00
Corinna Vinschen b42d565150 Cygwin: add 3.1.2 release text
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-12-21 11:44:08 +01:00
Corinna Vinschen 5317e3f4ec Cygwin: add 3.1.1 release text belatedly
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-12-18 10:47:43 +01:00
Corinna Vinschen f69b2421bb Cygwin: add strtold fix to release message
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-12-16 16:39:17 +01:00
Corinna Vinschen 29ba52da95 Cygwin: ilogbl: Make sure to return FP_ILGB0 on zero input
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-12-16 10:50:17 +01:00
Ken Brown 69772c4332 Cygwin: document the last bugfix 2019-12-10 08:45:17 -05:00
Mark Geisert 04d85dea57 Cygwin: Doc change to note stackdump limit patch 2019-11-08 10:23:08 +01:00
Corinna Vinschen 44432b93ad Cygwin: document console helper patch
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-11-05 11:57:32 +01:00
Corinna Vinschen 57640bee75 Cygwin: fix process parent/child relationship after execve
Commit 5a0f2c00aa "Cygwin: fork/exec: fix child process permissions"
removed the PROCESS_DUP_HANDLE handle permission of the parent process
handle in the child to avoid a security problem.

It turned out that this broke the following scenario: If a process forks
and then the parent execs, the child loses the ability to register the
parent's death.  To wit, after the parent died the child process does
not set its own PPID to 1 anymore.

The current exec mechanism copies required handle values (handles to
keep contact to the child processes) into the child_info for the
about-to-be-exec'ed process.  The exec'ed process is supposed to
duplicate these handles.  This fails, given that we don't allow the
exec'ed process PROCESS_DUP_HANDLE access to the exec'ing process since
commit 5a0f2c00aa.

The fix is to avoid the DuplicateHandle calls in the exec'ed process.

This patch sets the affected handles to "inheritable" in the exec'ing
process at exec time.  The exec'ed process just copies the handle values
and resets handle inheritance to "non-inheritable".  The exec'ing
process doesn't have to reset handle inheritance, it exits after setting
up the exec'ed process anyway.

Testcase: $ ssh-agent /bin/sleep 3

ssh-agent forks and the parent exec's sleep.  After sleep exits, `ps'
should show ssh-agent to have PPID 1, and eventually ssh-agent exits.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-11-02 19:55:24 +01:00
Ken Brown b61dc22ada Cygwin: spawnvp, spawnvpe: fail if executable is not in $PATH
Call find_exec with the FE_NNF flag to enforce a NULL return when the
executable isn't found in $PATH.  Convert NULL to "".  This aligns
spawnvp and spawnvpe with execvp and execvpe.
2019-10-18 10:38:52 -04:00
Ken Brown c561a625af Cygwin: mkdir and rmdir: treat drive names specially
If the directory name has the form 'x:' followed by one or more
slashes or backslashes, and if there's at least one backslash, assume
that the user is referring to 'x:\', the root directory of drive x,
and don't strip the backslash.

Previously all trailing slashes and backslashes were stripped, and the
name was treated as a relative file name containing a literal colon.

Addresses https://cygwin.com/ml/cygwin/2019-08/msg00334.html.
2019-10-07 16:09:41 -04:00
Ken Brown e82a0c959a Cygwin: document recent changes to format_proc_cpuinfo 2019-10-07 16:06:28 -04:00
Ken Brown 6061f9c76f Document the last bug fix 2019-09-27 13:36:45 -04:00
Ken Brown a9724c3904 Document the last change 2019-09-24 20:04:28 -04:00
Ken Brown bbc625da81 Cygwin: document last change 2019-09-15 13:40:12 -04:00
Corinna Vinschen 483fb49ea0 Cygwin: add W10 pseudo console support to release notes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-08-29 13:56:43 +02:00
Corinna Vinschen b7399d5e6f Revert "Cygwin: fix potential SEGV in sigwaitinfo/signalfd scenario"
This reverts commit 92115a83a4.

This was utterly wrong.
2019-08-17 10:12:16 +02:00
Corinna Vinschen 92115a83a4 Cygwin: fix potential SEGV in sigwaitinfo/signalfd scenario
On sigwaitinfo or reading from a signalfd, signal processing sets up
signal handling via sigdelayed even if the handler address is NULL.
This doesn't have any impact on sigwaitinfo scenarios (or at least, I
wasn't able to come up with a reproducer) but it breaks signalfd
scenarios, where eventually a call to call_signal_handler from
sigdelayed will try to call the NULL function.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-08-13 12:21:05 +02:00
Corinna Vinschen d59c2c9b82 Cygwin: drop preliminary 3.0.8 release file
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-08-09 17:49:16 +02:00
Corinna Vinschen 449e9a73d1 Cygwin: add missing bugfix release messages for 3.1.0
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-08-09 17:47:55 +02:00
Mark Geisert 362b98b49a Cygwin: Implement CPU_SET(3) macros
This patch supplies an implementation of the CPU_SET(3) processor
affinity macros as documented on the relevant Linux man page.

There is a mostly superset implementation of cpusets under newlib's
libc/sys/RTEMS/include/sys that has Linux and FreeBSD compatibility
and is built on top of FreeBSD bitsets.  This Cygwin implementation
and the RTEMS one could be combined if desired at some future point.
2019-08-05 13:22:04 +02:00
Corinna Vinschen a13145a30d Cygwin: Export newlib ndbm functions
Signed-off-by: Corinna Vinschen <corinna-cygwin@cygwin.com>
2019-07-24 22:32:48 +02:00
Ken Brown 6b843b82a8 Cygwin: document the last bug fix 2019-07-24 14:56:21 -04:00
Ken Brown 86817773c5 Cygwin: add release notes for 3.0.8 2019-07-22 08:18:16 -04:00
Corinna Vinschen bae987be12 Cygwin: sigpending: don't report pending signals for other threads
The sigpending mechanism failed to check if the pending signal was a
process-wide signal, or a signal for the curent thread.  Fix that by
adding a matching conditional to wait_sig's __SIGPENDING code.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-07-12 17:27:26 +02:00
Ken Brown 3dcc10ec90 Tweak release message 2019-06-25 16:38:39 -04:00
Ken Brown 9604a251bd Cygwin: timerfd: avoid a deadlock
Add a function timerfd_tracker::enter_critical_section_cancelable,
which is like enter_critical_section but honors a cancel event.  Call
this when a timer expires while the timerfd thread is in its inner
loop.  This avoids a deadlock if timerfd_tracker::dtor has entered its
critical section and is trying to cancel the thread.  See
https://cygwin.com/ml/cygwin/2019-06/msg00096.html.
2019-06-25 15:44:43 -04:00
Mark Geisert 641ecb0753 Cygwin: Implement sched_[gs]etaffinity()
This patch set implements the Linux syscalls sched_getaffinity,
sched_setaffinity, pthread_getaffinity_np, and pthread_setaffinity_np.
Linux has a straightforward view of the cpu sets used in affinity masks.
They are simply long (1024-bit) bit masks.  This code emulates that view
while internally dealing with Windows' distribution of available CPUs among
processor groups.
2019-06-24 09:18:14 +02:00
Corinna Vinschen ad101bcb0f Rename <xlocale.h> back to <sys/_locale.h>
libX11 provides <X11/Xlocale.h>.  The build of libX11 itself adds
include/X11 to the compiler's include path.  This results in a name
collision with /usr/include/xlocale.h on case-insensitive filesystems.

Commit 90e35b1eb3 renamed sys/_locale.h to xlocale.h in March 2017 under
the assumption that we should provide the locale_t type in the same file
as on Linux, FreeBSD, and Darwin.

A few weeks later (June 2017), glibc removed the xlocale.h file in favor
of bits/types/locale_t.h, which shouldn't be included directly anyway.

For reference and the reasoning, see
https://sourceware.org/git/?p=glibc.git;a=commit;h=f0be25b6336d

Given the above, revert 90e35b1eb3 and
fix additional usage of xlocale.h.
2019-06-14 10:02:08 +02:00
Corinna Vinschen 4ac32559c0 Cygwin: Add release info for 3.0.7
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
(cherry picked from commit 01c253a4c58b6c1da01615431bdc4c88fcba48ea)
2019-04-30 18:49:23 +02:00
Corinna Vinschen f527171a93 Cygwin: define MSG_EOR and refuse in send(2)
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-04-25 19:00:08 +02:00
Corinna Vinschen f0ea836b75 Cygwin: add latest signal handling fixes to release notes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-04-06 18:09:41 +02:00
Corinna Vinschen 557227dda3 Cygwin: winpids: Fix getting process multiple times, take 2
commit d1be0a59d4,
"Cygwin: winpids: Fix getting process multiple times"
fixed duplicate processes in ps -W output, but it fixed
the symptom, not the cause.  It also didn't fix the problem
that the `ps' process itself may show up twice in its own
output.

This patch fixes it.  The spawn worker only deleted the
"winpid.PID" symlink of the current process if the child is
a non-Cygwin process, under the assumption that the exec'ing
process exits anyway.  However, the Window in which both
winpid.PID symlinks point to the same cygpid.PID area is just
too long.  The spawn worker now also deletes its own winpid.PID
symlink if the exec'ed process is a Cygwin process.

Additionally the fix from d1be0a59d4
is now performed on the calling process, too.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-04-02 13:00:22 +02:00
Corinna Vinschen de3c82ee6d Cygwin: Add console patches to release notes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-03-31 19:37:55 +02:00
Corinna Vinschen 7b8049f7a3 Cygwin: document ps -W duplication bug fix
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-03-31 12:50:50 +02:00
Ken Brown 298581868a Cygwin: document the recent FIFO changes 2019-03-27 19:47:59 +01:00
Corinna Vinschen 10900b98d1 Cygwin: wcsxfrm_l: Only byte swap if dest size is > 0
commit c0d7d3e1a2 removed the usage of the
LCMAP_BYTEREV flag in the call to LCMapStringW to workaround a strange
bug in LCMapStringW.  This patch didn't take a userspace call of
wcsxfrm{_l} with NULL buffer and 0 size to evaluate the required buffer
size into account.  This introduced a crash trying to byte swap the
NULL buffer.  This patch fixes that problem.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-03-19 21:03:06 +01:00
Corinna Vinschen 38322b9bf6 Cygwin: proc: fix /proc/version output after uname change
3.0.0 changed uname but missed to align /proc/version
which then used the old uname function on the new uname
struct.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-03-18 11:34:00 +01:00
Corinna Vinschen 004d8adfa2 Cygwin: acls: allow converting empty acl to text
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-03-13 12:09:11 +01:00