* uinfo.cc (pwdgrp::fetch_account_from_windows): Only create 1-5-32-x
SIDs from ids for x <= 999.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* sec_acl.cc (get_posix_access): In case owner SID == group SID, when
encountering the group entry, change the value of `id' accordingly.
Explain why.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* cygtls.h (_cygtls::wait_signal_arrived): Renamed from
set_signal_arrived.
(_cygtls::set_signal_arrived): New function signalling signal_arrived.
(_cygtls::reset_signal_arrived): Don't reset will_wait_for_signal.
(_cygtls::unwait_signal_arrived): New function only resetting
will_wait_for_signal.
(class wait_signal_arrived): Rename from set_signal_arrived.
Accommodate name change throughout Cygwin.
(wait_signal_arrived::~wait_signal_arrived): Call
_cygtls::unwait_signal_arrived. Add comment.
* cygserver_ipc.h (ipc_set_proc_info): Fetch signal_arrived handle
via call to _cygtls::get_signal_arrived.
* exceptions.cc (_cygtls::interrupt_setup): Signal signal_arrived via
call to _cygtls::set_signal_arrived.
(_cygtls::handle_SIGCONT): Ditto.
* fhandler_socket.cc (fhandler_socket::wait_for_events): Generate
WSAEVENT array prior to entering wait loop. Add cancel event object
if available. Remove calls to pthread_testcancel and just call
pthread::static_cancel_self if the cancel event object is signalled.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* nlsfuncs.cc (setlocaleinfo): New macro calling __setlocaleinfo.
(__setlocaleinfo): New function to set a locale-specific character
to an explicit wchar_t value.
(__set_lc_numeric_from_win): Handle fa_IR and ps_AF locales to return
same decimal point and thousands separator characters as on Linux.
(__set_lc_monetary_from_win): Ditto for monetary characters.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* sec_acl.cc (get_posix_access): Skip merging permissions if current
user has rwx permissions anywa, or if the sum of all group and other
permissions is less than or equal to the user's permissions.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* sec_acl.cc (get_posix_access): Fix computation of effective user
permissions to handle current user, not only the file owner.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* fhandler_tty.cc (fhandler_pty_slave::open): Add S_IFCHR flag
in call to create_object_sd_from_attribute.
(fhandler_pty_slave::fstat): Ditto in call to get_object_attribute.
(fhandler_pty_slave::fchmod): Add an orig_mode flag and ditto for
both calls.
(fhandler_pty_master::setup): Ditto in call to
create_object_sd_from_attribute.
* security.cc (get_object_attribute): Never add S_IFCHR to mode
here. Let the caller decide.
(create_object_sd_from_attribute): Ditto.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* security.h (authz_get_user_attribute): Declare bool.
* sec_helper.cc (authz_ctx::get_user_attribute): Make bool method.
Set S_IxOTH bits in returned attributes rather than S_IxUSR bits.
(authz_get_user_attribute): Make bool function.
* sec_acl.cc (get_posix_access): Introduce cygsid array to keep
track of all SIDs in the ACL. Move AuthZ calls into !new_style
permission post processing. When not using AuthZ, use
CheckTokenMembership to collect group permissions.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (fhandler_disk_file::fchmod): Disable
deviation from POSIX 1003.1e in terms of GROUP_OBJ/CLASS_OBJ
permissions. Follow POSIX 1003.1e again. Keep old code in
for future reference.
* sec_acl.cc: Accommodate changes in ACE creation in leading
comment.
(set_posix_access): Fix user deny ACE creation. Split group
deny ACE creation into two steps, one to reflect CLASS_OBJ,
the other to reflect OTHER_OBJ.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
- New, unified implementation of POSIX permission and ACL handling. The
new ACLs now store the POSIX ACL MASK/CLASS_OBJ permission mask, and
they allow to inherit the S_ISGID bit. ACL inheritance now really
works as desired, in a limited, but theoretically equivalent fashion
even for non-Cygwin processes.
To accommodate Windows default ACLs, the new code ignores SYSTEM and
Administrators group permissions when computing the MASK/CLASS_OBJ
permission mask on old ACLs, and it doesn't deny access to SYSTEM and
Administrators group based on the value of MASK/CLASS_OBJ when
creating the new ACLs.
The new code now handles the S_ISGID bit on directories as on Linux:
Setting S_ISGID on a directory causes new files and subdirs created
within to inherit its group, rather than the primary group of the user
who created the file. This only works for files and directories
created by Cygwin processes.
2015-05-29 Corinna Vinschen <corinna@vinschen.de>
Reapply POSIX ACL changes.
* utils.xml (setfacl): Show new option output.
(getfacl): Show new option output.
* sec_acl.cc (get_posix_access): Check for Cygwin "standard" ACL.
Apply umask, if so. Align comments.
* security.cc (set_created_file_access): Fix permission masking by
incoming requested file mode.
* sec_acl.cc (set_posix_access): Apply mask only in terms of execute bit
for SYSTEM and Admins group.
* sec_acl.cc (set_posix_access): Don't create DENY ACEs for USER and
GROUP entries if they are the same as USER_OBJ or GROUP_OBJ.
* fhandler.h (fhandler_pty_slave::facl): Add prototype.
* fhandler_tty.cc (fhandler_pty_slave::facl): New method.
(fhandler_pty_slave::fchown): Fix uid/gid handling.
* sec_acl.cc (set_posix_access): Drop superfluous class_idx variable.
Simplify and move around code in a few places. To improve ACL
readability, add r/w permissions to Admins ACE appended to pty ACL.
Add comment to explain Windows ACE Mask filtering being in the way of
creating a real CLASS_OBJ.
(get_posix_access): Fake CLASS_OBJ for ptys. Explain why.
* security.cc (get_object_attribute): Add S_IFCHR flag to attributes
when calling get_posix_access.
* sec_acl.cc (set_posix_access): Move merging group perms into owner
perms in case of owner == group after mask has been computed. Take
mask into account when doing so to avoid unnecessary ACCESS_DENIED_ACE.
* sec_acl.cc (get_posix_access): Only set saw_group_obj flag if we saw
the ACCESS_ALLOWED_ACE.
* fhandler_disk_file.cc (fhandler_disk_file::fchmod): Deliberatly
set GROUP_OBJ and CLASS_OBJ perms to new group perms. Add comment
to explain why.
* security.cc (set_created_file_access): Ditto.
* sec_acl.cc (set_posix_access): Replace previous patch. Return
EINVAL if uid and/or guid is invalid and not backed by an actual
Windows account.
* sec_acl.cc (set_posix_access): Workaround owner/group SIDs being NULL.
* sec_acl.cc (set_posix_access): Handle files with owner == group.
Rephrase switch statement checking against unfiltered a_type value.
(get_posix_access): Handle files with owner == group.
* sec_acl.cc (get_posix_access): Don't use GROUP_OBJ access to fix up
CLASS_OBJ mask on old-style ACLs. Fix a comment.
* sec_acl.cc (set_posix_access): Always make sure Admins have
WRITE_DAC and WRITE_OWNER permissions.
* security.h (create_object_sd_from_attribute): Drop handle parameter
from prototype.
* security.cc (create_object_sd_from_attribute): Drop handle parameter.
Just create the standard POSIXy security descriptor.
(set_object_attribute): Accommodate dropped paramter in call to
create_object_sd_from_attribute.
* fhandler_tty.cc: Ditto, throughout.
* fhandler_disk_file.cc (fhandler_disk_file::fchmod): Fix typo in
mask computation.
* fhandler.cc (fhandler_base::open_with_arch): Call open with mode
not umasked.
(fhandler_base::open): Explicitely umask mode on NFS here. Call new
set_created_file_access rather than set_file_attribute.
* fhandler_disk_file.cc (fhandler_disk_file::fchmod): Reimplement
setting permissions on filesystems supporting ACLs using the new
set_posix_access call.
(fhandler_disk_file::fchown): Ditto.
(fhandler_disk_file::mkdir): Call new set_created_file_access rather
than set_file_attribute.
* fhandler_socket.cc (fhandler_socket::bind): Don't umask here. Add
WRITE_OWNER access to allow writing group in case of SGID bit set.
Call new set_created_file_access rather than set_file_attribute.
* path.cc (symlink_worker): Call new set_created_file_access rather
than set_file_attribute.
* sec_acl.cc (searchace): Un-staticize.
(set_posix_access): New, complementary functionality to
get_posix_access.
(setacl): Implement in terms of get_posix_access/set_posix_access.
(get_posix_access): Add handling for just created files requiring
their first Cygwin ACL. Fix new_style recognition. Handle SGID
bit. For old-style ACLs, ignore SYSTEM and Administrators when
computing the {DEF_}CLASS_OBJ perms.
* security.cc (get_file_sd): Revamp comment. Change and (hopefully)
speed up inheritance processing for just created files.
(alloc_sd): Remove.
(set_security_attribute): Call set_posix_access instead of alloc_sd.
(get_object_attribute): Fix return value.
(create_object_sd_from_attribute): Call set_posix_access instead of
alloc_sd.
(set_file_attribute): Remove.
(set_created_file_access): New function implemented in terms of
get_posix_access/set_posix_access.
* security.h (set_file_attribute): Remove prototype.
(set_created_file_access): Add prototype.
(searchace): Ditto.
(set_posix_access): Ditto.
* syscalls.cc (open): Call open_with_arch with mode not umasked.
* sec_acl.cc: Change preceeding comment explaining new-style ACLs.
Describe how to generate deny ACEs in more detail. Accommodate the
fact that a NULL deny ACE is used for {DEF_}CLASS_OBJ, rather than
a special Cygwin ACE. Improve further comments.
(CYG_ACE_NEW_STYLE): Define.
(get_posix_access): Change from Cygwin ACE to NULL deny ACE. Fix
CLASS_OBJ handling to generate CLASS_OBJ and DEF_CLASS_OBJ from a single
NULL deny ACE if the inheritance flags say so.
* sec_helper.cc (well_known_cygwin_sid): Remove.
* security.h (well_known_cygwin_sid): Drop declaration.
* sec_acl.cc (CYG_ACE_ISBITS_TO_WIN): Fix typo.
(get_posix_access): Rename index variable from i to idx. Define only
once at top level.
* security.cc (add_access_allowed_ace): Drop unused parameter "offset".
Accommodate throughout.
(add_access_denied_ace): Ditto.
* sec_acl.cc: Accommodate above change throughout.
* security.h (add_access_allowed_ace): Adjust prototype to above change.
(add_access_denied_ace): Ditto.
* sec_acl.cc (get_posix_access): Handle multiple ACEs for the
owner and primary group of the file. Handle the default primary
group ACE as DEF_GROUP_OBJ entry if the directory has the S_ISGID bit
set. Add comments. Minor code rearrangements.
Preliminary read side implementation of new permission handling.
* acl.h (MAX_ACL_ENTRIES): Raise to 2730. Add comment to explain.
* sec_acl.cc: Add leading comment to explain new ACL style.
Add definitions and macros to use for bits in new Cygwin ACL.
(DENY_RWX): New mask value for all temporary deny bits.
(getace): Add bool parameter to decide when leaving all bits intact,
rather than filtering them per the already set bits.
(get_posix_access): New function, taking over functionality to read
POSIX ACL from SECURITY_DESCRIPTOR.
(getacl): Just call get_posix_access.
* sec_helper.cc (well_known_cygwin_sid): Define.
* security.cc (get_attribute_from_acl): Remove.
(get_info_from_sd): Remove.
(get_reg_sd): Call get_posix_access instead of get_info_from_sd.
(get_file_attribute): Ditto.
(get_object_attribute): Ditto.
* security.h (well_known_cygwin_sid): Declare.
(get_posix_access): Add prototype.
* Throughout, use simpler ACE macros from Windows' accctrl.h.
* getfacl.c (main): Special-case SYSTEM and Admins group. Add comments.
* setfacl.c: Align more to Linux tool.
(delacl): New function to delete acl entries only.
(modacl): Drop delete functionality. Add handling of recomputing the
mask and default mask values.
(delallacl): Rename from delacl.
(setfacl): Call delacl in Delete case. Call delallacl in DeleteAll
and DeleteDef case.
(usage): Accommodate new options. Rearrange and rephrase slightly.
(longopts): Emit 'x' in --delete case. Add --no-mask and --mask
options.
(opts): Add -x and -n options.
(main): Handle -d and -x the same. Handle -n and --mask options.
Drop handling for -r option.
* getfacl.c (usage): Align more closely to Linux version. Add new
options -c, -e, -E. Change formatting to accommodate longer options.
(longopts): Rename --noname to --numeric. Keep --noname for backward
compatibility. Add --omit-header, --all-effective and --no-effective
options.
(opts): Add -c, -e and -E option.
(main): Handle new -c, -e, and -E options.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* path.cc (symlink_native): Don't generate native symlink targeting
Cygwin special file. Inform the caller.
(symlink_worker): Don;t bail out in WSYM_nativestrict case if the
target is a Cygwin special file.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* init.cc (munge_threadfunc): Don't call NtQueryInformationThread with
ThreadQuerySetWin32StartAddress info class on XP 64 and Server 2003 64.
It crashes.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* sigproc.cc (pending_signals::clear): Yet another fix to fix the fix.
Actually iterate over the list of pending signals even if there's a
signal which doesn't have to be cleared. Other than that, revert loop
to it's former self as a while loop.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* nlsfuncs.cc (__get_lcid_from_locale): Handle LocaleNameToLCID
returning LOCALE_CUSTOM_UNSPECIFIED instead of failing in case of
an unsupported locale on Windows 10.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* signal.cc (sigwait): Fix return value to reflect errno in case of
error according to POSIX. Never return EINTR.
* thread.cc (pthread_kill): Return errno if sig_send failed.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* init.cc (munge_threadfunc): Check that we're actually replacing
the correct original function address on the stack.
* ntdll.h (enum _THREADINFOCLASS): Add ThreadQuerySetWin32StartAddress.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* strfuncs.cc (sys_cp_wcstombs): Always return number of multibytes
without trailing NUL as the documentation implies. Throughout Cygwin,
fix usage to align to this pattern.
* fhandler_process.cc (format_process_winexename): Drop trailing NUL
and LF from output.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* thread.cc (pthread_getattr_np): Fix memory leak, remove usage of
malloc for small local buffer.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* flock.cc (lockf_t::create_lock_obj_attr): Add buffer parameter.
Call _everyone_sd with buffer argument from caller rather than
everyone_sd with locally allocated stack buffer.
(lockf_t::create_lock_obj): Call create_lock_obj_attr only once
outside the loop and with additional buffer argument.
(lockf_t::open_lock_obj): Call create_lock_obj_attr with additional
buffer argument.
* include/sys/unistd.h (_SC_LEVEL*): Add cache-related variables as
on Linux.
* fhandler_proc.cc (format_proc_cpuinfo): Fetch cache information
from new cache functions in sysconf.cc, get_cpu_cache_intel and
get_cpu_cache_amd.
* sysconf.cc (__nt_query_system): New local helper.
(get_nproc_values): Utilize __nt_query_system on pre-Windows 7 systems.
Use GetLogicalProcessorInformationEx otherwise to handle more than
64 CPUs. Only handle _SC_NPROCESSORS_CONF and _SC_NPROCESSORS_ONLN.
(get_phys_pages): New helper to handle _SC_PHYS_PAGES.
(cpuid2_cache_descriptor): New array to map Intel CPUID 2 descriptor
values to cache type, cache size, associativity and linesize.
(cpuid2_cache_desc_compar): Comparision function for bsearch over
cpuid2_cache_descriptor.
(get_cpu_cache_intel_cpuid2): New function to fetch cache info from
Intel CPUID 2.
(get_cpu_cache_intel_cpuid4): Ditto from Intel CPUID 4.
(get_cpu_cache_intel): New function as CPU-specific entry point.
(assoc): New array to map associativity values from AMD CPUID
0x80000006.
(get_cpu_cache_amd): New function to fetch cache info from AMD CPUIDs
0x80000005 and 0x80000006.
(get_cpu_cache): New function to fetch cache info.
(sca): Call get_phys_pages if _SC_PHYS_PAGES is requested. Call
get_cpu_cache for new _SC_* cache requests.
(SC_MAX): Set to _SC_LEVEL4_CACHE_LINESIZE.
(get_phys_pages(void)): Call get_phys_pages(int).
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
* new-features.xml (ov-new2.3): Document sysconf cache addition.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* fhandler_proc.cc (format_proc_cpuinfo): Only fetch group relations,
we don't need anything else.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* winsup.h (_WIN32_WINNT): Set to 0x0a00 for Windows 10.
(WINVER): Ditto. Remove outdated comment.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
System DLLs are always first in the DLL search order so
http://www.microsoft.com/technet/security/advisory/2269637.mspx
doesn't apply for them.
* autoload.cc (std_dll_init): Revert using full paths to system DLLs.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This fixes a long-standing problem when GetProcAddress fails
to load a function. The noload code calls SetLastError on
i686 without saving the edx register. Starting with Windows 7,
SetLastError apparently uses $edx and the register is set to
0x00000000 on return. So the subsequent `jmp *$edx' in noload
supposed to return to the caller, actually jumps to address NULL,
which results in a SEGV.
* autoload.cc (noload): i686 only: Save and restore $edx when calling
SetLastError to avoid clobbering return address stating with Windows 7.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* 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>
* 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>
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>
* 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>
* 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>
* 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>
* 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>
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>
* 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>
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>
* 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>
* 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>
* 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>
* 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>
* 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>
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>
* 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>
* 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>
* fork.cc (frok::parent): Set stacktop value based on requested stack
pointer value in child. Explain why.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* exceptions.cc (_cygtls::call_signal_handler): Drop manipulating
thread's ss_flags here. It's not safe against longjmp.
* signal.cc (sigaltstack): Check if we're running on the alternate
stack and set ss_flags returned in oss to SS_ONSTACK.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/signal.h: Revert to define MINSIGSTKSZ and SIGSTKSZ
here with bigger values to allow _cygtls to reside on signal stack,
should it turn out to be required at one point.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* resource.cc (getrlimit): Fix values returned by RLIMIT_STACK.
Explain why this had to be changed.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* exceptions.cc (_cygtls::call_signal_handler): Drop pushing a register
on the original stack, it confuses GCC. Rearrange the assembler code
so that $rax/$eax is not used by GCC to prepare an argument value.
Use $rax/$eax without saving. Drop clearing $rbp/$epb.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* exceptions.cc (_cygtls::call_signal_handler): Drop subtracting 16
bytes from the alternate stack, it's not necessary. Safe all clobbered
registers. Safe one on the orignal stack, the others on the alternate
stack on both platforms.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (LOCK_EVENTS): Don't enter critical section with
invalid mutex handle since then socket has been closed.
(UNLOCK_EVENTS): Close critical section.
(fhandler_socket::evaluate_events): Handle calling connect on shutdown
socket.
(fhandler_socket::wait_for_events): Try for pthread_testcancel in case
of WAIT_FAILED. Try to come up with a better errno in case we waited
on an invalid handle.
(fhandler_socket::release_events): Change wsock_mtx and wsock_evt to
NULL under lock to avoid accessing invalid handle.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* exceptions.cc (_cygtls::call_signal_handler): Disable enforcing
SA_RESTART in non-main threads to allow returning with EINTR from
system calls.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* pinfo.cc (_pinfo::root): Fake default root for native processes.
(open_commune_proc_parms): New helper function to access process
parameter block.
(_pinfo::cwd): Fetch missing cwd for native processes from processes
parameter block.
(_pinfo::cmdline): Ditto for command line.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* path.cc (path_conv::set_nt_native_path): New function.
* path.h (path_conv::set_nt_native_path): Add prototype.
* syscall.cc (try_to_bin): Handle moving files to the recycler
accessed via a local virtual drive (subst). Fix a problem renaming
the file to the unique replacement name on Samba. Align comment.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* fhandler_tty.cc (fhandler_pty_slave::fch_close_handles): Don't close
handles not opened via fhandler_pty_slave::fch_open_handles.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (class fhandler_base): Add virtual function
get_io_handle_cyg() to get handle from which OPOST-processed output is
read on PTY master.
(class fhandler_pty_slave): Add variable output_handle_cyg to store a
handle to which OPOST-processed output is written. Add two functions,
i.e., set_output_handle_cyg() and get_output_handle_cyg(), regarding
variable output_handle_cyg. Now, output_handle is used only by native
windows program. The data before OPOST-processing is written to
output_handle and OPOST-processing is applied in the master-side. For a
cygwin process, OPOST-processing is applied in the slave-side, and the
data after OPOST-processing is written to output_handle_cyg.
(class fhandler_pty_master): Add two variables, i.e., io_handle_cyg and
to_master_cyg, to store handles of a pipe through which OPOST-processed
output passes. Add pty_master_fwd_thread and function
pty_master_fwd_thread() for a thread which applies OPOST-processing
and forwards data from io_handle to to_master_cyg. Add function
get_io_handle_cyg() regarding variable io_handle_cyg. Now, the pipe
between io_handle and to_master are used only by native windows program
for applying OPOST-processing in the master-side. For a cygwin process,
the pipe between io_handle_cyg and to_master_cyg is used for passing
through the data which is applied OPOST-processing in the slave-side.
* fhandler_tty.cc (struct pipe_reply): Add member to_master_cyg.
(fhandler_pty_master::process_slave_output): Read slave output from
io_handle_cyg rather than io_handle.
(fhandler_pty_slave::fhandler_pty_salve): Initialize output_handle_cyg.
(fhandler_pty_slave::open): Set output_handle_cyg by duplicating handle
to_master_cyg on PTY master.
(fhandler_pty_slave::close): Close handle output_handle_cyg.
(fhandler_pty_slave::write): Write data to output_handle_cyg rather
than output_handle.
(fhandler_pty_slave::fch_close_handles): Close handle output_handle_cyg.
(fhandler_pty_master::fhandler_pty_master): Initialize io_handle_cyg,
to_master_cyg and master_fwd_thread.
(fhandler_pty_master::cleanup): Clean up to_master_cyg as well.
(fhandler_pty_master::close): Print to_master_cyg as well in debug
message. Terminate master forwarding thread. Close handles
to_master_cyg and io_handle_cyg.
(fhandler_pty_master::ioctl): Use io_handle_cyg rather than to_master.
(fhandler_pty_master::pty_master_thread): Add code for duplicating
handle to_master_cyg.
(fhandler_pty_master::pty_master_fwd_thread): New function for a thread
to forward OPOST-processed data from io_handle to to_master_cyg. This
thread applies OPOST-processing to the output of native windows program.
(::pty_master_fwd_thread): Ditto.
(fhandler_pty_master::setup): Create a new pipe to pass thruegh OPOST-
processed output. Create new thread to forward data from io_handle to
to_master_cyg. Set handle to_master_cyg to tty. Print io_handle_cyg as
well in debug message. Close handles io_handle_cyg and to_master_cyg in
case of error.
(fhandler_pty_master::fixup_after_fork): Set handle to_master_cyg to
tty. Copy handle to_master_cyg from arch->to_master_cyg.
(fhandler_pty_master::fixup_after_exec): Clean up to_master_cyg.
* select.cc: Check handle returned by get_io_handle_cyg() rather than
get_handle().
* tty.h (class tty): Add variable _to_master_cyg to store a handle to
which OPOST-processed data is written. Add two functions,
to_master_cyg() and set_to_master_cyg(), regarding _to_master_cyg.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* path.cc (basename): Undefine basename before defining function to
avoid type collision with prototype in string.h.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* shm.cc (shmget): Fetch segment size from server rather than using
size argument to accommodate existing segments. Add comment to explain
why.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/version.h (CYGWIN_VERSION_DLL_MAJOR): Bump to 2000.
(CYGWIN_VERSION_DLL_MINOR): Set to 0.
* new-features.xml (ov-new2.0): Rename from ov-new1.7.36 and change
version number to 2.0.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* exceptions.cc (call_signal_handler): Only bother to construct
the ucontext for signal handlers with SA_SIGINFO set. Set
mcontext.oldmask.
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
* exceptions.cc (call_signal_handler): Zero initialize context and set
context flags, as RlCaptureContext doesn't.
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Selectively using -fomit-frame-pointer when -O is used doesn't make sense
anymore, apparently since gcc 4.6, -O implies -fomit-frame-pointer.
exceptions.cc must be compiled with -fno-omit-frame-pointer on x86, as it uses
RtlCaptureContext, which requires a frame pointer.
* Makefile.in : Remove setting -fomit-frame-pointer for compiling
various files, it is already the default. Set
-fno-omit-frame-pointer for exceptions.cc on x86.
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
* fhandler_tty.cc (fhandler_pty_slave::read): Change calculation of
"readlen" not to use "bytes_in_pipe" value directly.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
On x86_64, RtlCaptureContext() uses fxsave to save FPU/MMX/SSE state.
fxsave requires that the destination address is 16-byte aligned, or it will
fault.
CONTEXT is already annotated __attribute__ ((aligned (16))), do the same with
struct _mcontext.
Rearrange ucontext_t so that it's struct _mcontext element is also correctly
aligned.
* include/cygwin/signal.h (struct __mcontext): 16-byte align.
* include/sys/ucontext.h (ucontext_t): Ditto.
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
* include/cygwin/types.h: Include sys/_stdint.h rather than stdint.h.
* include/stdint.h: Drop in favor of newlib version.
* include/inttypes.h: Ditto.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Add ucontext.h header, defining ucontext_t and mcontext_t types.
Provide sigaction sighandlers with a ucontext_t parameter, containing stack and
context information.
* include/sys/ucontext.h : New header.
* include/ucontext.h : Ditto.
* exceptions.cc (call_signal_handler): Provide ucontext_t
parameter to signal handler function.
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
* external.cc (cygwin_internal): Add operation to retrieve a copy
of the EXCEPTION_RECORD from a siginfo_t *.
* include/sys/cygwin.h (cygwin_getinfo_types): Ditto.
* exception.h (cygwin_exception): Add exception_record accessor.
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
* include/cygwin/signal.h : Rename struct ucontext to struct
__mcontext. Fix layout differences from the Win32 API CONTEXT
type. Remove unused member _internal. Rename member which
corresponds to ContextFlags. Add cr2 member.
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
winsup/cygwin/
* common.din (__gnu_basename): Export.
* path.cc (__gnu_basename): New function.
winsup/doc/
* posix.xml (std-gnu): Add basename.
(std-notes): Add note about two forms of basename.
* cygheap.h (cygheap_domain_info::add_domain): Add prototype.
* uinfo.cc (cygheap_domain_info::add_domain): New method.
(pwdgrp::fetch_account_from_windows): Try to add domain explicitely
if it was not in the original list of trusted domains and go ahead
rather than bailing out. Add comment to explain why.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* cygtls.h (struct _cygtls): Convert thread_context to type CONTEXT.
* exceptions.cc (_cygtls::signal_debugger): Use sizeof (CONTEXT) for
size of CONTEXT copied for GDB's digestion.
* include/cygwin/signal.h: Add a preliminary comment.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* tty.h (class tty_min): Remove variable "write_error" to which any
errors are not currently set at anywhere.
(class tty): Add variable "column" for handling ONOCR.
* tty.cc (tty::init): Add initialization code for variable "column".
* fhandler.h (class fhandler_pty_master): Remove variable "need_nl"
which is not necessary any more. "need_nl" was needed by OPOST process
in fhandler_pty_master::process_slave_output().
(class fhandler_pty_common): Add function process_opost_output() for
handling post processing for OPOST in write process.
* fhandler_tty.cc (fhandler_pty_master::process_slave_output): Count
TIOCPKT control byte into length to be read in TIOCPKT mode. Move
post processing for OPOST to write process. Remove code related to
variable "write_error". Return with EIO error if slave is already
closed.
(fhandler_pty_master::fhandler_pty_master): Remove initialization
code for variable "need_nl".
(fhandler_pty_common::process_opost_output): Add this function for
handling of OPOST in write process. Add code to avoid blocking in
non-blocking mode when output is suspended by ^S.
(fhandler_pty_slave::write): Call fhandler_pty_common::
process_opost_output() instead of WriteFile(). Remove code related to
variable "write_error".
(fhandler_pty_master::doecho): Call fhandler_pty_common::
process_opost_output() instead of WriteFile().
* select.cc (peek_pipe): Remove code related to variable "need_nl".
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Per glibc BZ #15366:
* inttypes.h: Drop __STDC_FORMAT_MACROS consideration.
* stdint.h: Drop __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS
consideration.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This improves how stackinfo::dumpstack() dumps _sigbe and sigdelayed frames
* exceptions.cc (stack_info): Add sigstackptr member.
(walk): Unwind sigstackptr inside _sigbe and sigdelayed.
* gendef (_sigdelayed_end): Add symbol to mark end of sigdelayed.
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
(tty::is_master_closed): Drop method.
* fhandler_tty.cc (fhandler_pty_slave::open): Remove code prematurely
bailing out if master control thread is not running.
(fhandler_pty_slave::read): Don't generate SIGHUP if master control
thread is not running.
(fhandler_pty_master::close): Rearrange code to avoid stopping master
control thread twice in multi-threaded scenarios.
(class fhandler_pty_master): Add echo_r and echo_w handles constituting
read and write side of new echo pipe.
* select.cc (peek_pipe): On pty masters, check additionally if input
from the echo pipe is available.
* fhandler_tty.cc (fhandler_pty_master::doecho): Drop output_mutex
locking. Write output to echo pipe.
(fhandler_pty_master::process_slave_output): Check if input is available
in echo pipe and prefer to read from it, if so.
(fhandler_pty_slave::write): Drop output_mutex locking.
(fhandler_pty_master::fhandler_pty_master): Initialize echo pipe
handles to NULL.
(fhandler_pty_master::close): Close and NULL echo pipe handles.
(fhandler_pty_master::setup): Create echo pipe, close in case of error.
case owner SID == group SID.
(getacl): Reverse order of SID test against group or owner sid to
prefer owner attributes over group attributes. Disable setting group
permissions equivalent to owner permissions if owner == group. Add
comment to explain why. Fix indentation.
* security.cc (get_attribute_from_acl): Change type of local variables
containing permission to mode_t. Apply deny mask to group if group SID
== owner SID to avoid Everyone permissions to spill over into group
permissions. Disable setting group permissions equivalent to owner
permissions if owner == group. Add comment to explain why.
* uinfo.cc (pwdgrp::fetch_account_from_windows): Allow user SID as
group account if user is a "Microsoft Account". Explain why. Drop
workaround enforcing primary group "Users" for "Microsoft Accounts".
cygwait should be in EINTR or in restart mode. Call signal handler
if in EINTR mode.
(mq_getattr): Call ipc_mutex_lock in restart mode.
(mq_setattr): Ditto.
(mq_notify): Ditto.
(_mq_send): Call ipc_mutex_lock in EINTR mode.
(_mq_receive): Ditto.
(class cyg_ldap): Remove members srch_msg and srch_entry.
(cyg_ldap::get_string_attribute): Remove private method taking index
argument.
(cyg_ldap::get_num_attribute): Ditto. Add method taking attribute name.
(cyg_ldap::get_primary_gid): Adjust to aforementioned change.
(cyg_ldap::get_unix_uid): Ditto.
(cyg_ldap::get_unix_gid): Ditto.
* ldap.cc: Throughout, use msg and entry in place of srch_msg and
srch_entry.
(std_user_attr): Add sAMAccountName and objectSid.
(group_attr): Ditto.
(cyg_ldap::close): Drop handling of srch_msg and srch_entry.
(cyg_ldap::get_string_attribute): Move earlier in file.
(cyg_ldap::get_num_attribute): Ditto.
(cyg_ldap::enumerate_ad_accounts): Add comments for clarity.
Use group_attr or user_attr rather than sid_attr to fetch all desired
attributes for an account right away.
(cyg_ldap::next_account): Store found SID in last_fetched_sid to
skip calls to fetch_ad_account from fetch_account_from_windows.
(cyg_ldap::get_string_attribute): Remove method taking index argument.
(cyg_ldap::get_num_attribute): Ditto.
* pwdgrp.h (class pg_ent): Fix formatting. Add member dom.
* passwd.cc (pg_ent::enumerate_ad): Store current flat domain name
in dom. Construct fetch_acc_t argument from LDAP attributes and
call fetch_account_from_windows with that.
* userinfo.h (enum fetch_user_arg_type_t): Rename FULL_grp_arg to
FULL_acc_arg. Change throughout.
(struct fetch_acc_t): Rename from fetch_full_grp_t. Change throughout.
(struct fetch_user_arg_t): Rename full_grp to full_acc. Change
throughout.
* fhandler.cc (fhandler_base::set_flags): Set was_nonblocking if the
O_NONBLOCK flag has been specified.
(fhandler_base_overlapped::close): Check for was_nonblocking instead
of for is_nonblocking. Explain why.
(fhandler_base::set_nonblocking): Set was_nonblocking if noblocking
mode gets enabled.
* cygserver_pwdgrp.h: Include userinfo.h. Drop workaround defining
fetch_user_arg_type_t locally.
* grp.cc (internal_getgrsid_cachedonly): New function.
(internal_getgrfull): Ditto.
(internal_getgroups): Rearrange function. Center around fetching all
cached group info first, calling LsaLookupSids on all so far non-cached
groups second. Pass all available info to new internal_getgrfull call.
* pwdgrp.h: Include userinfo.h. Move definitions of
fetch_user_arg_type_t and fetch_user_arg_t there.
(pwdgrp::add_group_from_windows): Declare with getting full group info.
Called from internal_getgrfull.
* uinfo.cc (pwdgrp::add_group_from_windows): Define.
(pwdgrp::fetch_account_from_line): Add default case.
(pwdgrp::fetch_account_from_file): Ditto.
(pwdgrp::fetch_account_from_windows): Handle FULL_grp_arg.
(client_request_pwdgrp::client_request_pwdgrp): Add default case.
* userinfo.h: New header.
(enum fetch_user_arg_type_t): Add FULL_grp_arg.
(struct fetch_full_grp_t): New datatype.
to explain the meaning of the possible values.
* cygwait.cc (is_cw_sig_restart): Define.
(is_cw_sig_handle): Check for cw_sig_restart as well.
(cygwait): Restart always if cw_sig_restart is set.
* thread.cc (pthread::join): Call cygwait with cw_sig_restart flag
to avoid having to handle signals at all.
* include/cygwin/stdlib.h (initstate, random, setstate, srandom):
Check if __XSI_VISIBLE is set by sys/cdefs.h, rather than testing
for _XOPEN_SOURCE directly, to work correctly when _GNU_SOURCE is
set.
(cyg_ldap::search_s): Add parameter scope. Use as LDAP search scope
instead of fixed LDAP_SCOPE_SUBTREE scope.
(ldap_search_thr): Call cyg_ldap::search_s with scope from argument.
(cyg_ldap::search): Add parameter scope and fill in to cyg_ldap_search.
(cyg_ldap::fetch_ad_account): Call search with LDAP_SCOPE_SUBTREE scope.
(cyg_ldap::fetch_posix_offset_for_domain): Call search with
LDAP_SCOPE_ONELEVEL scope.
(cyg_ldap::fetch_unix_sid_from_ad): Call search with LDAP_SCOPE_SUBTREE
scope.
(cyg_ldap::fetch_unix_name_from_rfc2307): Ditto.
* ldap.h (cyg_ldap::search): Align prototype to above change.
(cyg_ldap::search_s): Ditto.
throughout.
* ldap.cc (cyg_ldap::open): Fix debug output.
(cyg_ldap::fetch_ad_account): Rename rdse to base. Restrict LDAP
query to users and groups only.
(cyg_ldap::enumerate_ad_accounts): Rearrange filter expression for
user accounts.
(SYSTEM_CONTAINER): New macro.
(cyg_ldap::fetch_posix_offset_for_domain): Set base in LDAP search
to the "System" container in the default naming context to restrict
the search scope.
(cyg_ldap::fetch_unix_sid_from_ad): Add objectCategory=Person to
search filter for users.
suffix and make private. Rename normalized_path to posix_path and
make privtae. Accommodate name changes throughout in path_conv
methods.
(path_conv::known_suffix): New method. Use throughout instead of
accessing suffix directly.
(path_conv::get_win32): Constify.
(path_conv::get_posix): New method to read posix_path. Use throughout
instead of accessing normalized_path directly.
(path_conv::set_posix): Rename from set_normalized_path. Accommodate
name change throughout.
* spawn.cc (find_exec): Return POSIX path, not Win32 path.
declaration in ldap-related method.
(cygheap_pwdgrp::get_shell): Ditto.
(cygheap_pwdgrp::get_gecos): Ditto.
* ldap.cc (cyg_ldap::open): Use NO_ERROR instead of 0.
(cyg_ldap::close): Reset last_fetched_sid.
(cyg_ldap::fetch_ad_account): Return immediately if sid is the same as
last_fetched_sid. Open LDAP connection from here. Move initialization
of rdse after open call. Set last_fetched_sid if LDAP call was
successful.
* ldap.h (class cyg_ldap): Add member last_fetched_sid.
(cyg_ldap::cyg_ldap): Initialize last_fetched_sid.
(cyg_ldap::is_open): New inline method.
* uinfo.cc (cygheap_pwdgrp::init): Drop initialization of db_home,
db_shell and db_gecos with "cygwin desc", thus only using the fallback
by default.
(fetch_windows_home): Add parameter dnsdomain. Call
cyg_ldap::fetch_ad_account if required.
(fetch_from_path): Add parameter dnsdomain. Call fetch_windows_home
accordingly.
(cygheap_pwdgrp::get_home): Accomodate call to fetch_windows_home.
Add dnsdomain parameter in ldap-related method. Call
cyg_ldap::fetch_ad_account if required.
(cygheap_pwdgrp::get_shell): Ditto.
(cygheap_pwdgrp::get_gecos): Ditto.
(pwdgrp::fetch_account_from_windows): Drop cyg_ldap::open call prior to
cyg_ldap::fetch_ad_account call. Set is_current_user to true if we're
handling the current user account. Make sure to perform the LDAP calls
only for users, and only if required.
(gfpod_helper): Drop equality sign from environment variable name
in call to check_path_access.
* exec.cc (execlp): Drop equality sign from environment variable name
in call to find_exec.
(execvp): Ditto.
(execvpe): Ditto.
* path.h (enum fe_types): Drop FE_NATIVE.
(find_exec): Rename third paramter in declaration from search. Drop
equality sign from default value.
* spawn.cc (perhaps_suffix): Add PC_POSIX to path_conv::check call.
(find_exec): Simplify function. Iterate over POSIX pathlist rather
than Windows pathlist. Drop handling of FE_NATIVE flag. Always fill
posix path of incoming path_conv buf, unless FE_NNF flag is given.
(av::setup): Drop equality sign from environment variable name
in call to find_exec. Call unshift with normalized_path.
* winf.cc (av::unshift): Drop conv parameter and code converting
Windows to POSIX path.
* winf.h (av::unshift): Accommodate prototype.
with version information. Use throughout.
(clean): Drop winver_stamp.
(version.cc winver.o): Drop empty rule.
(winver_stamp): Convert to rule targeting version.cc and winver.o
directly. Drop touching winver_stamp. Fix typo.
* fhandler_process.cc (process_tab): Fix indentation.
(fhandler_process::exists): Rely on format_process_fd returning file
type in fd_type.
(struct process_fd_t): Add fd_type member.
(fhandler_process::fill_filebuf): Allow format_process_fd to set
this->fd_type member.
(format_process_fd): Fix path evaluation to allow recognizing trailing
path components. Fix check for file descriptor path component. Return
virt_symlink in fd_type if no trailing path compenents exist, return
virt_fsdir otherwise and copy full resulting path into destbuf.
* path.cc (path_conv::check): If /proc/$PID/fd symlink has trailing
path components, reparse resulting path as if it's the incoming path.
Add comment to wail over the outdated and hackish check method, and to
explain what we do here.
(class thread): struct->class. Add prototypes for new private methods
dup_signal_arrived and close_signal_arrived. Implement constructor and
destructor.
2014-11-17, always prepending domain to NT SERVICE accounts when
searching by name. Fix test expression to allow fully qualified
names for NT SERVICE accounts. Extend comment to explain a bit.
(cygheap_pwdgrp::get_gecos): Ditto.
* uinfo.cc (fetch_windows_home): Accept cyg_ldap and PUSER_INFO_3
arguments, and fetch db home dir values right here.
(fetch_from_path): Accept cyg_ldap, PUSER_INFO_3 pointers and sid
arguments. Add '%H' format specifier to fetch Windows home dir in
POSIX notation.
(cygheap_pwdgrp::get_home): Accommodate changes to fetch_windows_home
and fetch_from_path.
(cygheap_pwdgrp::get_shell): Ditto.
(cygheap_pwdgrp::get_gecos): Ditto.
(pwdgrp::fetch_account_from_windows): Accommodate sid argument to
cygheap_pwdgrp::get_shell and cygheap_pwdgrp::get_gecos.
tzinfo from zoneinfo files. Add comment to explain what we do.
(tzparse): Add more comments to explain in case of loading timezone
offset from other sources.
(environ_init): Drop undocumented feature to read application-specific
environment variables from the registry.
* include/cygwin/version.h (CYGWIN_INFO_PROGRAM_OPTIONS_NAME): Remove.
Explain why.
(lockf_t::create_lock_obj): Use FALSE, rather than 0 for BOOL argument.
(lockf_t::del_lock_obj): Check if NtSetEvent succeeded and print system
message if not.
home directory. Include longish comment to explain what we're doing.
(cygheap_pwdgrp::get_home): Take additional sid parameter. In
NSS_SCHEME_WINDOWS case, call fetch_windows_home to create home
directory.
(pwdgrp::fetch_account_from_windows): Call cygheap_pwdgrp::get_home
with additional sid argument.
* cygheap.h (cygheap_pwdgrp::get_home): Align declaration to above
change.
(LoadUserProfileW): Import.
* registry.cc (get_registry_hive_path): Move to sec_auth.cc.
(load_registry_hive): Remove.
* registry.h (get_registry_hive_path): Drop declaration.
(load_registry_hive): Ditto.
* sec_auth.cc (get_user_profile_directory): Moved from registry.cc and
renamed. Take third parameter with buffer length.
(load_user_profile): New function taking over for load_registry_hive.
Use official functions to load profile. If profile is missing, create
it on Vista and later.
* security.h (get_user_profile_directory): Declare.
(load_user_profile): Declare.
* syscalls.cc (seteuid32): Replace call to load_registry_hive with call
to load_user_profile.
* uinfo.cc (cygheap_user::env_userprofile): Replace call to
get_registry_hive_path with call to get_user_profile_directory.
(DestroyEnvironmentBlock): Import.
* environ.cc (env_compare): New static bsearch comparison function.
(build_env): Add parameter taking a user token. If token is non-NULL,
fetch user's default Windows environment and merge it into the resulting
environment. Explain what we do in preceeding comment.
* environ,h (build_env): Align prototype to above change.
* external.cc (create_winenv): Call build_env with NULL token.
* spawn.cc (child_info_spawn::worker): When spawning new process under
another user account, call build_env with new token to allow merging
user's default Windows environment.
* winlean.h (_USERENV_): Define to override dllimport.
(wincaps): Drop has_physical_mem_access.
(wincap_10): New global wincaps to support Windows 10.
(wincapc::init): Use wincap_10 for version >= 6.4 and as default.
* wincap.h (wincaps::has_physical_mem_access): remove.
having a new type threadlist_t *. Convert commented out code into an
#if 0. Create thread mutex. Explain why.
(init_cygheap::remove_tls): Drop timeout value. Always wait infinitely
for tls_sentry. Return mutex HANDLE of just deleted threadlist entry.
(init_cygheap::find_tls): New implementation taking tls pointer as
search parameter. Return threadlist_t *.
(init_cygheap::find_tls): Return threadlist_t *. Define ix as auto
variable. Drop exception handling since crash must be made impossible
due to correct synchronization. Return with locked mutex.
* cygheap.h (struct threadlist_t): Define.
(struct init_cygheap): Convert threadlist to threadlist_t type.
(init_cygheap::remove_tls): Align declaration to above change.
(init_cygheap::find_tls): Ditto.
(init_cygheap::unlock_tls): Define.
* cygtls.cc (_cygtls::remove): Unlock and close mutex when finishing.
* exceptions.cc (sigpacket::process): Lock _cygtls area of thread before
accessing it.
* fhandler_termios.cc (fhandler_termios::bg_check): Ditto.
* sigproc.cc (sig_send): Ditto.
* thread.cc (pthread::exit): Ditto. Add comment.
(pthread::cancel): Ditto.
* cygtls.cc (well_known_dlls): Rephrase comment.
(bloda_detect): New function.
(_cygtls::call2): Call init_thread and bloda_detect for non-pthread
threads only.
(_cygtls::remove): Move remove_tls and remove_wq calls up to run first.
* miscfuncs.cc (struct pthread_wrapper_arg): Rename from struct
thread_wrapper_arg.
(pthread_wrapper): Rename from thread_wrapper and drop "static". Fix
comment. Drop call to _cygtls::remove. Call api_fatal rather than
ExitThread. Explain why.
* miscfuncs.h (pthread_wrapper): Declare pthread_wrapper.
* thread.cc (pthread::exit): Add a FIXME comment. Call _cygtls::remove
before calling ExitThread.
initialize mount table in two steps, system and user, depending on
bool value.
* mount.h (class mount_info): Align declaration of init function to
above change.
* shared.cc (user_info::initialize): Initialize mount table in two
steps to allow internal_getpwsid to create valid POSIX paths from
DOS paths given in AD. Add comments.
* uinfo.cc (cygheap_pwdgrp::get_home): Allow DOS paths in
NSS_SCHEME_FREEATTR attributes.
(cygheap_pwdgrp::get_shell): Ditto.
(install-ldif): New target to install cygwin.ldif.
* cygheap.h (class cygheap_pwdgrp): Rename pfx_t to nss_pfx_t. Add
PFX to enum value. Add nss_scheme_method enum and nss_scheme_t
structure. Add home_scheme, shell_scheme and gecos_scheme members.
(NSS_SCHEME_MAX): Define.
(cygheap_pwdgrp::get_home): Declare.
(cygheap_pwdgrp::get_shell): Declare.
(cygheap_pwdgrp::get_gecos): Declare.
* cygwin.ldif: New file.
* ldap.cc (std_user_attr): New array, just defining the standard
attributes.
(group_attr): Add cygwinUnixGid.
(user_attr): Convert to macro pointing to cygheap->pg.ldap_user_attr.
(cygheap_pwdgrp::init_ldap_user_attr): New method.
(cyg_ldap::fetch_ad_account): Call cygheap_pwdgrp::init_ldap_user_attr
if user_attr initialization is required. Fix comment.
(cyg_ldap::get_string_attribute): Implement taking attribute name
as argument.
* ldap.h: Drop unused macros.
(cyg_ldap::get_gecos): Remove.
(cyg_ldap::get_home): Remove.
(cyg_ldap::get_shell): Remove.
(cyg_ldap::get_string_attribute): Declare name argument variant public.
* uinfo.cc (cygheap_user::ontherange): Fix indentation.
(cygheap_pwdgrp::init): Initialize new home_scheme, shell_scheme and
gecos_scheme members. Align comment.
(NSS_NCMP): Define comparison macro.
(NSS_CMP): Ditto.
(cygheap_pwdgrp::nss_init_line): Use aforementioned macros throughout.
Fix comment handling. Add db_home, db_shell and db_gecos handling.
(fetch_from_description): New function to fetch XML-style attributes
from (description) string.
(fetch_from_path): New function to evaluate path string with wildcards.
(cygheap_pwdgrp::get_home): New methods to fetch pw_dir value.
(cygheap_pwdgrp::get_shell): Ditto for pw_shell.
(cygheap_pwdgrp::get_gecos): Ditto for pw_gecos.
(colon_to_semicolon): Move up.
(pwdgrp::fetch_account_from_windows): Convert home, shell, gecos
variables to char*. Drop statement breaking extended group info.
Fetch home, shell and gecos values using new methods. Use
fetch_from_description calls to fetch UNIX id and primary groups from
SAM comment field. Accommodate uxid being a char* now. Accommodate
the fact that extended info is malloc'ed, rather then alloca'ed.
Create linebuf content as multibyte string. Create line buffer by
just calling cstrdup.
solution.
* miscfuncs.cc (thread_wrapper): Ditto.
* sigproc.cc (exit_thread): Disable sending a signal for synchronization
with process exit. Explain why. Keep code in for later inspection,
should the problem show up again.
(sig_send): Use "tls", rather than "tid" as name for _cygtls arg.
NT SERVICE accounts by name. Always prepend domain to NT SERVICE
accounts. Add U-domain\username string to pw_gecos for predefined
builtin accounts as well.
written bytes.
* fhandler_termios.cc (fhandler_termios::tcinit): Fix formatting.
(fhandler_termios::line_edit): Return bytes actually written. Write
in 32 byte chunks in non-canonical mode to reduce number of WriteFile
calls. Don't just eat unwritten bytes in case of an error condition.
Especially, don't report them back to the caller as written.
* fhandler_tty.cc (fhandler_pty_slave::read): Disable code reducing
the number of bytes read from the pipe to vmin. Add comment.
(fhandler_pty_master::write): Convert ret to ssize_t type. Just call
line_edit once, not in a loop once for each byte. Return bytes written
as returned by line_edit.
API version numbers.
* external.cc (cygwin_internal): disable setting cxx_malloc on 64 bit.
Add CW_FIXED_ATEXIT case.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
* include/sys/cygwin.h (cygwin_getinfo_types): Add CW_FIXED_ATEXIT.
* lib/atexit.c (atexit): Test running Cygwin version by checking
return value of cygwin_internal (CW_FIXED_ATEXIT).
* lib/atexit.c (atexit): New, statically linkable version of atexit.
* dcrt0.cc (cygwin_atexit): Add comment to mark this function as old
entry point. Indiscriminately check for DSO of function pointer for
all functions, if checking for DSO of return address fails on x86_64.
Change comment accordingly.
* path.cc (warn_msdos): Make static. Drop test for dos_file_warning.
(path_conv::check): Check for dos_file_warning here to avoid a function
call in the default case.
(init_cygheap::init_installation_root): Set installation_dir_len.
(setup_cygheap): Drop call to set_dll_dir.
* cygheap.h (struct init_cygheap): Add installation_dir_len member.
(init_cygheap::set_dll_dir): Remove.
* environ.cc (win_env::add_cache): Use stpcpy for speed.
(posify_maybe): Use tmp_pathbuf buffer instead of stack.
(raise_envblock): New function to resize Windows environment block.
(build_env): Fix indentation. Call raise_envblock function. Check if
$PATH exists and is non-empty. If not, add PATH variable with Cygwin
installation directory as content to Windows environment. Explain why.
* uinfo.cc (cygheap_pwdgrp::_nss_init): Fill UNICODE_STRING members
on the fly. Drop call to RtlInitUnicodeString.
(pwdgrp::check_file): Ditto.
setting connect_state to connect_credxchg.
(fhandler_socket::af_local_accept): Ditto.
(fhandler_socket::recv_internal): Drop ill-advised connect_state check.
Add comment so as not to repeat the exercise.
* fhandler.h (enum conn_state): Drop now unneeded connect_credxchg
state.
(init_cygheap::init_installation_root): Just memmove contents of
installation_root instead of calling GetModuleFileNameW again.
Copy installation_root to installation_dir before stripping of
"bin" dir. Don't call SetDllDirectory here. Explain what we do.
(setup_cygheap): New function taking over initial cygheap setup
from memory_init. Additionally call set_dll_dir.
* cygheap.h (struct init_cygheap): Add installation_dir member.
(init_cygheap::set_dll_dir): Define.
(setup_cygheap): Declare.
* dcrt0.cc: Throughout drop parameter from memory_init call.
(dll_crt0_0): Call setup_cygheap prior to memory_init.
* dlfcn.cc (dlopen): Change comment to point to the right function.
* shared.cc (memory_init): Drop parameter. Drop cygheap setup.
* shared_info.h (memory_init): Change declaration accordingly.
installation dir as DLL search path, instead of ".".
* cygheap.h (class cwdstuff): Add parameter names in function
declarations for readability.
(cwdstuff::get): Ad inline implementation fetching the CWD as wide char
string.
* dlfcn.cc (dlopen): Add searching for dependent DLLs in DLL
installation dir or CWD, if all else failed.
Add comment to explain scenarios this is accommodating.
connect_pending only on unconnected socket. Set connect_state to
connected on WSAEISCONN error. Set connect_state to connect_failed
on any other error except WSAEWOULDBLOCK if connect is still pending.
Add lots of comment to explain why all of the above.
(check_path_access): Ditto. Drop FE_CWD from call to find_exec.
(gfpod_helper): Call path_conv::check for all paths containing a dir
separator to more closely follow the Linux search algorithm.
(get_full_path_of_dll): Drop useless __stdcall.
(dlopen): Simplify RTLD_NOLOAD case by calling GetModuleHandleEx
instead of GetModuleHandle/LoadLibrary.
initial handshake on AF_LOCAL sockets.
* fhandler.h (class fhandler_socket): Add no_getpeereid status flag.
(fhandler_socket::af_local_set_no_getpeereid): New prototype.
* fhandler_socket.cc (fhandler_socket::af_local_connect): Skip handshake
if no_getpeereid is set. Add debug output.
(fhandler_socket::af_local_accept): Likewise.
(fhandler_socket::af_local_set_no_getpeereid): New function.
(fhandler_socket::af_local_copy): Copy no_getpeereid.
(fhandler_socket::getpeereid): Fail if no_getpeereid is set.
* net.cc (cygwin_setsockopt): Add SO_PEERCRED for AF_LOCAL/SOCK_STREAM
sockets. Add comment to explain why we need it.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
comment.
(fhandler_socket::evaluate_events): Only set connect_state and call
af_local_connect if connect_state is connect_pending. Explain why.
Drop redundant test for socket family and type.
(fhandler_socket::connect): Extend comment.
connect_state and af_local_connect connect call here, once, independent
of FD_CONNECT being requested. Add comment to explain why.
(fhandler_socket::connect): Drop connect_state handling and calling
af_local_connect. Move remaining AF_LOCAL stuff prior to calling
::connect and explain why. Simplify error case.
* poll.cc (poll): Handle connect state independently of POLLOUT being
requested for the descriptor to allow setting POLLIN if connect failed.
Add comment.
* select.cc (set_bits): Drop connect_state and AF_LOCAL handling here.
ObjectTypeName for object types rather than calling lstat to avoid
performance hit.
* globals.cc (ro_u_natdir): Define.
(ro_u_natsyml): Define.
(ro_u_natdev): Define.
style.
(cygheap_pwdgrp::nss_init_line): Disable db_prefix and db_separator
settings. Add comment.
(pwdgrp::fetch_account_from_windows): Drop outdated comment. Fix code
fetching primary group gid of group setting in SAM description field.
Change comment accordingly.
* fhandler_disk_file.cc (fhandler_disk_file::facl): Ditto in noacl case.
* sec_acl.cc (getacl): Compute useful fake CLASS_OBJ and DEF_CLASS_OBJ
permission bits based on how these values are generated on Linux.
Add commants to explain what the code is doing.
* security.cc (get_attribute_from_acl): Compute group permission based
on the actual primary group permissions and all secondary user and group
ACCESS_ALLOWED_ACEs to emulate Linux' behaviour more closely.
(check_access): Fix typos im comment.
* include/cygwin/acl.h (MIN_ACL_ENTRIES): Redefine as 3.
to declaration.
* fhandler_tty.cc (fhandler_pty_slave::fch_open_handles): Add bool
parameter "chown". Only request WRITE_OWNER access when opening pty
synchronization objects if "chown" is set.
(fhandler_pty_slave::fchmod): Call fch_open_handles with new bool
parameter set to false.
(fhandler_pty_slave::fchown): Call fch_open_handles with new bool
parameter set to true.
* kernel32.cc (CreateFileMappingW): Fix default standard rights for
file mappings from READ_CONTROL to STANDARD_RIGHTS_REQUIRED to allow
changing the DACL (fixes "access denied" error in pinfo::set_acl).
* fhandler_disk_file.cc (fhandler_base::fstat_helper): Change debug
output to print mode bits in octal.
* security.cc (alloc_sd): Ditto.
(set_file_attribute): Ditto.
condition to close handle. Call NtClose rather than CloseHandle.
(write_ea): Fix condition to close handle. Call NtClose rather than
CloseHandle.
* security.cc (get_file_sd): Call pc.init_reopen_attr if a valid
incoming handle was given, pc.get_object_attr otherwise.
(set_file_sd): Ditto.
POBJECT_ATTRIBUTES. Take OBJECT_ATTRIBUTES reference as argument, not
pointer.
* fhandler_disk_file.cc: Throughout accommodate above change.
* syscalls.cc: Ditto.
* ntea.cc (read_ea): Don't set hdl to NULL if it's already NULL. Set
attr with pc.init_reopen_attr before trying to reopen file.
(write_ea): Ditto.
* security.cc (get_file_sd): Use pc.init_reopen_attr rather than
pc.get_object_attr when trying to reopen file.
(set_file_sd): Ditto.
* cygtls.h (class tls_pathbuf): Move counter variables into a union.
Add 64 bit element _counters covering both counter variables to
optimize save and restore operations.
(class san/x86_64): Only store single 64 bit value.
(san::san/x86_64): Implement.
(san::leave/x86_64): Only declare here, as returns_twice function.
Explain why.
(class san/i686): Change type of _c_cnt and _w_cnt to uint32_t.
(__try/x86_64): Move definition of __sebastian after the first memory
barrier. Drop __sebastian.setup call.
handler.
* cygtls.cc (_cygtls::remove): Accommodate the fact that pathbufs
has been moved from _local_storage to _cygtls.
* cygtls.h (class tls_pathbuf): Add comment to hint to gendef usage
of counters. Change type of counters to uint32_t for clarity.
Remove _cygtls as friend class.
(struct _local_storage): Move pathbufs from here...
(struct _cygtls): ...to here, allowing to access it from _sigbe.
(class san): Only define on 32 bit. Remove errno, _c_cnt and _w_cnt
members.
(san::setup): Drop parameter. Don't initialize removed members.
(san::leave): Don't set removed members.
(class myfault): Only define on 32 bit.
(myfault::faulted): Only keep implementation not taking any parameter.
Drop argument in call to sebastian.setup.
(__try/__leave/__except/__endtry): Implement to support real SEH. For
now stick to SJLJ on 32 bit.
* dcrt0.cc (dll_crt0_0): Drop 64 bit call to
exception::install_myfault_handler.
* exception.h (exception_handler): Define with EXCEPTION_DISPOSITION
as return type.
(PDISPATCHER_CONTEXT): Define as void * on 32 bit. Define as pointer
to _DISPATCHER_CONTEXT on 64 bit.
(class exception): Define separately for 32 and 64 bit.
(exception::myfault): Add handler for myfault SEH handling on 64 bit.
(exception::exception): Fix mangled method name to account for change
in type of last parameter.
(exception::install_myfault_handler): Remove.
* exceptions.cc (exception::myfault_handle): Remove.
(exception::myfault): New SEH handler for 64 bit.
* gendef (_sigbe): Set tls_pathbuf counters to 0 explicitely when
returning to the caller.
* ntdll.h: Move a comment to a better place.
(struct _SCOPE_TABLE): Define on 64 bit.
* thread.cc (verifyable_object_isvalid): Remove gcc 4.7 workaround.
* tls_pbuf.cc (tls_pbuf): Fix to accommodate new place of pathbufs.
(tls_pathbuf::destroy): Change type of loop variables to uint32_t.
* tls_pbuf.h (class tmp_pathbuf): Change type of buffer counters to
uint32_t. Accommodate new place of pathbufs.
* tlsoffsets.h: Regenerate.
* tlsoffsets64.h: Regenerate.