[newlib-cygwin] mkglobals_h: Handle CRLF earlier.
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=ede983934cd75d8149e9fcd1b8419c1db6ada1fa commit ede983934cd75d8149e9fcd1b8419c1db6ada1fa Author: Orgad Shaneh org...@gmail.com Date: Mon Aug 17 11:05:20 2015 +0200 mkglobals_h: Handle CRLF earlier. When globals.cc has CRLF line endings, winsup.h is not removed, and compilation fails for duplicate definitions. Signed-off-by: Corinna Vinschen cori...@vinschen.de Diff: --- winsup/cygwin/ChangeLog | 4 winsup/cygwin/mkglobals_h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 3a2f981..03a850a 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,7 @@ +2015-08-17 Orgad Shaneh org...@gmail.com + + * mkglobals_h: Handle CRLF earlier. + 2015-08-17 Corinna Vinschen cori...@vinschen.de * fhandler_proc.cc (format_proc_cpuinfo): Print cpb and eff_freq_ro diff --git a/winsup/cygwin/mkglobals_h b/winsup/cygwin/mkglobals_h index ea4a582..2d185f2 100755 --- a/winsup/cygwin/mkglobals_h +++ b/winsup/cygwin/mkglobals_h @@ -1,6 +1,7 @@ #!/usr/bin/perl my @argv = @ARGV; $_ = join('', ); +s/\s+\n/\n/sog; s/\n[^\n]*!globals.h[^\n]*\n/\n/sog; s%/\*.*?\*/%%sog; s/(enum\s.*?{.*?})/munge($1)/soge; @@ -12,7 +13,6 @@ s/^\n+//sog; s/#include winsup\.h\n//so; s/-NL-/\n/sog; s/-EQ-/=/sog; -s/\s+\n/\n/sog; s/\n{2,}/\n/sog; print PRELUDE,$_; /* $target - Autogenerated from @argv. Look there for comments. */
[newlib-cygwin] Fix /proc/cpuinfo topology info on newer AMD CPUs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=37b6936f8b6860cda5881127b8ac272ed528ac34 commit 37b6936f8b6860cda5881127b8ac272ed528ac34 Author: Corinna Vinschen cori...@vinschen.de Date: Mon Aug 17 16:35:41 2015 +0200 Fix /proc/cpuinfo topology info on newer AMD CPUs * fhandler_proc.cc (format_proc_cpuinfo): Handle AMDs providing extended topology info in CPUID leaf 0x801e. Fix handling of AMD CPUs providing extended legacy core info in CPUID leaf 0x8008. Signed-off-by: Corinna Vinschen cori...@vinschen.de Diff: --- winsup/cygwin/ChangeLog| 6 ++ winsup/cygwin/fhandler_proc.cc | 30 +++--- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 03a850a..b026b0e 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2015-08-17 Corinna Vinschen cori...@vinschen.de + + * fhandler_proc.cc (format_proc_cpuinfo): Handle AMDs providing + extended topology info in CPUID leaf 0x801e. Fix handling of + AMD CPUs providing extended legacy core info in CPUID leaf 0x8008. + 2015-08-17 Orgad Shaneh org...@gmail.com * mkglobals_h: Handle CRLF earlier. diff --git a/winsup/cygwin/fhandler_proc.cc b/winsup/cygwin/fhandler_proc.cc index 55e13cd..5d05757 100644 --- a/winsup/cygwin/fhandler_proc.cc +++ b/winsup/cygwin/fhandler_proc.cc @@ -896,21 +896,37 @@ format_proc_cpuinfo (void *, char *destbuf) } else if (is_amd) { - if (maxe = 0x8008) + if (maxe = 0x801e) + { + uint32_t cus, core_info; + + cpuid (unused, unused, core_info, unused, 0x8008); + cpuid (unused, cus, unused, unused, 0x801e); + siblings = (core_info 0xff) + 1; + logical_bits = (core_info 12) 0xf; + cus = ((cus 8) 0x3) + 1; + ht_bits = mask_bits (cus); + cpu_cores = siblings ht_bits; + } + else if (maxe = 0x8008) { uint32_t core_info; cpuid (unused, unused, core_info, unused, 0x8008); - cpu_cores = (core_info 0xff) + 1; - siblings = cpu_cores; + siblings = (core_info 0xff) + 1; + cpu_cores = siblings; + logical_bits = (core_info 12) 0xf; + if (!logical_bits) + logical_bits = mask_bits (siblings); + ht_bits = 0; } else { - cpu_cores = (extra_info 16) 0xff; - siblings = cpu_cores; + siblings = (extra_info 16) 0xff; + cpu_cores = siblings; + logical_bits = mask_bits (siblings); + ht_bits = 0; } - logical_bits = mask_bits (cpu_cores); - ht_bits = 0; } phys_id = initial_apic_id logical_bits; core_id = (initial_apic_id ((1 logical_bits) - 1)) ht_bits;
[newlib-cygwin] Try harder to avoid LDAP access for RFC2307 mapping
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=88dce3abd82c49ef879e6babcd91c1977dc212d9 commit 88dce3abd82c49ef879e6babcd91c1977dc212d9 Author: Corinna Vinschen cori...@vinschen.de Date: Mon Aug 17 20:24:49 2015 +0200 Try harder to avoid LDAP access for RFC2307 mapping * 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 cori...@vinschen.de Diff: --- winsup/cygwin/ChangeLog | 9 + winsup/cygwin/fhandler_disk_file.cc | 69 + winsup/cygwin/sec_helper.cc | 4 +-- winsup/cygwin/security.cc | 10 +++--- 4 files changed, 55 insertions(+), 37 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index b026b0e..6696d50 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,14 @@ 2015-08-17 Corinna Vinschen cori...@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. + +2015-08-17 Corinna Vinschen cori...@vinschen.de + * fhandler_proc.cc (format_proc_cpuinfo): Handle AMDs providing extended topology info in CPUID leaf 0x801e. Fix handling of AMD CPUs providing extended legacy core info in CPUID leaf 0x8008. diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 08ce81f..455c478 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -343,36 +343,47 @@ fhandler_base::fstat_by_nfs_ea (struct stat *buf) buf-st_mode = (nfs_attr-mode 0xfff) | nfs_type_mapping[nfs_attr-type 7]; buf-st_nlink = nfs_attr-nlink; - /* Try to map UNIX uid/gid to Cygwin uid/gid. If there's no mapping in - the cache, try to fetch it from the configured RFC 2307 domain (see - last comment in cygheap_domain_info::init() for more information) and - add it to the mapping cache. */ - buf-st_uid = cygheap-ugid_cache.get_uid (nfs_attr-uid); - buf-st_gid = cygheap-ugid_cache.get_gid (nfs_attr-gid); - if (buf-st_uid == ILLEGAL_UID cygheap-pg.nss_pwd_db ()) -{ - uid_t map_uid = ILLEGAL_UID; - - domain = cygheap-dom.get_rfc2307_domain (); - if ((ldap_open = (cldap.open (domain) == NO_ERROR))) - map_uid = cldap.remap_uid (nfs_attr-uid); - if (map_uid == ILLEGAL_UID) - map_uid = MAP_UNIX_TO_CYGWIN_ID (nfs_attr-uid); - cygheap-ugid_cache.add_uid (nfs_attr-uid, map_uid); - buf-st_uid = map_uid; -} - if (buf-st_gid == ILLEGAL_GID cygheap-pg.nss_grp_db ()) -{ - gid_t map_gid = ILLEGAL_GID; - - domain = cygheap-dom.get_rfc2307_domain (); - if ((ldap_open || cldap.open (domain) == NO_ERROR)) - map_gid = cldap.remap_gid (nfs_attr-gid); - if (map_gid == ILLEGAL_GID) - map_gid = MAP_UNIX_TO_CYGWIN_ID (nfs_attr-gid); - cygheap-ugid_cache.add_gid (nfs_attr-gid, map_gid); - buf-st_gid = map_gid; + if (cygheap-pg.nss_pwd_db ()) +{ + /* Try to map UNIX uid/gid to Cygwin uid/gid. If there's no mapping in +the cache, try to fetch it from the configured RFC 2307 domain (see +last comment in cygheap_domain_info::init() for more information) and +add it to the mapping cache. */ + buf-st_uid = cygheap-ugid_cache.get_uid (nfs_attr-uid); + if (buf-st_uid == ILLEGAL_UID) + { + uid_t map_uid = ILLEGAL_UID; + + domain = cygheap-dom.get_rfc2307_domain (); + if ((ldap_open = (cldap.open (domain) == NO_ERROR))) + map_uid = cldap.remap_uid (nfs_attr-uid); + if (map_uid == ILLEGAL_UID) + map_uid = MAP_UNIX_TO_CYGWIN_ID (nfs_attr-uid); + cygheap-ugid_cache.add_uid (nfs_attr-uid, map_uid); + buf-st_uid = map_uid; + } +} + else /* fake files being owned by current user. */ +buf-st_uid = myself-uid; + if (cygheap-pg.nss_grp_db ()) +{ + /* See above */ + buf-st_gid = cygheap-ugid_cache.get_gid (nfs_attr-gid); + if (buf-st_gid == ILLEGAL_GID) + { + gid_t map_gid = ILLEGAL_GID; + + domain = cygheap-dom.get_rfc2307_domain (); + if ((ldap_open || cldap.open (domain) == NO_ERROR)) + map_gid = cldap.remap_gid (nfs_attr-gid); + if (map_gid ==
[newlib-cygwin] Support cpb and eff_freq_ro power mgmt flags in /proc/cpuinfo
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=861a27db66fa86e3c745a5b4234063037c67ddf9 commit 861a27db66fa86e3c745a5b4234063037c67ddf9 Author: Corinna Vinschen cori...@vinschen.de Date: Mon Aug 17 10:04:33 2015 +0200 Support cpb and eff_freq_ro power mgmt flags in /proc/cpuinfo * fhandler_proc.cc (format_proc_cpuinfo): Print cpb and eff_freq_ro power management flags. Signed-off-by: Corinna Vinschen cori...@vinschen.de Diff: --- winsup/cygwin/ChangeLog| 5 + winsup/cygwin/fhandler_proc.cc | 4 2 files changed, 9 insertions(+) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 6b82e32..3a2f981 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2015-08-17 Corinna Vinschen cori...@vinschen.de + + * fhandler_proc.cc (format_proc_cpuinfo): Print cpb and eff_freq_ro + power management flags. + 2015-08-15 Corinna Vinschen cori...@vinschen.de * fhandler.cc (fhandler_base_overlapped::raw_write): When performing diff --git a/winsup/cygwin/fhandler_proc.cc b/winsup/cygwin/fhandler_proc.cc index 13311b8..55e13cd 100644 --- a/winsup/cygwin/fhandler_proc.cc +++ b/winsup/cygwin/fhandler_proc.cc @@ -1256,6 +1256,10 @@ format_proc_cpuinfo (void *, char *destbuf) print ( 100mhzsteps); if (features1 (1 7)) print ( hwpstate); + if (features1 (1 9)) + print ( cpb); + if (features1 (1 10)) + print ( eff_freq_ro); } if (orig_affinity_mask != 0)
[newlib-cygwin] Don't call LsaLookupSids if we're not utilizing Windows account DBs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=4cb24051f4dc5080dfc7f5cf4acb778a79744f45 commit 4cb24051f4dc5080dfc7f5cf4acb778a79744f45 Author: Corinna Vinschen cori...@vinschen.de Date: Mon Aug 17 22:45:02 2015 +0200 Don't call LsaLookupSids if we're not utilizing Windows account DBs * 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 cori...@vinschen.de Diff: --- winsup/cygwin/ChangeLog | 7 +++ winsup/cygwin/grp.cc| 49 + winsup/cygwin/release/2.2.1 | 5 +++-- 3 files changed, 42 insertions(+), 19 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 6696d50..a4d68b2 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,12 @@ 2015-08-17 Corinna Vinschen cori...@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. + +2015-08-17 Corinna Vinschen cori...@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. diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc index f850210..501db1a 100644 --- a/winsup/cygwin/grp.cc +++ b/winsup/cygwin/grp.cc @@ -152,17 +152,8 @@ internal_getgrfull (fetch_acc_t full_acc, cyg_ldap *pldap) struct group *ret; cygheap-pg.nss_init (); - /* Check caches first. */ - if (cygheap-pg.nss_cygserver_caching () - (ret = cygheap-pg.grp_cache.cygserver.find_group (full_acc.sid))) -return ret; - if (cygheap-pg.nss_grp_files () - (ret = cygheap-pg.grp_cache.file.find_group (full_acc.sid))) -return ret; - if (cygheap-pg.nss_grp_db () - (ret = cygheap-pg.grp_cache.win.find_group (full_acc.sid))) -return ret; - /* Ask sources afterwards. */ + /* Skip local caches, internal_getgroups already called + internal_getgrsid_cachedonly. */ if (cygheap-pg.nss_cygserver_caching () (ret = cygheap-pg.grp_cache.cygserver.add_group_from_cygserver (full_acc.sid))) @@ -598,7 +589,7 @@ internal_getgroups (int gidsetsize, gid_t *grouplist, cyg_ldap *pldap) size); if (!NT_SUCCESS (status)) { - system_printf (token group list 64K? status = %u, status); + debug_printf (NtQueryInformationToken(TokenGroups) %y, status); goto out; } /* Iterate over the group list and check which of them are already cached. @@ -627,16 +618,40 @@ internal_getgroups (int gidsetsize, gid_t *grouplist, cyg_ldap *pldap) else sidp_buf[scnt++] = sid; } - /* If there are non-cached groups left, call LsaLookupSids and call - internal_getgrfull on the returned groups. This performs a lot - better than calling internal_getgrsid on each group. */ + /* If there are non-cached groups left, try to fetch them. */ if (scnt 0) { + /* Don't call LsaLookupSids if we're not utilizing the Windows account +DBs. If we don't have access to the AD, which is one good reason to +disable passwd/group: db in nsswitch.conf, then the subsequent call +to LsaLookupSids will take 5 - 10 seconds in some environments. */ + if (!cygheap-pg.nss_grp_db ()) + { + for (DWORD pg = 0; pg scnt; ++pg) + { + cygpsid sid = sidp_buf[pg]; + if ((grp = internal_getgrsid (sid, NULL))) + { + if (cnt gidsetsize) + grouplist[cnt] = grp-gr_gid; + ++cnt; + if (gidsetsize cnt gidsetsize) + { + cnt = -1; + break; + } + } + } + goto out; + } + /* Otherwise call LsaLookupSids and call internal_getgrfull on the +returned groups. This performs a lot better than calling +internal_getgrsid on each group. */ status = STATUS_ACCESS_DENIED; HANDLE lsa = lsa_open_policy (NULL, POLICY_LOOKUP_NAMES); if (!lsa) { - system_printf (POLICY_LOOKUP_NAMES not given?); + debug_printf (POLICY_LOOKUP_NAMES right not given?); goto out; } status = LsaLookupSids (lsa, scnt, sidp_buf, dlst, nlst); @@ -664,7 +679,7 @@ internal_getgroups (int gidsetsize, gid_t