summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Cygwin: fork: fix child process permissions, take 2Corinna Vinschen2019-01-303-17/+8
| | | | | | | | | | | | | VirtualQueryEx, called by fixup_mmaps_after_fork, requires PROCESS_QUERY_INFORMATION permissions per MSDN. However, testing shows that PROCESS_QUERY_LIMITED_INFORMATION is sufficient when running the same code on Windows 8.1 or Windows 10. Fix the code to give the forked child always PROCESS_QUERY_INFORMATION perms on Windows Vista/7 and respective server releases. Revert now unneeded patch to check_token_membership as well. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: raise: change to call pthread_killCorinna Vinschen2019-01-302-1/+7
| | | | | | | | | | | POSIX requires that raise(3) is equivalent to pthread_kill(pthread_self(), sig); in multi-threaded applications. Our raise just called kill(sig). Fix that. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: execve: reduce parent handle to non-inheritable SYNCHRONIZECorinna Vinschen2019-01-292-8/+25
| | | | | | | | | Keeping an inheritable handle open results in that handle being spilled over into grandchild processes, which is not desired. Duplicate original parent handle into a non-inheritable one with minimal SYNCHRONIZE permissions and close the original handle. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: fork/exec: fix child process permissionsCorinna Vinschen2019-01-295-8/+38
| | | | | | | | | | | - Exec'ed/spawned processes don't need PROCESS_DUP_HANDLE. Remove that permission from the parent handle. - PROCESS_QUERY_LIMITED_INFORMATION doesn't work for Windows 7 if the process is started as a service. Add PROCESS_QUERY_INFORMATION for pre-Windows 8 in that case. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Makefile.in: Improve dependency for version infoCorinna Vinschen2019-01-291-1/+6
| | | | | | | | | | | | The version info only depends on the object files. This results in the version info not being rebuild immediately if a source file is changed. Rather, the version info is only rebuilt on the next make run. Fix that by making the version info build rule dependent on the source files. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: procfd: improve debug outputCorinna Vinschen2019-01-281-2/+5
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: seteuid: disable unused funcs and lsaauth subdirCorinna Vinschen2019-01-283-3/+11
| | | | | | If S4U proves to be usable alone, remove this code entirely. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: spawn: revert incorrect restriction of permissionsCorinna Vinschen2019-01-271-2/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: fork: restrict parent handle perms and drop handle after useCorinna Vinschen2019-01-273-3/+7
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: seteuid: use Kerberos/MsV1_0 S4U authentication by defaultCorinna Vinschen2019-01-268-79/+353
| | | | | | | | | | | | | - This simple and official method replaces cyglsa and "create token" methods. No network share access, same as before. - lsaauth and create_token are disabled now. If problems crop up, they can be easily reactivated. If no problems crop up, they can be removed in a while, together with the lsaauth subdir. - Bump Cygwin version to 3.0. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: uname: Raise size of utsname fields and revamp uname(2) outputCorinna Vinschen2019-01-268-7/+92
| | | | | | | | | | | | | | | | New format: sysname: CYGWIN_NT-${osversion}-${os_build_number}[-WOW64] nodename: `gethostname` release: ${cygwin_version}-${API minor}.${arch}[.snap] version: YYYY-MM-DD HH:MM UTC machine: ${arch} _GNU_SOURCE: domainname: `getdomainname` !_GNU_SOURCE: __domainname: `getdomainname` Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: netdb.h: fix __GNU_VISIBLE testsCorinna Vinschen2019-01-261-3/+3
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: create_token: Return NULL, not INVALID_HANDLE_VALUECorinna Vinschen2019-01-262-5/+5
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: syscalls.cc: fix formattingCorinna Vinschen2019-01-261-5/+4
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: lsaauth: Drop outdated test for loading Secur32.dllCorinna Vinschen2019-01-261-6/+0
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: seteuid: work with password-less user switch as wellCorinna Vinschen2019-01-243-21/+39
| | | | | | | | | | The previous patch failed with password-less auth because in that case the return code from get_server_groups wasn't tested. Fix that. Also make sure that get_server_groups does not check if the account is disabled or locked out when just fetching the group list for initgroups or getgrouplist. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: seteuid: refuse changing uid to disabled or locked out userCorinna Vinschen2019-01-242-0/+18
| | | | | | | | | | | | So far seteuid could change uid to any existing account, given sufficient permissions of the caller. This is kind of bad since it disallows admins to refuse login to disabled or locked out accounts. Add check for the account's UF_ACCOUNTDISABLE or UF_LOCKOUT flags and don't let the user in, if one of the flags is set. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: net: unify gethostname/getdomainnameCorinna Vinschen2019-01-241-41/+36
| | | | | | | Use info from same source (GetNetworkParams). Also move getdomainname near gethostname in source. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: gethostname: fix fetching hostname from non-winsock functionCorinna Vinschen2019-01-242-1/+3
| | | | | | | | | If gethostname() fails we call GetComputerNameEx with ComputerNameDnsFullyQualified. This is wrong, gethostname should return the hostname only, not the FQDN. Fix this by calling GetComputerNameEx with ComputerNameDnsHostname. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: version: Use UTC timestamp as build timeCorinna Vinschen2019-01-241-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: cygthread: set thread name before calling thread funcCorinna Vinschen2019-01-232-2/+4
| | | | | | | | | When reusing a cygthread, the stub method fails to set the thread name to the new name. The name is only set when actually creating the thread. Fix that by moving the SetThreadName call right in front of the thread function call. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Use nanf() instead of nan() in single-precision float libm math functionsJozef Lawrynowicz2019-01-234-4/+4
| | | | | This patch reduces code size for a few single-precision float math functions, by using nanf() instead of nan() where required.
* Use HUGE_VALF instead of HUGE_VAL in single-precision float libm math functionsJozef Lawrynowicz2019-01-2316-18/+18
| | | | | This patch replaces instances of "(float).*HUGE_VAL" with a direct usage of HUGE_VALF, which is also defined in math.h.
* Remove HUGE_VAL definition from libm math functionsJozef Lawrynowicz2019-01-2331-186/+0
| | | | | | This patch removes the definitions of HUGE_VAL from some of the float math functions. HUGE_VAL is defined in newlib/libc/include/math.h, so it is not necessary to have a further definition in the math functions.
* Remove matherr, and SVID and X/Open math library configurationsJozef Lawrynowicz2019-01-2390-2350/+433
| | | | Default math library configuration is now IEEE
* Cygwin: posix timers: fix overrun count always being 1 too bigCorinna Vinschen2019-01-222-37/+21
| | | | | | | | | | Combine with a bit of cleanup: - Drop overrun_event_running in favor of overrun_count being -1. - Fix include guard in posix_timer.h. - Drop ununsed function timespec_to_us. - Don't use Interlocked functions without need. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: posix timers: fix error handling in public APICorinna Vinschen2019-01-221-6/+15
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: posix timers: allocate timer_tracker on system heap.Corinna Vinschen2019-01-223-5/+5
| | | | | | | | | Allocating on the cygheap would copy information of the tracker into the child process. A forked child knows the timer id and could simply still access the (free'd but still valid) timer_tracker on the heap, which is dangerous and very certainly doesn't reflect POSIX semantics. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: Add support for CLOCK_REALTIME_ALARM/CLOCK_BOOTTIME_ALARMCorinna Vinschen2019-01-223-8/+9
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: posix timers: Add support for CLOCK_REALTIME_ALARM/CLOCK_BOOTTIME_ALARMCorinna Vinschen2019-01-221-7/+6
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: clocks: Add CLOCK_REALTIME_ALARM/CLOCK_BOOTTIME_ALARM clocksCorinna Vinschen2019-01-222-1/+5
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* time.h: Add CLOCK_REALTIME_ALARM/CLOCK_BOOTTIME_ALARMCorinna Vinschen2019-01-221-8/+12
| | | | | | Slightly reshuffle and add comment Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: posix timers: reimplement using OS timerCorinna Vinschen2019-01-227-239/+289
| | | | | | | | | | | | | | | | - Rename files timer.* to posix_timer.*. - Reimplement using an OS timer rather than a handcrafted wait loop. - Use a Slim R/W Lock for synchronization. - Drop timer chaining. It doesn't server a purpose since all timers are local only. - Rename ttstart to itimer_tracker to better reflect its purpose. It's not the anchor for a timer chain anymore anyway. - Drop fixup_timers_after_fork. Everything is process-local, nothing gets inherited. - Rename timer_tracker::disarm_event to disarm_overrun_event for better readability. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: another overrun computation fix and drop useless variableCorinna Vinschen2019-01-221-6/+4
| | | | | | | | | | | | - When correcting the next expiration timestamp, the number of expirations gets computed correctly, just the expiration timestamp itself is then only incremented by a single interval, rather than the just computed expired intervals. Fix that. - drop the local clock variable in timerfd_tracker::create. It doesn't serve any purpose. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: reset expiry counter in settimeCorinna Vinschen2019-01-211-0/+1
| | | | | | As on Linux, reset the expiry counter when the timer gets rearmed. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: fix gettimeCorinna Vinschen2019-01-211-7/+22
| | | | | | | | | | | | - split into to __try/__except blocks to make sure leave_critical_section is always called when required. - Actually fill time_spec in settime so it_interval is returned correctly. - Return all 0 if timer is disarmed. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: move ioctl error handling into timerfd_trackerCorinna Vinschen2019-01-213-36/+39
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: rename overrun_count to expiration_countCorinna Vinschen2019-01-213-35/+35
| | | | | | | | The value returned by reading from a timerfd is not an overrun count in the same sense as for posix timers, it's an expiry counter. Reflect that in the name. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: fix overrun computationCorinna Vinschen2019-01-211-10/+11
| | | | | | | | | | | | | - Drop erroneous initial computation of overrun count in settime for absolute non-realtime clocks. It's repeated in thread_func and thus counted twice. - Fix overrun computation for timestamp offsets being a multiple of the timer interval. The timestamp has to be corrected after the first offset, otherwise the correction loop counts the intervals again. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: settime: fix computing DueTime on non-realtime clocksCorinna Vinschen2019-01-211-1/+1
| | | | | | | Non-CLOCK_REALTIME counters always use a relative DueTime in NtSetTimer. However, relative DueTime has to be negative, but the code Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: Handle gettime error in settimeCorinna Vinschen2019-01-211-2/+2
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: fill out it_interval on timerfd_gettimeCorinna Vinschen2019-01-212-0/+2
| | | | | | Might not be such a bad idea, after all... Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: implement TFD_TIMER_CANCEL_ON_SETCorinna Vinschen2019-01-203-11/+109
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: convert expiry timestamp to LONG64Corinna Vinschen2019-01-201-4/+4
| | | | | | Turns out we never need it as LARGE_INTEGER. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: Fix entering critical sectionCorinna Vinschen2019-01-201-1/+2
| | | | | | Getting an abandonded mutex is just as well and must be handled. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: fix read(2) running wildCorinna Vinschen2019-01-201-1/+3
| | | | | | | | | | | | | | - On systems with inexact realtime clock, the current timestamp may be fractionally smaller than the desired timestamp. This breaks the computation for incrementing overrun_count so overrun_count may end up as 0. Expiring the timer with an overrun_count of 0 is a no-go. Make sure we always increment overrun_count by at least one after timer expiry. - Do not expire the timer when another process deletes its timer_tracker. This, too, may result in a 0 overrun_count. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: prepare for TFD_TIMER_CANCEL_ON_SETCorinna Vinschen2019-01-192-10/+14
| | | | | | Also drop debugging sleep and make sure overrun count is positive. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: fhandler_pipe: fix commentCorinna Vinschen2019-01-191-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: timerfd: reimplement from scratchCorinna Vinschen2019-01-197-330/+907
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using posix timers "timer_tracker" as base class for timerfd was flawed. Posix timers are not inherited by child processes and don't survive execve. The method used by posix timers didn't allow to share timers between processes. The timers were still per-process timers and worked entirely separate from each other. Reading from these timers via different descriptors was only synchronized within the same process. This does not reflect the timerfd semantics in Linux: The per-file timers can be dup'ed and survive fork and execve. They are still just descriptors pointing to the same timer object originally created by timerfd_create. Synchronization is performed between all descriptor instances of the same timer, system-wide. Thus, reimplement timerfd using a timer instance in shared memory, a kernel timer, and a handful of sync objects. Every process maintains a per-process timerfd struct on the cygheap maintaining a per-process thread. Every process sharing the same timerfd will run this thread checking the state of the timer, similar to the posix timer thread, just working on the shared objects and synchronizing its job with each other thread. Drop the timerfd implementation in the posix timer code and move the public API to fhandler_timerfd.c. Keep the ttstart timer_tracker anchor out of "NO_COPY" since the fixup_after_fork code should run to avoid memory leakage. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: clock.h: add valid_timespec() to check timespec for validityCorinna Vinschen2019-01-186-23/+19
| | | | | | Use throughout, drop local timespec_bad() in timer.cc. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>