summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin
Commit message (Collapse)AuthorAgeFilesLines
* mmap.cc: Fix some commentsCorinna Vinschen2015-08-252-9/+10
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Sigproc.cc: Fix copyright.newlib-snapshot-20150824Corinna Vinschen2015-08-241-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix hang stracing forking processes but not following childCorinna Vinschen2015-08-244-2/+37
| | | | | | | | * ntdll.h (PROCESSINFOCLASS): Define ProcessDebugFlags. * sigproc.cc (child_info::child_info): Only propagate _CI_STRACED to child if strace is actually tracing child processes. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Bump Cygwin DLL minor number.Corinna Vinschen2015-08-242-1/+5
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Return port number from getservent in network byte orderCorinna Vinschen2015-08-183-2/+11
| | | | | | | * netdb.cc (parse_services_line): Convert port number to network byte order. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* exceptions.cc: Drop including ucontext.h.Corinna Vinschen2015-08-183-1/+7
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Don't call LsaLookupSids if we're not utilizing Windows account DBsCorinna Vinschen2015-08-173-19/+42
| | | | | | | | | * grp.cc (internal_getgrfull): Drop asking caches. Explain why. (internal_getgroups): In case we're not utilizing the Windows account DBs, don't call LsaLookupSids but iterate over the group SIDs in the token and call internal_getgrsid for each of them. Explain why. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Try harder to avoid LDAP access for RFC2307 mappingCorinna Vinschen2015-08-174-37/+55
| | | | | | | | | | | * fhandler_disk_file.cc (fhandler_base::fstat_by_nfs_ea): Rearrange to fall back to myself uid/gid in case we don't utilize Windows account DBs, just as prior to 1.7.34. * sec_helper.cc (cygpsid::get_id): Disable Samba user/group mapping per RFC2307 if we're not utilizing Windows account DBs. * security.cc (convert_samba_sd): Revert previous patch. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix /proc/cpuinfo topology info on newer AMD CPUsCorinna Vinschen2015-08-172-7/+29
| | | | | | | | * fhandler_proc.cc (format_proc_cpuinfo): Handle AMDs providing extended topology info in CPUID leaf 0x8000001e. Fix handling of AMD CPUs providing extended legacy core info in CPUID leaf 0x80000008. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* mkglobals_h: Handle CRLF earlier.Orgad Shaneh2015-08-172-1/+5
| | | | | | | When globals.cc has CRLF line endings, winsup.h is not removed, and compilation fails for duplicate definitions. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Support cpb and eff_freq_ro power mgmt flags in /proc/cpuinfoCorinna Vinschen2015-08-172-0/+9
| | | | | | | * fhandler_proc.cc (format_proc_cpuinfo): Print cpb and eff_freq_ro power management flags. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Improve 2.2.1 release notesCorinna Vinschen2015-08-151-9/+4
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Try to fix potential data corruption in pipe writeCorinna Vinschen2015-08-154-1/+66
| | | | | | | | | | | | | | | * fhandler.cc (fhandler_base_overlapped::raw_write): When performing nonblocking I/O, copy user space data into own buffer. Add longish comment to explain why. * fhandler.h (fhandler_base_overlapped::atomic_write_buf): New member. (fhandler_base_overlapped::fhandler_base_overlapped): Initialize atomic_write_buf. (fhandler_base_overlapped::fhandler_base_overlapped): New destructor, free'ing atomic_write_buf. (fhandler_base_overlapped::copyto): Set atomic_write_buf to NULL in copied fhandler. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix copy/paste error in previous patchCorinna Vinschen2015-08-142-2/+7
| | | | | | | * security.cc (convert_samba_sd): Fix copy/paste error in previous patch. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Don't perform RFC2307 account mapping without account DBCorinna Vinschen2015-08-144-8/+21
| | | | | | | | | * fhandler_disk_file.cc (fhandler_base::fstat_by_nfs_ea): Only try to map user and group info per RFC2307 if account info is fetched from Windows account DB. (convert_samba_sd): Ditto. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Evaluate all group perms in ACL to emulate POSIX user permsCorinna Vinschen2015-08-142-0/+24
| | | | | | | * security,cc (get_attribute_from_acl): Merge all group perms into user perms if user is member of group. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix /proc/cpuinfo topology and cache size infoCorinna Vinschen2015-08-136-490/+618
| | | | | | | | | | | | | | | | * autoload.cc (GetLogicalProcessorInformationEx): Import. (SetThreadGroupAffinity): Import. * fhandler_proc.cc (add_size): New macro. (get_msb): New inline function. (mask_bits): Ditto. (format_proc_cpuinfo): Drop handling of old CPUs. Check if we're running on a OS version supporting porcessor groups. If so, use SetThreadGroupAffinity to set thread affinity. Improve cache info to include 3rd level cache on Intel CPUs. Improve multi core info. * wincap.h (wincaps::has_processor_groups): New element. * wincap.cc: Implement above element throughout. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* miscfuncs.cc: Fix comment preceeding x86_64 memset and friends.Corinna Vinschen2015-08-102-4/+9
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Revert to leaving $HOME aloneCorinna Vinschen2015-08-103-8/+20
| | | | | | * uinfo.cc (cygheap_user::ontherange): Revert previous patch. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Bump Cygwin DLL minor number.Corinna Vinschen2015-08-032-1/+5
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Fix x86_64 memcpy/memset for n > 2GBCorinna Vinschen2015-07-293-19/+183
| | | | | | | | | | | | | | | | https://cygwin.com/ml/cygwin/2015-07/msg00344.html: RtlFillMemory and RtlCopyMemory only work for size values up to 2GB. Fix this problem by using NetBSD code for memset and memcpy. Add entry points for memmove, wmemset, wmemmove, wmemcpy. Thanks to Roman Petrovski <RPetrovski@illumina.com> for pointing this out. * miscfuncs.cc (memset): x86_64 only: Implement in assembler. (memmove,memcpy): x86_64 only: Ditto. (wmemmove,wmemcpy): x86_64 only: Ditto. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* cygwin: Fix copyright datesCorinna Vinschen2015-07-2915-16/+15
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* cygwin: Fix crashes under AllocationPreference=0x100000 conditionCorinna Vinschen2015-07-296-11/+33
| | | | | | | | | | | | | * cygtls.h: Include cygtls_padsize.h and define CYGTLS_PADSIZE there. * cygtls_padsize.h: New file. Define CYGTLS_PADSIZE. * environ.cc (parse_options): Fix NULL pointer access. * init.cc (threadfunc_fe): Do not force stack align on x86_64. * strace.cc (main2): Rename from main. (main): Make room for _cygtls area on stack and just call main2. Add comment to explain why. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Improve cygwin 2.2.0 release textCorinna Vinschen2015-07-231-0/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix potential buffer overflow in makecontext trampolineCorinna Vinschen2015-07-232-1/+13
| | | | | | | | | | | | | | glibc's tst-makecontext2 testcase uncovered a bug in __cont_link_context. If the function misses to reserve shadow space for the calls to setcontext/cygwin_exit, both functions could overwrite memory beyond the stack configured in uc_stack. * exceptions.cc (__cont_link_context): x86_64: align stack and reserve shadow space for subsequent function calls, otherwise suffer potential buffer overflow. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Ignore non-absolute $HOME when started from native processCorinna Vinschen2015-07-233-2/+17
| | | | | | | * uinfo.cc (cygheap_user::ontherange): Ignore $HOME if it's not starting with a slash (aka, absolute POSIX Path). Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Implement siglongjmp and sigsetjmp functions.Corinna Vinschen2015-07-215-23/+120
| | | | | | | | | | | | | | | | | | | | | | | * libc/include/machine/setjmp.h (siglongjmp): Declare as function on Cygwin. (sigsetjmp): Ditto. (_longjmp): Mark as noreturn function on Cygwin. * common.din (siglongjmp): Export. (sigsetjmp): Export. * gendef: Change formatting of some comments. (sigsetjmp): Implement. (siglongjmp): Implement. (__setjmpex): x86_64 only: Drop entry point. (setjmp): x86_64 only: Store tls stackptr in Frame now, store MXCSR and FPUCW registers in Spare, as MSVCRT does. (longjmp): x86_64 only: Restore tls stackptr from Frame now, restore MXCSR and FPUCW registers from Spare. * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. * new-features.xml (ov-new2.2): Document sigsetjmp, siglongjmp. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add previous ldd fix to release fileCorinna Vinschen2015-07-201-0/+2
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Lower Cygwin's MINSIGSTKSZ and SIGSTKSZCorinna Vinschen2015-07-192-6/+9
| | | | | | | * include/cygwin/signal.h (MINSIGSTKSZ): Define as 8K, unconditionally. (SIGSTKSZ): Define as 32K, unconditionally. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Reduce stack pressure throughout CygwinCorinna Vinschen2015-07-1910-85/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dcrt0.cc (initial_env): Reduce size of local path buffers to PATH_MAX. Allocate debugger_command from process heap. (init_windows_system_directory): Very early initialize new global variable global_progname. * dll_init.cc (dll_list::alloc): Make path buffer static. Explain why. (dll_list::populate_deps): Use tmp_pathbuf for local path buffer. * exceptions.cc (debugger_command): Convert to PWCHAR. (error_start_init): Allocate debugger_command and fill with wide char strings. Only allocate if NULL. (try_to_debug): Just check if debugger_command is a NULL pointer to return. Drop conversion from char to WCHAR and drop local variable dbg_cmd. * globals.cc (global_progname): New global variable to store Windows application path. * pinfo.cc (pinfo_basic::pinfo_basic): Just copy progname over from global_progname. (pinfo::status_exit): Let path_conv create the POSIX path to avoid local buffer. * pseudo_reloc.cc (__report_error): Utilize global_progname, drop local buffer. * smallprint.cc (__small_vsprintf): Just utilize global_progname for %P format specifier. (__small_vswprintf): Ditto. * strace.cc (PROTECT): Change to reflect x being a pointer. Reformat. (CHECK): Ditto. Reformat. (strace::activate): Utilize global_progname, drop local buffer. Fix formatting. (strace::vsprntf): Reduce size of local progname buffer to NAME_MAX. Copy and, if necessary, convert only the last path component to progname. (strace_buf_guard): New muto. (buf): New static pointer. (strace::vprntf): Use buf under strace_buf_guard lock only. Allocate buffer space for buf on Windows heap. * wow64.cc (wow64_respawn_process): Utilize global_progname, drop local path buffer. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Remove x86_64 __sjfault/__ljfaultCorinna Vinschen2015-07-182-65/+5
| | | | | | * gendef: Remove unused 64 bit versions of __sjfault and __ljfault. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Rearrange makecontext and add lots of commentsCorinna Vinschen2015-07-182-12/+42
| | | | | | | * exceptions.cc (makecontext): Rearrange order of initialization and document at great length. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix ucontext creation in call_signal handlerCorinna Vinschen2015-07-172-4/+21
| | | | | | | | * exceptions.cc (__unwind_single_frame): Define empty macro on i686. (_cygtls::call_signal_handler): Try to make sure signal context makes sense in case we're generating context here. Add comment to explain. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Comment fixupCorinna Vinschen2015-07-172-6/+13
| | | | | | | | | * exceptions.cc (getcontext/x86_64): Drop comment on RtlCaptureContext. (swapcontext/x86_64): Fix comment yet again. (getcontext/i686): Move comment from x86_64 getcontext, slightly rearranged, to preceeding comment. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Reuse __unwind_single_frame where appropriateCorinna Vinschen2015-07-172-58/+42
| | | | | | | | | | | | * exceptions.cc (__unwind_single_frame): Move up in file to be accessible from other places. Move comment to getcontext. (stack_info::walk): Call __unwind_single_frame in 64 bit case. Fix preceeding comment. (myfault_altstack_handler): Call __unwind_single_frame. (getcontext): Give comment from __unwind_single_frame a new home. (swapcontext): Fix comment. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Implement getcontext, setcontext, makecontext, swapcontextCorinna Vinschen2015-07-177-2/+278
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * common.din (getcontext): Export. (makecontext): Export. (setcontext): Export. (swapcontext): Export. * exceptions.cc (__unwind_single_frame): New static functions, 64 bit only. (setcontext): New function. (getcontext): New function. (swapcontext): New function. (__cont_link_context): New function. (makecontext): New function. * include/cygwin/version.h (CYGWIN_VERSION_DLL_MAJOR): Bump to 2002. (CYGWIN_VERSION_API_MINOR): Bump. * include/ucontext.h (getcontext): Add prototype. (setcontext): Ditto. (swapcontext): Ditto. (makecontext): Ditto. * ntdll.h (NtContinue): Ditto. * new-features.xml (ov-new2.2): Add new section. Document getcontext, setcontext, makecontext, swapcontext. * posix.xml (std-deprec): Add getcontext, setcontext, makecontext, swapcontext. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Document the fact that we forgot to bump for sigaltstack and sethostnameCorinna Vinschen2015-07-172-1/+7
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* exceptions.cc: Reenable code only disabled for debug purposesCorinna Vinschen2015-07-132-2/+5
| | | | | | | * exceptions.cc (exception::handle): Reenable code only disabled for debug purposes. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* tzset: Check timezone and country case-insensitiveCorinna Vinschen2015-07-081-0/+4
| | | | | | * tzset.c (main): Check timezone and country case-insensitive. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add accidentally missing ChangeLog entry for previous patchCorinna Vinschen2015-07-071-0/+16
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* x86_64: Handle myfault exceptions when running on alternate signal stackCorinna Vinschen2015-07-075-2/+71
| | | | | | | | | | | | | | | | | | x86_64 only: * cygtls.cc (san::leave): Restore _my_tls.andreas. * cygtls.h (class san): Add _clemente as in 32 bit case. Add ret and frame members. (san::san): Handle _my_tls.andreas as on 32 bit. Take parameter and write it to new member ret. Store current stack pointer in frame. (san::~san): New destructor to restore _my_tls.andreas. (__try): Use __l_except address as parameter to san::san. * dcrt0.cc (dll_crt0_0): Add myfault_altstack_handler as vectored continuation handler. * exception.h (myfault_altstack_handler): Declare. * exceptions.cc (myfault_altstack_handler): New function. Explain what it's good for. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Simplify stack allocation code in child after forkCorinna Vinschen2015-07-073-69/+68
| | | | | | | | | | | | | * child_info.h (CURR_CHILD_INFO_MAGIC): Update. (child_info_fork::alloc_stack_hard_way): Drop declaration. * dcrt0.cc (child_info_fork::alloc_stack_hard_way): Fold into child_info_fork::alloc_stack. (getstack): Remove. (child_info_fork::alloc_stack): Simplify check for application-provided stack in "hard way" code. Don't call getstack for each page, just reallocate stack immediately as required. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Simplify fork code setting up child stack infoCorinna Vinschen2015-07-072-29/+25
| | | | | | | * fork.cc (frok::parent): Simplify code propagating stack setup to child process. Tweak comments. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* winsup/cygwin: rework basename redefinition handling in path.ccYaakov Selkowitz2015-07-062-3/+11
| | | | | | This fixes the compile after commit 79e419de6261c4e04785908828096cb4d56b8680. * path.cc: Rework basename redefinition handling. Explain why.
* Align hard stack allocation to pthread stack setup changesCorinna Vinschen2015-07-052-11/+23
| | | | | | | | * dcrt0.cc (CYGWIN_GUARD): Remove. (child_info_fork::alloc_stack_hard_way): Align stack commit to changes of thread stack setup in CygwinCreateThread. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Implement correct RLIMIT_STACK handlingCorinna Vinschen2015-07-056-71/+164
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * miscfuncs.cc (struct pthread_wrapper_arg): Add member guardsize. (pthread_wrapper): Set thread stack guarantee according to guardsize. Tweak assembler code so that $rax/$eax is not required by GCC to prepare the wrapper_arg value. (CygwinCreateThread): Fix deadzone handling. Drop setting a "POSIX" guardpage (aka page w/ PAGE_NOACCESS). Always use Windows guard pages instead. On post-XP systems (providing SetThreadStackGuarantee) always set up stack Windows like with reserved/commited areas and movable guard pages. Only on XP set up stack fully commited if the guardpage size is not the default system guardpage size. Fill out pthread_wrapper_arg::guardsize. Improve comments. * resource.cc: Implement RSTACK_LIMIT Linux-like. (DEFAULT_STACKSIZE): New macro. (DEFAULT_STACKGUARD): Ditto. (rlimit_stack_guard): New muto. (rlimit_stack): New global variable holding current RSTACK_LIMIT values. (__set_rlimit_stack): Set rlimit_stack under lock. (__get_rlimit_stack): Initialize rlimit_stack from executable header and return rlimit_stack values under lock. (get_rlimit_stack): Filtering function to return useful default stacksize from rlimit_stack.rlim_cur value. (getrlimit): Call __get_rlimit_stack in RLIMIT_STACK case. (setrlimit): Call __set_rlimit_stack in RLIMIT_STACK case. * thread.cc (pthread::create): Fetch default stacksize calling get_rlimit_stack. (pthread_attr::pthread_attr): Fetch default guardsize calling wincap.def_guard_page_size. (pthread_attr_getstacksize): Fetch default stacksize calling get_rlimit_stack. * thread.h (PTHREAD_DEFAULT_STACKSIZE): Remove. (PTHREAD_DEFAULT_GUARDSIZE): Remove. (get_rlimit_stack): Declare. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Disable fetching heap info on 64 bit XP/2003Corinna Vinschen2015-07-055-1/+27
| | | | | | | | | | * fhandler_process.cc (heap_info::heap_info): Disable fetching heap info on 64 bit XP/2003. Explain why. * wincap.h (wincaps::has_broken_rtl_query_process_debug_information): New element. * wincap.cc: Implement above element throughout. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add missing wincap changes to previous ChangeLog entryCorinna Vinschen2015-07-051-0/+3
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix original stack when running signal handler on alternate stackCorinna Vinschen2015-07-048-134/+291
| | | | | | | | | | | | | | | | | | | | | | | | | | | * autoload.cc (SetThreadStackGuarantee): Import. * cygtls.h (struct _cygtls): Replace thread_context with a ucontext_t called context. * exceptions.cc (exception::handle): Exit from process via signal_exit in case sig_send returns from handling a stack overflow SIGSEGV. Explain why. (dumpstack_overflow_wrapper): Thread wrapper to create a stackdump from another thread. (signal_exit): Fix argument list to reflect three-arg signal handler. In case we have to create a stackdump for a stack overflow condition, do so from a separate thread. Explain why. (sigpacket::process): Don't run signal_exit on alternate stack. (altstack_wrapper): Wrapper function to do stack correction when calling the signal handler on an alternate stack to handle a stack overflow. Make sure to have lots of comments. (_cygtls::call_signal_handler): Drop local context variable to reduce stack pressure. Use this->context instead. Change inline assembler to call altstack_wrapper. (_cygtls::signal_debugger): Accommodate aforementioned change to struct _cygtls. * tlsoffset.h: Regenerate. * tlsoffset64.h: Regenerate. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Document previous changeCorinna Vinschen2015-07-011-0/+3
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>