| 1 | diff --git a/ChangeLog b/ChangeLog |
| 2 | index f3fe2716b2..6fba508ae1 100644 |
| 3 | --- a/ChangeLog |
| 4 | +++ b/ChangeLog |
| 5 | @@ -1,3 +1,431 @@ |
| 6 | +2018-05-24 Gabriel F. T. Gomes <gabriel@inconstante.eti.br> |
| 7 | + |
| 8 | + [BZ #23171] |
| 9 | + * math/math.h [C++] (iseqsig): Fix parameter type for the long |
| 10 | + double version. |
| 11 | + |
| 12 | +2018-06-12 Carlos O'Donell <carlos@redhat.com> |
| 13 | + Andreas Schwab <schwab@suse.de> |
| 14 | + Dmitry V. Levin <ldv@altlinux.org> |
| 15 | + Florian Weimer <fweimer@redhat.com> |
| 16 | + |
| 17 | + [BZ #23102] |
| 18 | + [BZ #21942] |
| 19 | + [BZ #18018] |
| 20 | + [BZ #23259] |
| 21 | + CVE-2011-0536 |
| 22 | + * elf/dl-dst.h: Remove DL_DST_COUNT. |
| 23 | + * elf/dl-deps.c (expand_dst): Call _dl_dst_count. |
| 24 | + * elf/dl-load.c (is_trusted_path_normalize): Don't handle colons. |
| 25 | + (is_dst): Comment. Support ELF gABI. |
| 26 | + (_dl_dst_count): Comment. Simplify and count DSTs. |
| 27 | + (_dl_dst_substitute): Comment. Support __libc_enable_secure handling. |
| 28 | + (expand_dybamic_string_token): Comment. Call _dl_dst_count. Rename |
| 29 | + locals. |
| 30 | + |
| 31 | +2018-06-12 Florian Weimer <fweimer@redhat.com> |
| 32 | + |
| 33 | + x86: Make strncmp usable from rtld. |
| 34 | + * sysdeps/i386/i686/multiarch/strncmp-c.c: Only rename strncmp to |
| 35 | + __strncmp_ia32 if in libc (and not in rtld). |
| 36 | + * sysdeps/x86_64/multiarch/strncmp-sse2.S: Rename strcmp to |
| 37 | + strncmp if not in libc (and not to __strncmp_sse2). |
| 38 | + |
| 39 | +2018-06-01 Florian Weimer <fweimer@redhat.com> |
| 40 | + |
| 41 | + * sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Update from master |
| 42 | + branch, commit e02c026f38505cd474ff1bdaa88fc671804f5805. |
| 43 | + * sysdeps/i386/fpu/libm-test-ulps: Likewise. |
| 44 | + |
| 45 | +2018-06-08 Adhemerval Zanella <adhemerval.zanella@linaro.org> |
| 46 | + |
| 47 | + [BZ #23264] |
| 48 | + * include/unistd.h (__execvpex): New prototype. |
| 49 | + * posix/Makefile (tests): Add tst-spawn4. |
| 50 | + (tests-internal): Add tst-spawn4-compat. |
| 51 | + * posix/execvpe.c (__execvpe_common, __execvpex): New functions. |
| 52 | + * posix/tst-spawn4-compat.c: New file. |
| 53 | + * posix/tst-spawn4.c: Likewise. |
| 54 | + * sysdeps/unix/sysv/linux/spawni.c (__spawni): Do not interpret invalid |
| 55 | + binaries as shell scripts. |
| 56 | + * sysdeps/posix/spawni.c (__spawni): Likewise. |
| 57 | + * NEWS: Add BZ#22264. |
| 58 | + |
| 59 | +2018-06-01 Florian Weimer <fweimer@redhat.com> |
| 60 | + |
| 61 | + [BZ #23236] |
| 62 | + * libio/strfile.h (struct _IO_str_fields): Rename members to |
| 63 | + discourage their use and add comment. |
| 64 | + (_IO_STR_DYNAMIC): Remove unused macro. |
| 65 | + * libio/strops.c (_IO_str_init_static_internal): Do not use |
| 66 | + callback pointers. Call malloc and free. |
| 67 | + (_IO_str_overflow): Do not use callback pointers. Call malloc |
| 68 | + and free. |
| 69 | + (enlarge_userbuf): Likewise. |
| 70 | + (_IO_str_finish): Call free. |
| 71 | + * libio/wstrops.c (_IO_wstr_init_static): Initialize |
| 72 | + _allocate_buffer_unused. |
| 73 | + (_IO_wstr_overflow): Do not use callback pointers. Call malloc |
| 74 | + and free. |
| 75 | + (enlarge_userbuf): Likewise. |
| 76 | + (_IO_wstr_finish): Call free. |
| 77 | + * debug/vasprintf_chk.c (__vasprintf_chk): Initialize |
| 78 | + _allocate_buffer_unused, _free_buffer_unused. |
| 79 | + * libio/memstream.c (__open_memstream): Likewise. |
| 80 | + * libio/vasprintf.c (_IO_vasprintf): Likewise. |
| 81 | + * libio/wmemstream.c (open_wmemstream): Likewise. |
| 82 | + |
| 83 | +2018-05-23 H.J. Lu <hongjiu.lu@intel.com> |
| 84 | + |
| 85 | + [BZ #23196] |
| 86 | + * string/test-memcpy.c (do_test1): New function. |
| 87 | + (test_main): Call it. |
| 88 | + |
| 89 | +2018-05-23 Andreas Schwab <schwab@suse.de> |
| 90 | + |
| 91 | + [BZ #23196] |
| 92 | + CVE-2018-11237 |
| 93 | + * sysdeps/x86_64/multiarch/memmove-avx512-no-vzeroupper.S |
| 94 | + (L(preloop_large)): Save initial destination pointer in %r11 and |
| 95 | + use it instead of %rax after the loop. |
| 96 | + * string/test-mempcpy.c (MIN_PAGE_SIZE): Define. |
| 97 | + |
| 98 | +2018-05-11 Florian Weimer <fweimer@redhat.com> |
| 99 | + |
| 100 | + [BZ #23166] |
| 101 | + * include/rpc/clnt.h (rpc_createerr): Declare hidden alias. |
| 102 | + * include/rpc/svc.h (svc_pollfd, svc_max_pollfd, svc_fdset): |
| 103 | + Likewise. |
| 104 | + * sunrpc/rpc_common.c (svc_fdset, rpc_createerr, svc_pollfd) |
| 105 | + (svc_max_pollfd): Add nocommon attribute and hidden alias. Do not |
| 106 | + export without --enable-obsolete-rpc. |
| 107 | + * sunrpc/svcauth_des.c (svcauthdes_stats): Turn into compatibility |
| 108 | + symbol. This should not have been exported, ever. |
| 109 | + |
| 110 | +2018-05-11 Rafal Luzynski <digitalfreak@lingonborough.com> |
| 111 | + |
| 112 | + [BZ #23152] |
| 113 | + * localedata/locales/gd_GB (abmon): Fix typo in May: |
| 114 | + "Mhàrt" -> "Cèit". Adjust the comment according to the change. |
| 115 | + |
| 116 | +2018-05-09 Paul Pluzhnikov <ppluzhnikov@google.com> |
| 117 | + |
| 118 | + [BZ #22786] |
| 119 | + CVE-2018-11236 |
| 120 | + * stdlib/canonicalize.c (__realpath): Fix overflow in path length |
| 121 | + computation. |
| 122 | + * stdlib/Makefile (test-bz22786): New test. |
| 123 | + * stdlib/test-bz22786.c: New test. |
| 124 | + |
| 125 | +2018-05-05 Paul Pluzhnikov <ppluzhnikov@google.com> |
| 126 | + |
| 127 | + [BZ #20419] |
| 128 | + * elf/dl-load.c (open_verify): Fix stack overflow. |
| 129 | + * elf/Makefile (tst-big-note): New test. |
| 130 | + * elf/tst-big-note-lib.S: New. |
| 131 | + * elf/tst-big-note.c: New. |
| 132 | + |
| 133 | +2018-05-04 Stefan Liebler <stli@linux.vnet.ibm.com> |
| 134 | + |
| 135 | + [BZ #23137] |
| 136 | + * sysdeps/nptl/lowlevellock.h (lll_wait_tid): |
| 137 | + Use atomic_load_acquire to load __tid. |
| 138 | + |
| 139 | +2018-04-24 Joseph Myers <joseph@codesourcery.com> |
| 140 | + |
| 141 | + * sysdeps/unix/sysv/linux/sys/ptrace.h |
| 142 | + (PTRACE_SECCOMP_GET_METADATA): New enum value and macro. |
| 143 | + * sysdeps/unix/sysv/linux/bits/ptrace-shared.h |
| 144 | + (struct __ptrace_seccomp_metadata): New type. |
| 145 | + * sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h |
| 146 | + (PTRACE_SECCOMP_GET_METADATA): Likewise. |
| 147 | + * sysdeps/unix/sysv/linux/arm/sys/ptrace.h |
| 148 | + (PTRACE_SECCOMP_GET_METADATA): Likewise. |
| 149 | + * sysdeps/unix/sysv/linux/ia64/sys/ptrace.h |
| 150 | + (PTRACE_SECCOMP_GET_METADATA): Likewise. |
| 151 | + * sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h |
| 152 | + (PTRACE_SECCOMP_GET_METADATA): Likewise. |
| 153 | + * sysdeps/unix/sysv/linux/s390/sys/ptrace.h |
| 154 | + (PTRACE_SECCOMP_GET_METADATA): Likewise. |
| 155 | + * sysdeps/unix/sysv/linux/sparc/sys/ptrace.h |
| 156 | + (PTRACE_SECCOMP_GET_METADATA): Likewise. |
| 157 | + * sysdeps/unix/sysv/linux/tile/sys/ptrace.h |
| 158 | + (PTRACE_SECCOMP_GET_METADATA): Likewise. |
| 159 | + * sysdeps/unix/sysv/linux/x86/sys/ptrace.h |
| 160 | + (PTRACE_SECCOMP_GET_METADATA): Likewise. |
| 161 | + |
| 162 | +2018-04-09 Florian Weimer <fweimer@redhat.com> |
| 163 | + |
| 164 | + [BZ #23037] |
| 165 | + * resolv/res_send.c (send_dg): Use designated initializers instead |
| 166 | + of assignment to zero-initialize other fields of struct mmsghdr. |
| 167 | + |
| 168 | +2018-04-06 Andreas Schwab <schwab@linux-m68k.org> |
| 169 | + |
| 170 | + * manual/charset.texi (Converting a Character): Fix typo. |
| 171 | + |
| 172 | +2018-04-05 Florian Weimer <fweimer@redhat.com> |
| 173 | + |
| 174 | + * manual/examples/mbstouwcs.c (mbstouwcs): Fix loop termination, |
| 175 | + integer overflow, memory leak on error, and indeterminate errno |
| 176 | + value. Add a null wide character to terminate the result string. |
| 177 | + * manual/charset.texi (Converting a Character): Mention embedded |
| 178 | + null bytes in the mbrtowc input string. Explain what happens in |
| 179 | + the -2 result case. Do not claim that mbrtowc is simple or |
| 180 | + obvious to use. Adjust the description of the code example. Use |
| 181 | + @code, not @var, for concrete variables. |
| 182 | + |
| 183 | +2018-04-05 Florian Weimer <fweimer@redhat.com> |
| 184 | + |
| 185 | + * manual/examples/mbstouwcs.c: New file. |
| 186 | + * manual/charset.texi (Converting a Character): Include it. |
| 187 | + |
| 188 | +2018-04-03 H.J. Lu <hongjiu.lu@intel.com> |
| 189 | + |
| 190 | + [BZ #22947] |
| 191 | + * bits/uio-ext.h (RWF_APPEND): New. |
| 192 | + * sysdeps/unix/sysv/linux/bits/uio-ext.h (RWF_APPEND): Likewise. |
| 193 | + * manual/llio.texi: Document RWF_APPEND. |
| 194 | + * misc/tst-preadvwritev2-common.c (RWF_APPEND): New. |
| 195 | + (RWF_SUPPORTED): Add RWF_APPEND. |
| 196 | + |
| 197 | +2018-03-27 Jesse Hathaway <jesse@mbuki-mvuki.org> |
| 198 | + |
| 199 | + * sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid): Return |
| 200 | + early when linux sentinel value is set. |
| 201 | + |
| 202 | +2018-03-27 Andreas Schwab <schwab@suse.de> |
| 203 | + |
| 204 | + [BZ #23005] |
| 205 | + * resolv/res_send.c (__res_context_send): Return ENOMEM if |
| 206 | + allocation of private copy of nsaddr_list fails. |
| 207 | + |
| 208 | +2018-03-20 Joseph Myers <joseph@codesourcery.com> |
| 209 | + |
| 210 | + [BZ #17343] |
| 211 | + * stdlib/random_r.c (__random_r): Use unsigned arithmetic for |
| 212 | + possibly overflowing computations. |
| 213 | + |
| 214 | +2018-04-26 Aurelien Jarno <aurelien@aurel32.net> |
| 215 | + |
| 216 | + * signal/tst-sigaction.c: New file to test BZ #23069. |
| 217 | + * signal/Makefile (tests): Fix indentation. Add tst-sigaction. |
| 218 | + |
| 219 | +2018-04-28 Aurelien Jarno <aurelien@aurel32.net> |
| 220 | + |
| 221 | + [BZ #23069] |
| 222 | + * sysdeps/unix/sysv/linux/riscv/kernel_sigaction.h: New file. |
| 223 | + |
| 224 | +2018-03-29 Florian Weimer <fweimer@redhat.com> |
| 225 | + |
| 226 | + * sysdeps/unix/sysv/linux/i386/tst-bz21269.c (do_test): Also |
| 227 | + capture SIGBUS. |
| 228 | + |
| 229 | +2018-03-23 Andrew Senkevich <andrew.senkevich@intel.com> |
| 230 | + Max Horn <max@quendi.de> |
| 231 | + |
| 232 | + [BZ #22644] |
| 233 | + CVE-2017-18269 |
| 234 | + * sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S: Fixed |
| 235 | + branch conditions. |
| 236 | + * string/test-memmove.c (do_test2): New testcase. |
| 237 | + |
| 238 | +2018-02-22 Andrew Waterman <andrew@sifive.com> |
| 239 | + |
| 240 | + [BZ # 22884] |
| 241 | + * sysdeps/riscv/rvd/s_fmax.c (__fmax): Handle sNaNs correctly. |
| 242 | + * sysdeps/riscv/rvd/s_fmin.c (__fmin): Likewise. |
| 243 | + * sysdeps/riscv/rvf/s_fmaxf.c (__fmaxf): Likewise. |
| 244 | + * sysdeps/riscv/rvf/s_fminf.c (__fminf): Likewise. |
| 245 | + |
| 246 | +2018-02-22 DJ Delorie <dj@delorie.com> |
| 247 | + |
| 248 | + * sysdeps/riscv/tls-macros.h: Do not initialize $gp. |
| 249 | + |
| 250 | +2018-03-16 Rafal Luzynski <digitalfreak@lingonborough.com> |
| 251 | + |
| 252 | + [BZ #22963] |
| 253 | + * localedata/locales/cs_CZ (mon): Rename to... |
| 254 | + (alt_mon): This. |
| 255 | + (mon): Import from CLDR (genitive case). |
| 256 | + |
| 257 | +2018-03-16 Rafal Luzynski <digitalfreak@lingonborough.com> |
| 258 | + |
| 259 | + [BZ #22937] |
| 260 | + * localedata/locales/el_CY (abmon): Rename to... |
| 261 | + (ab_alt_mon): This. |
| 262 | + (abmon): Import from CLDR (abbreviated genitive case). |
| 263 | + * localedata/locales/el_GR (abmon): Rename to... |
| 264 | + (ab_alt_mon): This. |
| 265 | + (abmon): Import from CLDR (abbreviated genitive case). |
| 266 | + |
| 267 | +2018-03-16 Rafal Luzynski <digitalfreak@lingonborough.com> |
| 268 | + |
| 269 | + [BZ #22932] |
| 270 | + * localedata/locales/lt_LT (abmon): Synchronize with CLDR. |
| 271 | + |
| 272 | +2018-03-16 Robert Buj <robert.buj@gmail.com> |
| 273 | + |
| 274 | + [BZ #22848] |
| 275 | + * localedata/locales/ca_ES (abmon): Rename to... |
| 276 | + (ab_alt_mon): This, then synchronize with CLDR (nominative case). |
| 277 | + (mon): Rename to... |
| 278 | + (alt_mon): This. |
| 279 | + (abmon): Import from CLDR (genitive case, month names preceded by |
| 280 | + "de" or "d’"). |
| 281 | + (mon): Likewise. |
| 282 | + (abday): Synchronize with CLDR. |
| 283 | + (d_t_fmt): Likewise. |
| 284 | + (d_fmt): Likewise. |
| 285 | + (am_pm): Likewise. |
| 286 | + |
| 287 | + (LC_TIME): Improve indentation. |
| 288 | + (LC_TELEPHONE): Likewise. |
| 289 | + (LC_NAME): Likewise. |
| 290 | + (LC_ADDRESS): Likewise. |
| 291 | + |
| 292 | +2018-03-12 Dmitry V. Levin <ldv@altlinux.org> |
| 293 | + |
| 294 | + * po/pt_BR.po: Update translations. |
| 295 | + |
| 296 | +2018-03-03 Adhemerval Zanella <adhemerval.zanella@linaro.org> |
| 297 | + |
| 298 | + [BZ #21269] |
| 299 | + * sysdeps/unix/sysv/linux/i386/Makefile (tests): Add tst-bz21269. |
| 300 | + * sysdeps/unix/sysv/linux/i386/sigaction.c (SET_SA_RESTORER): Clear |
| 301 | + sa_restorer for vDSO case. |
| 302 | + * sysdeps/unix/sysv/linux/i386/tst-bz21269.c: New file. |
| 303 | + |
| 304 | +2018-03-03 Andreas Schwab <schwab@linux-m68k.org> |
| 305 | + |
| 306 | + [BZ #22918] |
| 307 | + * nss/nsswitch.h (DEFINE_DATABASE): Don't define __nss_*_database. |
| 308 | + * nss/nsswitch.c (DEFINE_DATABASE): Define __nss_*_database here. |
| 309 | + * nscd/gai.c (__nss_hosts_database): Readd definition. |
| 310 | + * posix/tst-rfc3484.c (__nss_hosts_database): Likewise. |
| 311 | + * posix/tst-rfc3484-3.c (__nss_hosts_database): Likewise. |
| 312 | + * posix/tst-rfc3484-2.c (__nss_hosts_database): Likewise. |
| 313 | + |
| 314 | +2018-03-01 DJ Delorie <dj@delorie.com> |
| 315 | + |
| 316 | + [BZ #22342] |
| 317 | + * nscd/netgroupcache.c (addinnetgrX): Include trailing NUL in |
| 318 | + key value. |
| 319 | + |
| 320 | +2018-02-26 Dmitry V. Levin <ldv@altlinux.org> |
| 321 | + |
| 322 | + [BZ #22433] |
| 323 | + [BZ #22807] |
| 324 | + * sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h (__ptrace_request): Add |
| 325 | + PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS, PTRACE_SETFPREGS, |
| 326 | + PTRACE_GETVRREGS, PTRACE_SETVRREGS, PTRACE_GETEVRREGS, |
| 327 | + PTRACE_SETEVRREGS, PTRACE_GETREGS64, PTRACE_SETREGS64, |
| 328 | + PTRACE_GET_DEBUGREG, PTRACE_SET_DEBUGREG, PTRACE_GETVSRREGS, |
| 329 | + PTRACE_SETVSRREGS, and PTRACE_SINGLEBLOCK. |
| 330 | + |
| 331 | +2018-02-26 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com> |
| 332 | + |
| 333 | + * sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h: Undefine Linux |
| 334 | + macros used in __ptrace_request. |
| 335 | + |
| 336 | +2018-02-21 Mike FABIAN <mfabian@redhat.com> |
| 337 | + |
| 338 | + [BZ #22517] |
| 339 | + * localedata/locales/et_EE (LC_COLLATE): add missing “reorder-end” |
| 340 | + |
| 341 | +2018-02-21 Rical Jasan <ricaljasan@pacific.net> |
| 342 | + |
| 343 | + * io/fcntl.h: Fix a typo in a comment. |
| 344 | + |
| 345 | +2018-02-20 Rical Jasan <ricaljasan@pacific.net> |
| 346 | + |
| 347 | + * manual/creature.texi (_ISOC99_SOURCE): Update the dated |
| 348 | + description. |
| 349 | + |
| 350 | + [BZ #16335] |
| 351 | + * manual/creature.texi (_POSIX_C_SOURCE): Document special values |
| 352 | + of 199606L, 200112L, and 200809L. |
| 353 | + (_XOPEN_SOURCE): Document special values of 600 and 700. |
| 354 | + (_ISOC11_SOURCE): Document macro. |
| 355 | + (_ATFILE_SOURCE): Likewise. |
| 356 | + (_FORTIFY_SOURCE): Likewise. |
| 357 | + |
| 358 | +2018-03-09 Aurelien Jarno <aurelien@aurel32.net> |
| 359 | + |
| 360 | + [BZ #22919] |
| 361 | + * sysdeps/unix/sysv/linux/sparc/sparc32/setcontext.S (__startcontext): |
| 362 | + Add nop before __startcontext, add explaining comments. |
| 363 | + |
| 364 | +2018-03-07 Adhemerval Zanella <adhemerval.zanella@linaro.org> |
| 365 | + |
| 366 | + [BZ #22926] |
| 367 | + * sysdeps/powerpc/powerpc32/sysdep.h (ABORT_TRANSACTION_IMPL): Define |
| 368 | + empty for __SPE__. |
| 369 | + * sysdeps/powerpc/sysdep.h (ABORT_TRANSACTION): Likewise. |
| 370 | + * sysdeps/unix/sysv/linux/powerpc/elision-lock.c (__lll_lock_elision): |
| 371 | + Do not build hardware transactional code for __SPE__. |
| 372 | + * sysdeps/unix/sysv/linux/powerpc/elision-trylock.c |
| 373 | + (__lll_trylock_elision): Likewise. |
| 374 | + * sysdeps/unix/sysv/linux/powerpc/elision-unlock.c |
| 375 | + (__lll_unlock_elision): Likewise. |
| 376 | + |
| 377 | +2018-02-19 Rical Jasan <ricaljasan@pacific.net> |
| 378 | + |
| 379 | + [BZ #6889] |
| 380 | + * manual/filesys.texi (get_current_dir_name): Clarify behaviour. |
| 381 | + |
| 382 | +2018-02-16 Rical Jasan <ricaljasan@pacific.net> |
| 383 | + |
| 384 | + * manual/platform.texi (__riscv_flush_icache): Fix @deftypefun |
| 385 | + syntax. |
| 386 | + |
| 387 | +2018-02-09 Rical Jasan <ricaljasan@pacific.net> |
| 388 | + |
| 389 | + * manual/creature.texi: Convert references to gcc.info to gcc. |
| 390 | + * manual/stdio.texi: Likewise. |
| 391 | + * manual/string.texi: Likewise. |
| 392 | + |
| 393 | +2018-02-18 Aurelien Jarno <aurelien@aurel32.net> |
| 394 | + |
| 395 | + [BZ #22818] |
| 396 | + * posix/tst-glob_lstat_compat.c [__alpha__] (glob): Access |
| 397 | + the GLIBC_2.1 version. |
| 398 | + |
| 399 | +2018-02-02 Sean McKean <smckean83@gmail.com> |
| 400 | + |
| 401 | + [BZ #22735] |
| 402 | + * time/time.h (clock): Reference CLOCKS_PER_SEC in comment. |
| 403 | + |
| 404 | +2018-02-10 Dmitry V. Levin <ldv@altlinux.org> |
| 405 | + |
| 406 | + [BZ #22433] |
| 407 | + * sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h (__ptrace_request): |
| 408 | + Remove arm-specific PTRACE_GET_THREAD_AREA, PTRACE_GETHBPREGS, |
| 409 | + and PTRACE_SETHBPREGS. |
| 410 | + |
| 411 | +2018-02-14 Adhemerval Zanella <adhemerval.zanella@linaro.org> |
| 412 | + |
| 413 | + * sysdeps/sh/libm-test-ulps: Update. |
| 414 | + |
| 415 | +2018-02-09 DJ Delorie <dj@redhat.com> |
| 416 | + |
| 417 | + [BZ #22827] |
| 418 | + * sysdeps/unix/sysv/linux/riscv/readelflib.c (process_elf_file): Use |
| 419 | + 64-bit ELF type for 64-bit ELF objects. |
| 420 | + |
| 421 | +2018-02-07 Igor Gnatenko <ignatenko@redhat.com> |
| 422 | + |
| 423 | + [BZ #22797] |
| 424 | + * sysdeps/unix/sysv/linux/bits/mman-shared.h (pkey_get): Add |
| 425 | + missing second underscore to parameter name. |
| 426 | + |
| 427 | +2018-02-05 H.J. Lu <hongjiu.lu@intel.com> |
| 428 | + |
| 429 | + [BZ #22638] |
| 430 | + * sysdeps/sparc/sparc32/start.S (_start): Check PIC instead of |
| 431 | + SHARED. |
| 432 | + * sysdeps/sparc/sparc64/start.S (_start): Likewise. |
| 433 | + |
| 434 | 2018-02-01 Dmitry V. Levin <ldv@altlinux.org> |
| 435 | |
| 436 | * version.h (RELEASE): Set to "stable". |
| 437 | @@ -710,7 +1138,9 @@ |
| 438 | 2018-01-18 Arjun Shankar <arjun@redhat.com> |
| 439 | |
| 440 | [BZ #22343] |
| 441 | + [BZ #22774] |
| 442 | CVE-2018-6485 |
| 443 | + CVE-2018-6551 |
| 444 | * malloc/malloc.c (checked_request2size): call REQUEST_OUT_OF_RANGE |
| 445 | after padding. |
| 446 | (_int_memalign): check for integer overflow before calling |
| 447 | diff --git a/NEWS b/NEWS |
| 448 | index a71c1038a8..2dab66e851 100644 |
| 449 | --- a/NEWS |
| 450 | +++ b/NEWS |
| 451 | @@ -5,6 +5,83 @@ See the end for copying conditions. |
| 452 | Please send GNU C library bug reports via <https://sourceware.org/bugzilla/> |
| 453 | using `glibc' in the "product" field. |
| 454 | \f |
| 455 | +Version 2.27.1 |
| 456 | + |
| 457 | +Major new features: |
| 458 | + |
| 459 | +* Nominative and genitive month names are now supported for the Catalan and |
| 460 | + Czech languages. The Catalan and Greek languages now support abbreviated |
| 461 | + alternative month names. |
| 462 | + |
| 463 | +* Parsing of dynamic string tokens in DT_RPATH, DT_RUNPATH, DT_NEEDED, |
| 464 | + DT_AUXILIARY, and DT_FILTER has been expanded to support the full |
| 465 | + range of ELF gABI expressions including such constructs as |
| 466 | + '$ORIGIN$ORIGIN' (if valid). For SUID/GUID applications the rules |
| 467 | + have been further restricted, and where in the past a dynamic string |
| 468 | + token sequence may have been interpreted as a literal string it will |
| 469 | + now cause a load failure. These load failures were always considered |
| 470 | + unspecified behaviour from the perspective of the dynamic loader, and |
| 471 | + for safety are now load errors e.g. /foo/${ORIGIN}.so in DT_NEEDED |
| 472 | + results in a load failure now. |
| 473 | + |
| 474 | +Security related changes: |
| 475 | + |
| 476 | + CVE-2017-18269: An SSE2-based memmove implementation for the i386 |
| 477 | + architecture could corrupt memory. Reported by Max Horn. |
| 478 | + |
| 479 | + CVE-2018-11236: Very long pathname arguments to realpath function could |
| 480 | + result in an integer overflow and buffer overflow. Reported by Alexey |
| 481 | + Izbyshev. |
| 482 | + |
| 483 | + CVE-2018-11237: The mempcpy implementation for the Intel Xeon Phi |
| 484 | + architecture could write beyond the target buffer, resulting in a buffer |
| 485 | + overflow. Reported by Andreas Schwab. |
| 486 | + |
| 487 | +The following bugs are resolved with this release: |
| 488 | + |
| 489 | + [6889] 'PWD' mentioned but not specified |
| 490 | + [16335] Feature test macro documentation incomplete and out of date |
| 491 | + [17343] Signed integer overflow in /stdlib/random_r.c |
| 492 | + [18018] Additional $ORIGIN handling issues (CVE-2011-0536) |
| 493 | + [20419] files with large allocated notes crash in open_verify |
| 494 | + [21269] i386 sigaction sa_restorer handling is wrong |
| 495 | + [21942] _dl_dst_substitute incorrectly handles $ORIGIN: with AT_SECURE=1 |
| 496 | + [22342] NSCD not properly caching netgroup |
| 497 | + [22638] sparc: static binaries are broken if glibc is built by gcc |
| 498 | + configured with --enable-default-pie |
| 499 | + [22644] memmove-sse2-unaligned on 32bit x86 produces garbage when crossing |
| 500 | + 2GB threshold |
| 501 | + [22735] Misleading typo in time.h source comment regarding CLOCKS_PER_SECOND |
| 502 | + [22786] Stack buffer overflow in realpath() if input size is close |
| 503 | + to SSIZE_MAX |
| 504 | + [22797] Linux: use reserved name __key in pkey_get |
| 505 | + [22807] PTRACE_* constants missing for powerpc |
| 506 | + [22818] posix/tst-glob_lstat_compat failure on alpha |
| 507 | + [22827] RISC-V ELF64 parser mis-reads flag in ldconfig |
| 508 | + [22848] ca_ES: update date definitions from CLDR |
| 509 | + [22884] RISCV fmax/fmin handle signalling NANs incorrectly |
| 510 | + [22918] multiple common of `__nss_shadow_database' |
| 511 | + [22919] sparc32: backtrace yields infinite backtrace with makecontext |
| 512 | + [22926] FTBFS on powerpcspe |
| 513 | + [22932] lt_LT: Update of abbreviated month names from CLDR required |
| 514 | + [22937] Greek (el_GR, el_CY) locales actually need ab_alt_mon |
| 515 | + [22947] FAIL: misc/tst-preadvwritev2 |
| 516 | + [22963] cs_CZ: Add alternative month names |
| 517 | + [23005] Crash in __res_context_send after memory allocation failure |
| 518 | + [23037] initialize msg_flags to zero for sendmmsg() calls |
| 519 | + [23069] sigaction broken on riscv64-linux-gnu |
| 520 | + [23102] Incorrect parsing of consecutive $ variables in runpath entries |
| 521 | + [23137] s390: pthread_join sometimes block indefinitely (on 31bit and libc |
| 522 | + build with -Os) |
| 523 | + [23152] gd_GB: Fix typo in "May" (abbreviated) |
| 524 | + [23166] sunrpc: Remove stray exports without --enable-obsolete-rpc |
| 525 | + [23171] Fix parameter type in C++ version of iseqsig |
| 526 | + [23196] __mempcpy_avx512_no_vzeroupper mishandles large copies |
| 527 | + [23236] Harden function pointers in _IO_str_fields |
| 528 | + [23259] Unsubstituted ${ORIGIN} remains in DT_NEEDED for AT_SECURE |
| 529 | + [23264] libc: posix_spawnp wrongly executes ENOEXEC in non compat mode |
| 530 | + |
| 531 | +\f |
| 532 | Version 2.27 |
| 533 | |
| 534 | Major new features: |
| 535 | @@ -262,6 +339,10 @@ Security related changes: |
| 536 | an object size near the value of SIZE_MAX, would return a pointer to a |
| 537 | buffer which is too small, instead of NULL. Reported by Jakub Wilk. |
| 538 | |
| 539 | + CVE-2018-6551: The malloc function, when called with an object size near |
| 540 | + the value of SIZE_MAX, would return a pointer to a buffer which is too |
| 541 | + small, instead of NULL. |
| 542 | + |
| 543 | The following bugs are resolved with this release: |
| 544 | |
| 545 | [866] glob: glob should match dangling symlinks |
| 546 | diff --git a/bits/uio-ext.h b/bits/uio-ext.h |
| 547 | index 8c15a05d9a..d5aa06fd08 100644 |
| 548 | --- a/bits/uio-ext.h |
| 549 | +++ b/bits/uio-ext.h |
| 550 | @@ -28,5 +28,6 @@ |
| 551 | #define RWF_DSYNC 0x00000002 /* per-IO O_DSYNC. */ |
| 552 | #define RWF_SYNC 0x00000004 /* per-IO O_SYNC. */ |
| 553 | #define RWF_NOWAIT 0x00000008 /* per-IO nonblocking mode. */ |
| 554 | +#define RWF_APPEND 0x00000010 /* per-IO O_APPEND. */ |
| 555 | |
| 556 | #endif /* sys/uio_ext.h */ |
| 557 | diff --git a/debug/vasprintf_chk.c b/debug/vasprintf_chk.c |
| 558 | index a00ef771e6..3eb64617fd 100644 |
| 559 | --- a/debug/vasprintf_chk.c |
| 560 | +++ b/debug/vasprintf_chk.c |
| 561 | @@ -55,8 +55,8 @@ __vasprintf_chk (char **result_ptr, int flags, const char *format, |
| 562 | _IO_JUMPS (&sf._sbf) = &_IO_str_jumps; |
| 563 | _IO_str_init_static_internal (&sf, string, init_string_size, string); |
| 564 | sf._sbf._f._flags &= ~_IO_USER_BUF; |
| 565 | - sf._s._allocate_buffer = (_IO_alloc_type) malloc; |
| 566 | - sf._s._free_buffer = (_IO_free_type) free; |
| 567 | + sf._s._allocate_buffer_unused = (_IO_alloc_type) malloc; |
| 568 | + sf._s._free_buffer_unused = (_IO_free_type) free; |
| 569 | |
| 570 | /* For flags > 0 (i.e. __USE_FORTIFY_LEVEL > 1) request that %n |
| 571 | can only come from read-only format strings. */ |
| 572 | diff --git a/elf/Makefile b/elf/Makefile |
| 573 | index 2a432d8bee..2d8fe88aa6 100644 |
| 574 | --- a/elf/Makefile |
| 575 | +++ b/elf/Makefile |
| 576 | @@ -187,7 +187,7 @@ tests += restest1 preloadtest loadfail multiload origtest resolvfail \ |
| 577 | tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \ |
| 578 | tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error tst-noload \ |
| 579 | tst-latepthread tst-tls-manydynamic tst-nodelete-dlclose \ |
| 580 | - tst-debug1 tst-main1 |
| 581 | + tst-debug1 tst-main1 tst-big-note |
| 582 | # reldep9 |
| 583 | tests-internal += loadtest unload unload2 circleload1 \ |
| 584 | neededtest neededtest2 neededtest3 neededtest4 \ |
| 585 | @@ -272,7 +272,9 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \ |
| 586 | tst-audit12mod1 tst-audit12mod2 tst-audit12mod3 tst-auditmod12 \ |
| 587 | tst-latepthreadmod $(tst-tls-many-dynamic-modules) \ |
| 588 | tst-nodelete-dlclose-dso tst-nodelete-dlclose-plugin \ |
| 589 | - tst-main1mod tst-libc_dlvsym-dso |
| 590 | + tst-main1mod tst-libc_dlvsym-dso \ |
| 591 | + tst-big-note-lib |
| 592 | + |
| 593 | ifeq (yes,$(have-mtls-dialect-gnu2)) |
| 594 | tests += tst-gnu2-tls1 |
| 595 | modules-names += tst-gnu2-tls1mod |
| 596 | @@ -1446,3 +1448,5 @@ $(objpfx)tst-libc_dlvsym-static: $(common-objpfx)dlfcn/libdl.a |
| 597 | tst-libc_dlvsym-static-ENV = \ |
| 598 | LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn |
| 599 | $(objpfx)tst-libc_dlvsym-static.out: $(objpfx)tst-libc_dlvsym-dso.so |
| 600 | + |
| 601 | +$(objpfx)tst-big-note: $(objpfx)tst-big-note-lib.so |
| 602 | diff --git a/elf/dl-deps.c b/elf/dl-deps.c |
| 603 | index c975fcffd7..20b8e94f2e 100644 |
| 604 | --- a/elf/dl-deps.c |
| 605 | +++ b/elf/dl-deps.c |
| 606 | @@ -100,7 +100,7 @@ struct list |
| 607 | ({ \ |
| 608 | const char *__str = (str); \ |
| 609 | const char *__result = __str; \ |
| 610 | - size_t __dst_cnt = DL_DST_COUNT (__str); \ |
| 611 | + size_t __dst_cnt = _dl_dst_count (__str); \ |
| 612 | \ |
| 613 | if (__dst_cnt != 0) \ |
| 614 | { \ |
| 615 | diff --git a/elf/dl-dst.h b/elf/dl-dst.h |
| 616 | index 32de5d225a..859032be0d 100644 |
| 617 | --- a/elf/dl-dst.h |
| 618 | +++ b/elf/dl-dst.h |
| 619 | @@ -18,19 +18,6 @@ |
| 620 | |
| 621 | #include "trusted-dirs.h" |
| 622 | |
| 623 | -/* Determine the number of DST elements in the name. Only if IS_PATH is |
| 624 | - nonzero paths are recognized (i.e., multiple, ':' separated filenames). */ |
| 625 | -#define DL_DST_COUNT(name) \ |
| 626 | - ({ \ |
| 627 | - size_t __cnt = 0; \ |
| 628 | - const char *__sf = strchr (name, '$'); \ |
| 629 | - \ |
| 630 | - if (__glibc_unlikely (__sf != NULL)) \ |
| 631 | - __cnt = _dl_dst_count (__sf); \ |
| 632 | - \ |
| 633 | - __cnt; }) |
| 634 | - |
| 635 | - |
| 636 | #ifdef SHARED |
| 637 | # define IS_RTLD(l) (l) == &GL(dl_rtld_map) |
| 638 | #else |
| 639 | diff --git a/elf/dl-load.c b/elf/dl-load.c |
| 640 | index 7554a99b5a..b20e2a46d0 100644 |
| 641 | --- a/elf/dl-load.c |
| 642 | +++ b/elf/dl-load.c |
| 643 | @@ -122,12 +122,6 @@ is_trusted_path_normalize (const char *path, size_t len) |
| 644 | if (len == 0) |
| 645 | return false; |
| 646 | |
| 647 | - if (*path == ':') |
| 648 | - { |
| 649 | - ++path; |
| 650 | - --len; |
| 651 | - } |
| 652 | - |
| 653 | char *npath = (char *) alloca (len + 2); |
| 654 | char *wnp = npath; |
| 655 | while (*path != '\0') |
| 656 | @@ -178,114 +172,165 @@ is_trusted_path_normalize (const char *path, size_t len) |
| 657 | return false; |
| 658 | } |
| 659 | |
| 660 | +/* Given a substring starting at INPUT, just after the DST '$' start |
| 661 | + token, determine if INPUT contains DST token REF, following the |
| 662 | + ELF gABI rules for DSTs: |
| 663 | + |
| 664 | + * Longest possible sequence using the rules (greedy). |
| 665 | |
| 666 | + * Must start with a $ (enforced by caller). |
| 667 | + |
| 668 | + * Must follow $ with one underscore or ASCII [A-Za-z] (caller |
| 669 | + follows these rules for REF) or '{' (start curly quoted name). |
| 670 | + |
| 671 | + * Must follow first two characters with zero or more [A-Za-z0-9_] |
| 672 | + (enforced by caller) or '}' (end curly quoted name). |
| 673 | + |
| 674 | + If the sequence is a DST matching REF then the length of the DST |
| 675 | + (excluding the $ sign but including curly braces, if any) is |
| 676 | + returned, otherwise 0. */ |
| 677 | static size_t |
| 678 | -is_dst (const char *start, const char *name, const char *str, int secure) |
| 679 | +is_dst (const char *input, const char *ref) |
| 680 | { |
| 681 | - size_t len; |
| 682 | bool is_curly = false; |
| 683 | |
| 684 | - if (name[0] == '{') |
| 685 | + /* Is a ${...} input sequence? */ |
| 686 | + if (input[0] == '{') |
| 687 | { |
| 688 | is_curly = true; |
| 689 | - ++name; |
| 690 | - } |
| 691 | - |
| 692 | - len = 0; |
| 693 | - while (name[len] == str[len] && name[len] != '\0') |
| 694 | - ++len; |
| 695 | - |
| 696 | - if (is_curly) |
| 697 | - { |
| 698 | - if (name[len] != '}') |
| 699 | - return 0; |
| 700 | - |
| 701 | - /* Point again at the beginning of the name. */ |
| 702 | - --name; |
| 703 | - /* Skip over closing curly brace and adjust for the --name. */ |
| 704 | - len += 2; |
| 705 | + ++input; |
| 706 | } |
| 707 | - else if (name[len] != '\0' && name[len] != '/') |
| 708 | - return 0; |
| 709 | |
| 710 | - if (__glibc_unlikely (secure) |
| 711 | - && ((name[len] != '\0' && name[len] != '/') |
| 712 | - || (name != start + 1))) |
| 713 | + /* Check for matching name, following closing curly brace (if |
| 714 | + required), or trailing characters which are part of an |
| 715 | + identifier. */ |
| 716 | + size_t rlen = strlen (ref); |
| 717 | + if (strncmp (input, ref, rlen) != 0 |
| 718 | + || (is_curly && input[rlen] != '}') |
| 719 | + || ((input[rlen] >= 'A' && input[rlen] <= 'Z') |
| 720 | + || (input[rlen] >= 'a' && input[rlen] <= 'z') |
| 721 | + || (input[rlen] >= '0' && input[rlen] <= '9') |
| 722 | + || (input[rlen] == '_'))) |
| 723 | return 0; |
| 724 | |
| 725 | - return len; |
| 726 | + if (is_curly) |
| 727 | + /* Count the two curly braces. */ |
| 728 | + return rlen + 2; |
| 729 | + else |
| 730 | + return rlen; |
| 731 | } |
| 732 | |
| 733 | - |
| 734 | +/* INPUT is the start of a DST sequence at the first '$' occurrence. |
| 735 | + If there is a DST we call into _dl_dst_count to count the number of |
| 736 | + DSTs. We count all known DSTs regardless of __libc_enable_secure; |
| 737 | + the caller is responsible for enforcing the security of the |
| 738 | + substitution rules (usually _dl_dst_substitute). */ |
| 739 | size_t |
| 740 | -_dl_dst_count (const char *name) |
| 741 | +_dl_dst_count (const char *input) |
| 742 | { |
| 743 | - const char *const start = name; |
| 744 | size_t cnt = 0; |
| 745 | |
| 746 | + input = strchr (input, '$'); |
| 747 | + |
| 748 | + /* Most likely there is no DST. */ |
| 749 | + if (__glibc_likely (input == NULL)) |
| 750 | + return 0; |
| 751 | + |
| 752 | do |
| 753 | { |
| 754 | size_t len; |
| 755 | |
| 756 | - /* $ORIGIN is not expanded for SUID/GUID programs (except if it |
| 757 | - is $ORIGIN alone) and it must always appear first in path. */ |
| 758 | - ++name; |
| 759 | - if ((len = is_dst (start, name, "ORIGIN", __libc_enable_secure)) != 0 |
| 760 | - || (len = is_dst (start, name, "PLATFORM", 0)) != 0 |
| 761 | - || (len = is_dst (start, name, "LIB", 0)) != 0) |
| 762 | + ++input; |
| 763 | + /* All DSTs must follow ELF gABI rules, see is_dst (). */ |
| 764 | + if ((len = is_dst (input, "ORIGIN")) != 0 |
| 765 | + || (len = is_dst (input, "PLATFORM")) != 0 |
| 766 | + || (len = is_dst (input, "LIB")) != 0) |
| 767 | ++cnt; |
| 768 | |
| 769 | - name = strchr (name + len, '$'); |
| 770 | + /* There may be more than one DST in the input. */ |
| 771 | + input = strchr (input + len, '$'); |
| 772 | } |
| 773 | - while (name != NULL); |
| 774 | + while (input != NULL); |
| 775 | |
| 776 | return cnt; |
| 777 | } |
| 778 | |
| 779 | - |
| 780 | +/* Process INPUT for DSTs and store in RESULT using the information |
| 781 | + from link map L to resolve the DSTs. This function only handles one |
| 782 | + path at a time and does not handle colon-separated path lists (see |
| 783 | + fillin_rpath ()). Lastly the size of result in bytes should be at |
| 784 | + least equal to the value returned by DL_DST_REQUIRED. Note that it |
| 785 | + is possible for a DT_NEEDED, DT_AUXILIARY, and DT_FILTER entries to |
| 786 | + have colons, but we treat those as literal colons here, not as path |
| 787 | + list delimeters. */ |
| 788 | char * |
| 789 | -_dl_dst_substitute (struct link_map *l, const char *name, char *result) |
| 790 | +_dl_dst_substitute (struct link_map *l, const char *input, char *result) |
| 791 | { |
| 792 | - const char *const start = name; |
| 793 | - |
| 794 | - /* Now fill the result path. While copying over the string we keep |
| 795 | - track of the start of the last path element. When we come across |
| 796 | - a DST we copy over the value or (if the value is not available) |
| 797 | - leave the entire path element out. */ |
| 798 | + /* Copy character-by-character from input into the working pointer |
| 799 | + looking for any DSTs. We track the start of input and if we are |
| 800 | + going to check for trusted paths, all of which are part of $ORIGIN |
| 801 | + handling in SUID/SGID cases (see below). In some cases, like when |
| 802 | + a DST cannot be replaced, we may set result to an empty string and |
| 803 | + return. */ |
| 804 | char *wp = result; |
| 805 | - char *last_elem = result; |
| 806 | + const char *start = input; |
| 807 | bool check_for_trusted = false; |
| 808 | |
| 809 | do |
| 810 | { |
| 811 | - if (__glibc_unlikely (*name == '$')) |
| 812 | + if (__glibc_unlikely (*input == '$')) |
| 813 | { |
| 814 | const char *repl = NULL; |
| 815 | size_t len; |
| 816 | |
| 817 | - ++name; |
| 818 | - if ((len = is_dst (start, name, "ORIGIN", __libc_enable_secure)) != 0) |
| 819 | + ++input; |
| 820 | + if ((len = is_dst (input, "ORIGIN")) != 0) |
| 821 | { |
| 822 | - repl = l->l_origin; |
| 823 | + /* For SUID/GUID programs we normally ignore the path with |
| 824 | + $ORIGIN in DT_RUNPATH, or DT_RPATH. However, there is |
| 825 | + one exception to this rule, and it is: |
| 826 | + |
| 827 | + * $ORIGIN appears as the first path element, and is |
| 828 | + the only string in the path or is immediately |
| 829 | + followed by a path separator and the rest of the |
| 830 | + path. |
| 831 | + |
| 832 | + * The path is rooted in a trusted directory. |
| 833 | + |
| 834 | + This exception allows such programs to reference |
| 835 | + shared libraries in subdirectories of trusted |
| 836 | + directories. The use case is one of general |
| 837 | + organization and deployment flexibility. |
| 838 | + Trusted directories are usually such paths as "/lib64" |
| 839 | + or "/usr/lib64", and the usual RPATHs take the form of |
| 840 | + [$ORIGIN/../$LIB/somedir]. */ |
| 841 | + if (__glibc_unlikely (__libc_enable_secure) |
| 842 | + && !(input == start + 1 |
| 843 | + && (input[len] == '\0' || input[len] == '/'))) |
| 844 | + repl = (const char *) -1; |
| 845 | + else |
| 846 | + repl = l->l_origin; |
| 847 | + |
| 848 | check_for_trusted = (__libc_enable_secure |
| 849 | && l->l_type == lt_executable); |
| 850 | } |
| 851 | - else if ((len = is_dst (start, name, "PLATFORM", 0)) != 0) |
| 852 | + else if ((len = is_dst (input, "PLATFORM")) != 0) |
| 853 | repl = GLRO(dl_platform); |
| 854 | - else if ((len = is_dst (start, name, "LIB", 0)) != 0) |
| 855 | + else if ((len = is_dst (input, "LIB")) != 0) |
| 856 | repl = DL_DST_LIB; |
| 857 | |
| 858 | if (repl != NULL && repl != (const char *) -1) |
| 859 | { |
| 860 | wp = __stpcpy (wp, repl); |
| 861 | - name += len; |
| 862 | + input += len; |
| 863 | } |
| 864 | - else if (len > 1) |
| 865 | + else if (len != 0) |
| 866 | { |
| 867 | - /* We cannot use this path element, the value of the |
| 868 | - replacement is unknown. */ |
| 869 | - wp = last_elem; |
| 870 | - break; |
| 871 | + /* We found a valid DST that we know about, but we could |
| 872 | + not find a replacement value for it, therefore we |
| 873 | + cannot use this path and discard it. */ |
| 874 | + *result = '\0'; |
| 875 | + return result; |
| 876 | } |
| 877 | else |
| 878 | /* No DST we recognize. */ |
| 879 | @@ -293,16 +338,26 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result) |
| 880 | } |
| 881 | else |
| 882 | { |
| 883 | - *wp++ = *name++; |
| 884 | + *wp++ = *input++; |
| 885 | } |
| 886 | } |
| 887 | - while (*name != '\0'); |
| 888 | + while (*input != '\0'); |
| 889 | |
| 890 | /* In SUID/SGID programs, after $ORIGIN expansion the normalized |
| 891 | - path must be rooted in one of the trusted directories. */ |
| 892 | + path must be rooted in one of the trusted directories. The $LIB |
| 893 | + and $PLATFORM DST cannot in any way be manipulated by the caller |
| 894 | + because they are fixed values that are set by the dynamic loader |
| 895 | + and therefore any paths using just $LIB or $PLATFORM need not be |
| 896 | + checked for trust, the authors of the binaries themselves are |
| 897 | + trusted to have designed this correctly. Only $ORIGIN is tested in |
| 898 | + this way because it may be manipulated in some ways with hard |
| 899 | + links. */ |
| 900 | if (__glibc_unlikely (check_for_trusted) |
| 901 | - && !is_trusted_path_normalize (last_elem, wp - last_elem)) |
| 902 | - wp = last_elem; |
| 903 | + && !is_trusted_path_normalize (result, wp - result)) |
| 904 | + { |
| 905 | + *result = '\0'; |
| 906 | + return result; |
| 907 | + } |
| 908 | |
| 909 | *wp = '\0'; |
| 910 | |
| 911 | @@ -310,13 +365,13 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result) |
| 912 | } |
| 913 | |
| 914 | |
| 915 | -/* Return copy of argument with all recognized dynamic string tokens |
| 916 | - ($ORIGIN and $PLATFORM for now) replaced. On some platforms it |
| 917 | - might not be possible to determine the path from which the object |
| 918 | - belonging to the map is loaded. In this case the path element |
| 919 | - containing $ORIGIN is left out. */ |
| 920 | +/* Return a malloc allocated copy of INPUT with all recognized DSTs |
| 921 | + replaced. On some platforms it might not be possible to determine the |
| 922 | + path from which the object belonging to the map is loaded. In this |
| 923 | + case the path containing the DST is left out. On error NULL |
| 924 | + is returned. */ |
| 925 | static char * |
| 926 | -expand_dynamic_string_token (struct link_map *l, const char *s) |
| 927 | +expand_dynamic_string_token (struct link_map *l, const char *input) |
| 928 | { |
| 929 | /* We make two runs over the string. First we determine how large the |
| 930 | resulting string is and then we copy it over. Since this is no |
| 931 | @@ -326,22 +381,22 @@ expand_dynamic_string_token (struct link_map *l, const char *s) |
| 932 | size_t total; |
| 933 | char *result; |
| 934 | |
| 935 | - /* Determine the number of DST elements. */ |
| 936 | - cnt = DL_DST_COUNT (s); |
| 937 | + /* Determine the number of DSTs. */ |
| 938 | + cnt = _dl_dst_count (input); |
| 939 | |
| 940 | /* If we do not have to replace anything simply copy the string. */ |
| 941 | if (__glibc_likely (cnt == 0)) |
| 942 | - return __strdup (s); |
| 943 | + return __strdup (input); |
| 944 | |
| 945 | /* Determine the length of the substituted string. */ |
| 946 | - total = DL_DST_REQUIRED (l, s, strlen (s), cnt); |
| 947 | + total = DL_DST_REQUIRED (l, input, strlen (input), cnt); |
| 948 | |
| 949 | /* Allocate the necessary memory. */ |
| 950 | result = (char *) malloc (total + 1); |
| 951 | if (result == NULL) |
| 952 | return NULL; |
| 953 | |
| 954 | - return _dl_dst_substitute (l, s, result); |
| 955 | + return _dl_dst_substitute (l, input, result); |
| 956 | } |
| 957 | |
| 958 | |
| 959 | @@ -1469,6 +1524,7 @@ open_verify (const char *name, int fd, |
| 960 | ElfW(Ehdr) *ehdr; |
| 961 | ElfW(Phdr) *phdr, *ph; |
| 962 | ElfW(Word) *abi_note; |
| 963 | + ElfW(Word) *abi_note_malloced = NULL; |
| 964 | unsigned int osversion; |
| 965 | size_t maplength; |
| 966 | |
| 967 | @@ -1640,10 +1696,25 @@ open_verify (const char *name, int fd, |
| 968 | abi_note = (void *) (fbp->buf + ph->p_offset); |
| 969 | else |
| 970 | { |
| 971 | - abi_note = alloca (size); |
| 972 | + /* Note: __libc_use_alloca is not usable here, because |
| 973 | + thread info may not have been set up yet. */ |
| 974 | + if (size < __MAX_ALLOCA_CUTOFF) |
| 975 | + abi_note = alloca (size); |
| 976 | + else |
| 977 | + { |
| 978 | + /* There could be multiple PT_NOTEs. */ |
| 979 | + abi_note_malloced = realloc (abi_note_malloced, size); |
| 980 | + if (abi_note_malloced == NULL) |
| 981 | + goto read_error; |
| 982 | + |
| 983 | + abi_note = abi_note_malloced; |
| 984 | + } |
| 985 | __lseek (fd, ph->p_offset, SEEK_SET); |
| 986 | if (__libc_read (fd, (void *) abi_note, size) != size) |
| 987 | - goto read_error; |
| 988 | + { |
| 989 | + free (abi_note_malloced); |
| 990 | + goto read_error; |
| 991 | + } |
| 992 | } |
| 993 | |
| 994 | while (memcmp (abi_note, &expected_note, sizeof (expected_note))) |
| 995 | @@ -1678,6 +1749,7 @@ open_verify (const char *name, int fd, |
| 996 | |
| 997 | break; |
| 998 | } |
| 999 | + free (abi_note_malloced); |
| 1000 | } |
| 1001 | |
| 1002 | return fd; |
| 1003 | diff --git a/elf/tst-big-note-lib.S b/elf/tst-big-note-lib.S |
| 1004 | new file mode 100644 |
| 1005 | index 0000000000..6b514a03cc |
| 1006 | --- /dev/null |
| 1007 | +++ b/elf/tst-big-note-lib.S |
| 1008 | @@ -0,0 +1,26 @@ |
| 1009 | +/* Bug 20419: test for stack overflow in elf/dl-load.c open_verify() |
| 1010 | + Copyright (C) 2018 Free Software Foundation, Inc. |
| 1011 | + This file is part of the GNU C Library. |
| 1012 | + |
| 1013 | + The GNU C Library is free software; you can redistribute it and/or |
| 1014 | + modify it under the terms of the GNU Lesser General Public |
| 1015 | + License as published by the Free Software Foundation; either |
| 1016 | + version 2.1 of the License, or (at your option) any later version. |
| 1017 | + |
| 1018 | + The GNU C Library is distributed in the hope that it will be useful, |
| 1019 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 1020 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 1021 | + Lesser General Public License for more details. |
| 1022 | + |
| 1023 | + You should have received a copy of the GNU Lesser General Public |
| 1024 | + License along with the GNU C Library; if not, see |
| 1025 | + <http://www.gnu.org/licenses/>. */ |
| 1026 | + |
| 1027 | +/* This creates a .so with 8MiB PT_NOTE segment. |
| 1028 | + On a typical Linux system with 8MiB "ulimit -s", that was enough |
| 1029 | + to trigger stack overflow in open_verify. */ |
| 1030 | + |
| 1031 | +.pushsection .note.big,"a" |
| 1032 | +.balign 4 |
| 1033 | +.fill 8*1024*1024, 1, 0 |
| 1034 | +.popsection |
| 1035 | diff --git a/elf/tst-big-note.c b/elf/tst-big-note.c |
| 1036 | new file mode 100644 |
| 1037 | index 0000000000..fcd2b0ed82 |
| 1038 | --- /dev/null |
| 1039 | +++ b/elf/tst-big-note.c |
| 1040 | @@ -0,0 +1,26 @@ |
| 1041 | +/* Bug 20419: test for stack overflow in elf/dl-load.c open_verify() |
| 1042 | + Copyright (C) 2018 Free Software Foundation, Inc. |
| 1043 | + This file is part of the GNU C Library. |
| 1044 | + |
| 1045 | + The GNU C Library is free software; you can redistribute it and/or |
| 1046 | + modify it under the terms of the GNU Lesser General Public |
| 1047 | + License as published by the Free Software Foundation; either |
| 1048 | + version 2.1 of the License, or (at your option) any later version. |
| 1049 | + |
| 1050 | + The GNU C Library is distributed in the hope that it will be useful, |
| 1051 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 1052 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 1053 | + Lesser General Public License for more details. |
| 1054 | + |
| 1055 | + You should have received a copy of the GNU Lesser General Public |
| 1056 | + License along with the GNU C Library; if not, see |
| 1057 | + <http://www.gnu.org/licenses/>. */ |
| 1058 | + |
| 1059 | +/* This file must be run from within a directory called "elf". */ |
| 1060 | + |
| 1061 | +int main (int argc, char *argv[]) |
| 1062 | +{ |
| 1063 | + /* Nothing to do here: merely linking against tst-big-note-lib.so triggers |
| 1064 | + the bug. */ |
| 1065 | + return 0; |
| 1066 | +} |
| 1067 | diff --git a/include/rpc/clnt.h b/include/rpc/clnt.h |
| 1068 | index a397023a93..80be0a9cec 100644 |
| 1069 | --- a/include/rpc/clnt.h |
| 1070 | +++ b/include/rpc/clnt.h |
| 1071 | @@ -28,6 +28,7 @@ libc_hidden_proto (clntudp_create) |
| 1072 | libc_hidden_proto (get_myaddress) |
| 1073 | libc_hidden_proto (clntunix_create) |
| 1074 | libc_hidden_proto (__libc_clntudp_bufcreate) |
| 1075 | +libc_hidden_proto (rpc_createerr) |
| 1076 | |
| 1077 | # endif /* !_ISOMAC */ |
| 1078 | #endif |
| 1079 | diff --git a/include/rpc/svc.h b/include/rpc/svc.h |
| 1080 | index 465bf4427d..40ba2546a9 100644 |
| 1081 | --- a/include/rpc/svc.h |
| 1082 | +++ b/include/rpc/svc.h |
| 1083 | @@ -3,6 +3,10 @@ |
| 1084 | |
| 1085 | # ifndef _ISOMAC |
| 1086 | |
| 1087 | +libc_hidden_proto (svc_pollfd) |
| 1088 | +libc_hidden_proto (svc_max_pollfd) |
| 1089 | +libc_hidden_proto (svc_fdset) |
| 1090 | + |
| 1091 | libc_hidden_proto (xprt_register) |
| 1092 | libc_hidden_proto (xprt_unregister) |
| 1093 | libc_hidden_proto (svc_register) |
| 1094 | diff --git a/include/unistd.h b/include/unistd.h |
| 1095 | index 0f91b8babc..a171b00326 100644 |
| 1096 | --- a/include/unistd.h |
| 1097 | +++ b/include/unistd.h |
| 1098 | @@ -77,6 +77,8 @@ extern char *__getcwd (char *__buf, size_t __size) attribute_hidden; |
| 1099 | extern int __rmdir (const char *__path) attribute_hidden; |
| 1100 | extern int __execvpe (const char *file, char *const argv[], |
| 1101 | char *const envp[]) attribute_hidden; |
| 1102 | +extern int __execvpex (const char *file, char *const argv[], |
| 1103 | + char *const envp[]) attribute_hidden; |
| 1104 | |
| 1105 | /* Get the canonical absolute name of the named directory, and put it in SIZE |
| 1106 | bytes of BUF. Returns NULL if the directory couldn't be determined or |
| 1107 | diff --git a/io/fcntl.h b/io/fcntl.h |
| 1108 | index 3d239e8f09..69a4394191 100644 |
| 1109 | --- a/io/fcntl.h |
| 1110 | +++ b/io/fcntl.h |
| 1111 | @@ -139,7 +139,7 @@ typedef __pid_t pid_t; |
| 1112 | # define SEEK_END 2 /* Seek from end of file. */ |
| 1113 | #endif /* XPG */ |
| 1114 | |
| 1115 | -/* The constants AT_REMOVEDIR and AT_EACCESS have the same value. AT_EASSESS |
| 1116 | +/* The constants AT_REMOVEDIR and AT_EACCESS have the same value. AT_EACCESS |
| 1117 | is meaningful only to faccessat, while AT_REMOVEDIR is meaningful only to |
| 1118 | unlinkat. The two functions do completely different things and therefore, |
| 1119 | the flags can be allowed to overlap. For example, passing AT_REMOVEDIR to |
| 1120 | diff --git a/libio/memstream.c b/libio/memstream.c |
| 1121 | index d86befcc02..c5c7c2f6db 100644 |
| 1122 | --- a/libio/memstream.c |
| 1123 | +++ b/libio/memstream.c |
| 1124 | @@ -90,8 +90,8 @@ __open_memstream (char **bufloc, _IO_size_t *sizeloc) |
| 1125 | _IO_JUMPS_FILE_plus (&new_f->fp._sf._sbf) = &_IO_mem_jumps; |
| 1126 | _IO_str_init_static_internal (&new_f->fp._sf, buf, _IO_BUFSIZ, buf); |
| 1127 | new_f->fp._sf._sbf._f._flags &= ~_IO_USER_BUF; |
| 1128 | - new_f->fp._sf._s._allocate_buffer = (_IO_alloc_type) malloc; |
| 1129 | - new_f->fp._sf._s._free_buffer = (_IO_free_type) free; |
| 1130 | + new_f->fp._sf._s._allocate_buffer_unused = (_IO_alloc_type) malloc; |
| 1131 | + new_f->fp._sf._s._free_buffer_unused = (_IO_free_type) free; |
| 1132 | |
| 1133 | new_f->fp.bufloc = bufloc; |
| 1134 | new_f->fp.sizeloc = sizeloc; |
| 1135 | diff --git a/libio/strfile.h b/libio/strfile.h |
| 1136 | index 68dfcbfe83..52a085e580 100644 |
| 1137 | --- a/libio/strfile.h |
| 1138 | +++ b/libio/strfile.h |
| 1139 | @@ -31,8 +31,11 @@ typedef void (*_IO_free_type) (void*); |
| 1140 | |
| 1141 | struct _IO_str_fields |
| 1142 | { |
| 1143 | - _IO_alloc_type _allocate_buffer; |
| 1144 | - _IO_free_type _free_buffer; |
| 1145 | + /* These members are preserved for ABI compatibility. The glibc |
| 1146 | + implementation always calls malloc/free for user buffers if |
| 1147 | + _IO_USER_BUF or _IO_FLAGS2_USER_WBUF are not set. */ |
| 1148 | + _IO_alloc_type _allocate_buffer_unused; |
| 1149 | + _IO_free_type _free_buffer_unused; |
| 1150 | }; |
| 1151 | |
| 1152 | /* This is needed for the Irix6 N32 ABI, which has a 64 bit off_t type, |
| 1153 | @@ -52,10 +55,6 @@ typedef struct _IO_strfile_ |
| 1154 | struct _IO_str_fields _s; |
| 1155 | } _IO_strfile; |
| 1156 | |
| 1157 | -/* dynamic: set when the array object is allocated (or reallocated) as |
| 1158 | - necessary to hold a character sequence that can change in length. */ |
| 1159 | -#define _IO_STR_DYNAMIC(FP) ((FP)->_s._allocate_buffer != (_IO_alloc_type)0) |
| 1160 | - |
| 1161 | /* frozen: set when the program has requested that the array object not |
| 1162 | be altered, reallocated, or freed. */ |
| 1163 | #define _IO_STR_FROZEN(FP) ((FP)->_f._IO_file_flags & _IO_USER_BUF) |
| 1164 | diff --git a/libio/strops.c b/libio/strops.c |
| 1165 | index ac995c830e..5fb38976e3 100644 |
| 1166 | --- a/libio/strops.c |
| 1167 | +++ b/libio/strops.c |
| 1168 | @@ -61,7 +61,7 @@ _IO_str_init_static_internal (_IO_strfile *sf, char *ptr, _IO_size_t size, |
| 1169 | fp->_IO_read_end = end; |
| 1170 | } |
| 1171 | /* A null _allocate_buffer function flags the strfile as being static. */ |
| 1172 | - sf->_s._allocate_buffer = (_IO_alloc_type) 0; |
| 1173 | + sf->_s._allocate_buffer_unused = (_IO_alloc_type) 0; |
| 1174 | } |
| 1175 | |
| 1176 | void |
| 1177 | @@ -103,8 +103,7 @@ _IO_str_overflow (_IO_FILE *fp, int c) |
| 1178 | _IO_size_t new_size = 2 * old_blen + 100; |
| 1179 | if (new_size < old_blen) |
| 1180 | return EOF; |
| 1181 | - new_buf |
| 1182 | - = (char *) (*((_IO_strfile *) fp)->_s._allocate_buffer) (new_size); |
| 1183 | + new_buf = malloc (new_size); |
| 1184 | if (new_buf == NULL) |
| 1185 | { |
| 1186 | /* __ferror(fp) = 1; */ |
| 1187 | @@ -113,7 +112,7 @@ _IO_str_overflow (_IO_FILE *fp, int c) |
| 1188 | if (old_buf) |
| 1189 | { |
| 1190 | memcpy (new_buf, old_buf, old_blen); |
| 1191 | - (*((_IO_strfile *) fp)->_s._free_buffer) (old_buf); |
| 1192 | + free (old_buf); |
| 1193 | /* Make sure _IO_setb won't try to delete _IO_buf_base. */ |
| 1194 | fp->_IO_buf_base = NULL; |
| 1195 | } |
| 1196 | @@ -182,15 +181,14 @@ enlarge_userbuf (_IO_FILE *fp, _IO_off64_t offset, int reading) |
| 1197 | |
| 1198 | _IO_size_t newsize = offset + 100; |
| 1199 | char *oldbuf = fp->_IO_buf_base; |
| 1200 | - char *newbuf |
| 1201 | - = (char *) (*((_IO_strfile *) fp)->_s._allocate_buffer) (newsize); |
| 1202 | + char *newbuf = malloc (newsize); |
| 1203 | if (newbuf == NULL) |
| 1204 | return 1; |
| 1205 | |
| 1206 | if (oldbuf != NULL) |
| 1207 | { |
| 1208 | memcpy (newbuf, oldbuf, _IO_blen (fp)); |
| 1209 | - (*((_IO_strfile *) fp)->_s._free_buffer) (oldbuf); |
| 1210 | + free (oldbuf); |
| 1211 | /* Make sure _IO_setb won't try to delete |
| 1212 | _IO_buf_base. */ |
| 1213 | fp->_IO_buf_base = NULL; |
| 1214 | @@ -346,7 +344,7 @@ void |
| 1215 | _IO_str_finish (_IO_FILE *fp, int dummy) |
| 1216 | { |
| 1217 | if (fp->_IO_buf_base && !(fp->_flags & _IO_USER_BUF)) |
| 1218 | - (((_IO_strfile *) fp)->_s._free_buffer) (fp->_IO_buf_base); |
| 1219 | + free (fp->_IO_buf_base); |
| 1220 | fp->_IO_buf_base = NULL; |
| 1221 | |
| 1222 | _IO_default_finish (fp, 0); |
| 1223 | diff --git a/libio/vasprintf.c b/libio/vasprintf.c |
| 1224 | index 390a63d124..0bb217e46e 100644 |
| 1225 | --- a/libio/vasprintf.c |
| 1226 | +++ b/libio/vasprintf.c |
| 1227 | @@ -54,8 +54,8 @@ _IO_vasprintf (char **result_ptr, const char *format, _IO_va_list args) |
| 1228 | _IO_JUMPS (&sf._sbf) = &_IO_str_jumps; |
| 1229 | _IO_str_init_static_internal (&sf, string, init_string_size, string); |
| 1230 | sf._sbf._f._flags &= ~_IO_USER_BUF; |
| 1231 | - sf._s._allocate_buffer = (_IO_alloc_type) malloc; |
| 1232 | - sf._s._free_buffer = (_IO_free_type) free; |
| 1233 | + sf._s._allocate_buffer_unused = (_IO_alloc_type) malloc; |
| 1234 | + sf._s._free_buffer_unused = (_IO_free_type) free; |
| 1235 | ret = _IO_vfprintf (&sf._sbf._f, format, args); |
| 1236 | if (ret < 0) |
| 1237 | { |
| 1238 | diff --git a/libio/wmemstream.c b/libio/wmemstream.c |
| 1239 | index c962071d26..f4c6e75246 100644 |
| 1240 | --- a/libio/wmemstream.c |
| 1241 | +++ b/libio/wmemstream.c |
| 1242 | @@ -92,8 +92,8 @@ open_wmemstream (wchar_t **bufloc, _IO_size_t *sizeloc) |
| 1243 | _IO_wstr_init_static (&new_f->fp._sf._sbf._f, buf, |
| 1244 | _IO_BUFSIZ / sizeof (wchar_t), buf); |
| 1245 | new_f->fp._sf._sbf._f._flags2 &= ~_IO_FLAGS2_USER_WBUF; |
| 1246 | - new_f->fp._sf._s._allocate_buffer = (_IO_alloc_type) malloc; |
| 1247 | - new_f->fp._sf._s._free_buffer = (_IO_free_type) free; |
| 1248 | + new_f->fp._sf._s._allocate_buffer_unused = (_IO_alloc_type) malloc; |
| 1249 | + new_f->fp._sf._s._free_buffer_unused = (_IO_free_type) free; |
| 1250 | |
| 1251 | new_f->fp.bufloc = bufloc; |
| 1252 | new_f->fp.sizeloc = sizeloc; |
| 1253 | diff --git a/libio/wstrops.c b/libio/wstrops.c |
| 1254 | index a3374a7b15..0839a70bfb 100644 |
| 1255 | --- a/libio/wstrops.c |
| 1256 | +++ b/libio/wstrops.c |
| 1257 | @@ -63,7 +63,7 @@ _IO_wstr_init_static (_IO_FILE *fp, wchar_t *ptr, _IO_size_t size, |
| 1258 | fp->_wide_data->_IO_read_end = end; |
| 1259 | } |
| 1260 | /* A null _allocate_buffer function flags the strfile as being static. */ |
| 1261 | - (((_IO_strfile *) fp)->_s._allocate_buffer) = (_IO_alloc_type)0; |
| 1262 | + (((_IO_strfile *) fp)->_s._allocate_buffer_unused) = (_IO_alloc_type)0; |
| 1263 | } |
| 1264 | |
| 1265 | _IO_wint_t |
| 1266 | @@ -95,9 +95,7 @@ _IO_wstr_overflow (_IO_FILE *fp, _IO_wint_t c) |
| 1267 | || __glibc_unlikely (new_size > SIZE_MAX / sizeof (wchar_t))) |
| 1268 | return EOF; |
| 1269 | |
| 1270 | - new_buf |
| 1271 | - = (wchar_t *) (*((_IO_strfile *) fp)->_s._allocate_buffer) (new_size |
| 1272 | - * sizeof (wchar_t)); |
| 1273 | + new_buf = malloc (new_size * sizeof (wchar_t)); |
| 1274 | if (new_buf == NULL) |
| 1275 | { |
| 1276 | /* __ferror(fp) = 1; */ |
| 1277 | @@ -106,7 +104,7 @@ _IO_wstr_overflow (_IO_FILE *fp, _IO_wint_t c) |
| 1278 | if (old_buf) |
| 1279 | { |
| 1280 | __wmemcpy (new_buf, old_buf, old_wblen); |
| 1281 | - (*((_IO_strfile *) fp)->_s._free_buffer) (old_buf); |
| 1282 | + free (old_buf); |
| 1283 | /* Make sure _IO_setb won't try to delete _IO_buf_base. */ |
| 1284 | fp->_wide_data->_IO_buf_base = NULL; |
| 1285 | } |
| 1286 | @@ -186,16 +184,14 @@ enlarge_userbuf (_IO_FILE *fp, _IO_off64_t offset, int reading) |
| 1287 | return 1; |
| 1288 | |
| 1289 | wchar_t *oldbuf = wd->_IO_buf_base; |
| 1290 | - wchar_t *newbuf |
| 1291 | - = (wchar_t *) (*((_IO_strfile *) fp)->_s._allocate_buffer) (newsize |
| 1292 | - * sizeof (wchar_t)); |
| 1293 | + wchar_t *newbuf = malloc (newsize * sizeof (wchar_t)); |
| 1294 | if (newbuf == NULL) |
| 1295 | return 1; |
| 1296 | |
| 1297 | if (oldbuf != NULL) |
| 1298 | { |
| 1299 | __wmemcpy (newbuf, oldbuf, _IO_wblen (fp)); |
| 1300 | - (*((_IO_strfile *) fp)->_s._free_buffer) (oldbuf); |
| 1301 | + free (oldbuf); |
| 1302 | /* Make sure _IO_setb won't try to delete |
| 1303 | _IO_buf_base. */ |
| 1304 | wd->_IO_buf_base = NULL; |
| 1305 | @@ -357,7 +353,7 @@ void |
| 1306 | _IO_wstr_finish (_IO_FILE *fp, int dummy) |
| 1307 | { |
| 1308 | if (fp->_wide_data->_IO_buf_base && !(fp->_flags2 & _IO_FLAGS2_USER_WBUF)) |
| 1309 | - (((_IO_strfile *) fp)->_s._free_buffer) (fp->_wide_data->_IO_buf_base); |
| 1310 | + free (fp->_wide_data->_IO_buf_base); |
| 1311 | fp->_wide_data->_IO_buf_base = NULL; |
| 1312 | |
| 1313 | _IO_wdefault_finish (fp, 0); |
| 1314 | diff --git a/localedata/locales/ca_ES b/localedata/locales/ca_ES |
| 1315 | index 914c066dab..f0d744d537 100644 |
| 1316 | --- a/localedata/locales/ca_ES |
| 1317 | +++ b/localedata/locales/ca_ES |
| 1318 | @@ -106,36 +106,67 @@ grouping 0;0 |
| 1319 | END LC_NUMERIC |
| 1320 | |
| 1321 | LC_TIME |
| 1322 | -abday "dg";"dl";"dt";"dc";"dj";"dv";"ds" |
| 1323 | -day "diumenge";/ |
| 1324 | - "dilluns";/ |
| 1325 | - "dimarts";/ |
| 1326 | - "dimecres";/ |
| 1327 | - "dijous";/ |
| 1328 | - "divendres";/ |
| 1329 | - "dissabte" |
| 1330 | -abmon "gen";"feb";/ |
| 1331 | - "mar";"abr";/ |
| 1332 | - "mai";"jun";/ |
| 1333 | - "jul";"ago";/ |
| 1334 | - "set";"oct";/ |
| 1335 | - "nov";"des" |
| 1336 | -mon "gener";/ |
| 1337 | - "febrer";/ |
| 1338 | - "mar<U00E7>";/ |
| 1339 | - "abril";/ |
| 1340 | - "maig";/ |
| 1341 | - "juny";/ |
| 1342 | - "juliol";/ |
| 1343 | - "agost";/ |
| 1344 | - "setembre";/ |
| 1345 | - "octubre";/ |
| 1346 | - "novembre";/ |
| 1347 | - "desembre" |
| 1348 | -d_t_fmt "%a %d %b %Y %T %Z" |
| 1349 | -d_fmt "%d//%m//%y" |
| 1350 | -t_fmt "%T" |
| 1351 | -am_pm "";"" |
| 1352 | +abday "dg.";"dl.";"dt.";"dc.";"dj.";"dv.";"ds." |
| 1353 | +day "diumenge";/ |
| 1354 | + "dilluns";/ |
| 1355 | + "dimarts";/ |
| 1356 | + "dimecres";/ |
| 1357 | + "dijous";/ |
| 1358 | + "divendres";/ |
| 1359 | + "dissabte" |
| 1360 | +ab_alt_mon "gen.";/ |
| 1361 | + "febr.";/ |
| 1362 | + "mar<U00E7>";/ |
| 1363 | + "abr.";/ |
| 1364 | + "maig";/ |
| 1365 | + "juny";/ |
| 1366 | + "jul.";/ |
| 1367 | + "ag.";/ |
| 1368 | + "set.";/ |
| 1369 | + "oct.";/ |
| 1370 | + "nov.";/ |
| 1371 | + "des." |
| 1372 | +abmon "de gen.";/ |
| 1373 | + "de febr.";/ |
| 1374 | + "de mar<U00E7>";/ |
| 1375 | + "d<U2019>abr.";/ |
| 1376 | + "de maig";/ |
| 1377 | + "de juny";/ |
| 1378 | + "de jul.";/ |
| 1379 | + "d<U2019>ag.";/ |
| 1380 | + "de set.";/ |
| 1381 | + "d<U2019>oct.";/ |
| 1382 | + "de nov.";/ |
| 1383 | + "de des." |
| 1384 | +alt_mon "gener";/ |
| 1385 | + "febrer";/ |
| 1386 | + "mar<U00E7>";/ |
| 1387 | + "abril";/ |
| 1388 | + "maig";/ |
| 1389 | + "juny";/ |
| 1390 | + "juliol";/ |
| 1391 | + "agost";/ |
| 1392 | + "setembre";/ |
| 1393 | + "octubre";/ |
| 1394 | + "novembre";/ |
| 1395 | + "desembre" |
| 1396 | +mon "de gener";/ |
| 1397 | + "de febrer";/ |
| 1398 | + "de mar<U00E7>";/ |
| 1399 | + "d<U2019>abril";/ |
| 1400 | + "de maig";/ |
| 1401 | + "de juny";/ |
| 1402 | + "de juliol";/ |
| 1403 | + "d<U2019>agost";/ |
| 1404 | + "de setembre";/ |
| 1405 | + "d<U2019>octubre";/ |
| 1406 | + "de novembre";/ |
| 1407 | + "de desembre" |
| 1408 | +d_t_fmt "%A, %-d %B de %Y, %T %Z" |
| 1409 | +d_fmt "%-d//%-m//%y" |
| 1410 | +t_fmt "%T" |
| 1411 | +am_pm "a. m.";/ |
| 1412 | + "p. m." |
| 1413 | t_fmt_ampm "" |
| 1414 | week 7;19971130;4 |
| 1415 | first_weekday 2 |
| 1416 | @@ -146,9 +177,9 @@ copy "i18n" |
| 1417 | END LC_PAPER |
| 1418 | |
| 1419 | LC_TELEPHONE |
| 1420 | -tel_int_fmt "+%c %a %l" |
| 1421 | -int_prefix "34" |
| 1422 | -int_select "00" |
| 1423 | +tel_int_fmt "+%c %a %l" |
| 1424 | +int_prefix "34" |
| 1425 | +int_select "00" |
| 1426 | END LC_TELEPHONE |
| 1427 | |
| 1428 | LC_MEASUREMENT |
| 1429 | @@ -156,19 +187,19 @@ copy "i18n" |
| 1430 | END LC_MEASUREMENT |
| 1431 | |
| 1432 | LC_NAME |
| 1433 | -name_fmt "%d%t%g%t%m%t%f" |
| 1434 | +name_fmt "%d%t%g%t%m%t%f" |
| 1435 | END LC_NAME |
| 1436 | |
| 1437 | LC_ADDRESS |
| 1438 | -postal_fmt "%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N" |
| 1439 | +postal_fmt "%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N" |
| 1440 | country_name "Espanya" |
| 1441 | -country_ab2 "ES" |
| 1442 | -country_ab3 "ESP" |
| 1443 | -country_num 724 |
| 1444 | -country_car "E" |
| 1445 | +country_ab2 "ES" |
| 1446 | +country_ab3 "ESP" |
| 1447 | +country_num 724 |
| 1448 | +country_car "E" |
| 1449 | % català |
| 1450 | lang_name "catal<U00E0>" |
| 1451 | lang_ab "ca" |
| 1452 | lang_term "cat" |
| 1453 | -lang_lib "cat" |
| 1454 | +lang_lib "cat" |
| 1455 | END LC_ADDRESS |
| 1456 | diff --git a/localedata/locales/cs_CZ b/localedata/locales/cs_CZ |
| 1457 | index f80d3e1b37..8f4c69e493 100644 |
| 1458 | --- a/localedata/locales/cs_CZ |
| 1459 | +++ b/localedata/locales/cs_CZ |
| 1460 | @@ -272,7 +272,7 @@ day "Ned<U011B>le";/ |
| 1461 | "P<U00E1>tek";/ |
| 1462 | "Sobota" |
| 1463 | |
| 1464 | -mon "leden";/ |
| 1465 | +alt_mon "leden";/ |
| 1466 | "<U00FA>nor";/ |
| 1467 | "b<U0159>ezen";/ |
| 1468 | "duben";/ |
| 1469 | @@ -334,6 +334,19 @@ abmon "led";/ |
| 1470 | % "Nov";/ |
| 1471 | % "Dec" |
| 1472 | |
| 1473 | +mon "ledna";/ |
| 1474 | + "<U00FA>nora";/ |
| 1475 | + "b<U0159>ezna";/ |
| 1476 | + "dubna";/ |
| 1477 | + "kv<U011B>tna";/ |
| 1478 | + "<U010D>ervna";/ |
| 1479 | + "<U010D>ervence";/ |
| 1480 | + "srpna";/ |
| 1481 | + "z<U00E1><U0159><U00ED>";/ |
| 1482 | + "<U0159><U00ED>jna";/ |
| 1483 | + "listopadu";/ |
| 1484 | + "prosince" |
| 1485 | + |
| 1486 | week 7;19971130;4 |
| 1487 | first_weekday 2 |
| 1488 | |
| 1489 | diff --git a/localedata/locales/el_CY b/localedata/locales/el_CY |
| 1490 | index f27a74bb76..28055f335b 100644 |
| 1491 | --- a/localedata/locales/el_CY |
| 1492 | +++ b/localedata/locales/el_CY |
| 1493 | @@ -72,12 +72,18 @@ day "<U039A><U03C5><U03C1><U03B9><U03B1><U03BA><U03AE>";/ |
| 1494 | "<U03A0><U03AD><U03BC><U03C0><U03C4><U03B7>";/ |
| 1495 | "<U03A0><U03B1><U03C1><U03B1><U03C3><U03BA><U03B5><U03C5><U03AE>";/ |
| 1496 | "<U03A3><U03AC><U03B2><U03B2><U03B1><U03C4><U03BF>" |
| 1497 | -abmon "<U0399><U03B1><U03BD>";"<U03A6><U03B5><U03B2>";/ |
| 1498 | +ab_alt_mon "<U0399><U03B1><U03BD>";"<U03A6><U03B5><U03B2>";/ |
| 1499 | "<U039C><U03AC><U03C1>";"<U0391><U03C0><U03C1>";/ |
| 1500 | "<U039C><U03AC><U03B9>";"<U0399><U03BF><U03CD><U03BD>";/ |
| 1501 | "<U0399><U03BF><U03CD><U03BB>";"<U0391><U03CD><U03B3>";/ |
| 1502 | "<U03A3><U03B5><U03C0>";"<U039F><U03BA><U03C4>";/ |
| 1503 | "<U039D><U03BF><U03AD>";"<U0394><U03B5><U03BA>" |
| 1504 | +abmon "<U0399><U03B1><U03BD>";"<U03A6><U03B5><U03B2>";/ |
| 1505 | + "<U039C><U03B1><U03C1>";"<U0391><U03C0><U03C1>";/ |
| 1506 | + "<U039C><U03B1><U0390>";"<U0399><U03BF><U03C5><U03BD>";/ |
| 1507 | + "<U0399><U03BF><U03C5><U03BB>";"<U0391><U03C5><U03B3>";/ |
| 1508 | + "<U03A3><U03B5><U03C0>";"<U039F><U03BA><U03C4>";/ |
| 1509 | + "<U039D><U03BF><U03B5>";"<U0394><U03B5><U03BA>" |
| 1510 | alt_mon "<U0399><U03B1><U03BD><U03BF><U03C5><U03AC><U03C1><U03B9><U03BF><U03C2>";/ |
| 1511 | "<U03A6><U03B5><U03B2><U03C1><U03BF><U03C5><U03AC><U03C1><U03B9><U03BF><U03C2>";/ |
| 1512 | "<U039C><U03AC><U03C1><U03C4><U03B9><U03BF><U03C2>";/ |
| 1513 | diff --git a/localedata/locales/el_GR b/localedata/locales/el_GR |
| 1514 | index a82ef8c6d9..7362492fbd 100644 |
| 1515 | --- a/localedata/locales/el_GR |
| 1516 | +++ b/localedata/locales/el_GR |
| 1517 | @@ -104,12 +104,18 @@ day "<U039A><U03C5><U03C1><U03B9><U03B1><U03BA><U03AE>";/ |
| 1518 | "<U03A0><U03AD><U03BC><U03C0><U03C4><U03B7>";/ |
| 1519 | "<U03A0><U03B1><U03C1><U03B1><U03C3><U03BA><U03B5><U03C5><U03AE>";/ |
| 1520 | "<U03A3><U03AC><U03B2><U03B2><U03B1><U03C4><U03BF>" |
| 1521 | -abmon "<U0399><U03B1><U03BD>";"<U03A6><U03B5><U03B2>";/ |
| 1522 | +ab_alt_mon "<U0399><U03B1><U03BD>";"<U03A6><U03B5><U03B2>";/ |
| 1523 | "<U039C><U03AC><U03C1>";"<U0391><U03C0><U03C1>";/ |
| 1524 | "<U039C><U03AC><U03B9>";"<U0399><U03BF><U03CD><U03BD>";/ |
| 1525 | "<U0399><U03BF><U03CD><U03BB>";"<U0391><U03CD><U03B3>";/ |
| 1526 | "<U03A3><U03B5><U03C0>";"<U039F><U03BA><U03C4>";/ |
| 1527 | "<U039D><U03BF><U03AD>";"<U0394><U03B5><U03BA>" |
| 1528 | +abmon "<U0399><U03B1><U03BD>";"<U03A6><U03B5><U03B2>";/ |
| 1529 | + "<U039C><U03B1><U03C1>";"<U0391><U03C0><U03C1>";/ |
| 1530 | + "<U039C><U03B1><U0390>";"<U0399><U03BF><U03C5><U03BD>";/ |
| 1531 | + "<U0399><U03BF><U03C5><U03BB>";"<U0391><U03C5><U03B3>";/ |
| 1532 | + "<U03A3><U03B5><U03C0>";"<U039F><U03BA><U03C4>";/ |
| 1533 | + "<U039D><U03BF><U03B5>";"<U0394><U03B5><U03BA>" |
| 1534 | alt_mon "<U0399><U03B1><U03BD><U03BF><U03C5><U03AC><U03C1><U03B9><U03BF><U03C2>";/ |
| 1535 | "<U03A6><U03B5><U03B2><U03C1><U03BF><U03C5><U03AC><U03C1><U03B9><U03BF><U03C2>";/ |
| 1536 | "<U039C><U03AC><U03C1><U03C4><U03B9><U03BF><U03C2>";/ |
| 1537 | diff --git a/localedata/locales/et_EE b/localedata/locales/et_EE |
| 1538 | index 9cb55b568f..bab7493c98 100644 |
| 1539 | --- a/localedata/locales/et_EE |
| 1540 | +++ b/localedata/locales/et_EE |
| 1541 | @@ -103,6 +103,8 @@ reorder-after <w> |
| 1542 | <U00FC> <u-diaresis>;<BAS>;<MIN>;IGNORE % ü |
| 1543 | <U00DC> <u-diaresis>;<BAS>;<CAP>;IGNORE % Ü |
| 1544 | |
| 1545 | +reorder-end |
| 1546 | + |
| 1547 | END LC_COLLATE |
| 1548 | |
| 1549 | LC_CTYPE |
| 1550 | diff --git a/localedata/locales/gd_GB b/localedata/locales/gd_GB |
| 1551 | index 676ee940c9..77d11e5977 100644 |
| 1552 | --- a/localedata/locales/gd_GB |
| 1553 | +++ b/localedata/locales/gd_GB |
| 1554 | @@ -66,12 +66,12 @@ mon "Am Faoilleach";/ |
| 1555 | "An D<U00E0>mhair";/ |
| 1556 | "An t-Samhain";/ |
| 1557 | "An D<U00F9>bhlachd" |
| 1558 | -% Faoi, Gearr, Màrt, Gibl, Mhàrt, Ògmh, Iuch, Lùna, Sult, Dàmh, Samh, Dùbh |
| 1559 | +% Faoi, Gearr, Màrt, Gibl, Cèit, Ògmh, Iuch, Lùna, Sult, Dàmh, Samh, Dùbh |
| 1560 | abmon "Faoi";/ |
| 1561 | "Gearr";/ |
| 1562 | "M<U00E0>rt";/ |
| 1563 | "Gibl";/ |
| 1564 | - "Mh<U00E0>rt";/ |
| 1565 | + "C<U00E8>it";/ |
| 1566 | "<U00D2>gmh";/ |
| 1567 | "Iuch";/ |
| 1568 | "L<U00F9>na";/ |
| 1569 | diff --git a/localedata/locales/lt_LT b/localedata/locales/lt_LT |
| 1570 | index c935fcf75e..bec67726e9 100644 |
| 1571 | --- a/localedata/locales/lt_LT |
| 1572 | +++ b/localedata/locales/lt_LT |
| 1573 | @@ -201,12 +201,12 @@ day "Sekmadienis";/ |
| 1574 | "Ketvirtadienis";/ |
| 1575 | "Penktadienis";/ |
| 1576 | "<U0160>e<U0161>tadienis" |
| 1577 | -abmon "Sau";"Vas";/ |
| 1578 | - "Kov";"Bal";/ |
| 1579 | - "Geg";"Bir";/ |
| 1580 | - "Lie";"Rgp";/ |
| 1581 | - "Rgs";"Spa";/ |
| 1582 | - "Lap";"Grd" |
| 1583 | +abmon "saus.";"vas.";/ |
| 1584 | + "kov.";"bal.";/ |
| 1585 | + "geg.";"bir<U017E>.";/ |
| 1586 | + "liep.";"rugp.";/ |
| 1587 | + "rugs.";"spal.";/ |
| 1588 | + "lapkr.";"gruod." |
| 1589 | alt_mon "sausis";/ |
| 1590 | "vasaris";/ |
| 1591 | "kovas";/ |
| 1592 | diff --git a/manual/charset.texi b/manual/charset.texi |
| 1593 | index 1867ace485..f6a980f6cb 100644 |
| 1594 | --- a/manual/charset.texi |
| 1595 | +++ b/manual/charset.texi |
| 1596 | @@ -643,8 +643,8 @@ and they also do not require it to be in the initial state. |
| 1597 | @cindex stateful |
| 1598 | The @code{mbrtowc} function (``multibyte restartable to wide |
| 1599 | character'') converts the next multibyte character in the string pointed |
| 1600 | -to by @var{s} into a wide character and stores it in the wide character |
| 1601 | -string pointed to by @var{pwc}. The conversion is performed according |
| 1602 | +to by @var{s} into a wide character and stores it in the location |
| 1603 | +pointed to by @var{pwc}. The conversion is performed according |
| 1604 | to the locale currently selected for the @code{LC_CTYPE} category. If |
| 1605 | the conversion for the character set used in the locale requires a state, |
| 1606 | the multibyte string is interpreted in the state represented by the |
| 1607 | @@ -652,7 +652,7 @@ object pointed to by @var{ps}. If @var{ps} is a null pointer, a static, |
| 1608 | internal state variable used only by the @code{mbrtowc} function is |
| 1609 | used. |
| 1610 | |
| 1611 | -If the next multibyte character corresponds to the NUL wide character, |
| 1612 | +If the next multibyte character corresponds to the null wide character, |
| 1613 | the return value of the function is @math{0} and the state object is |
| 1614 | afterwards in the initial state. If the next @var{n} or fewer bytes |
| 1615 | form a correct multibyte character, the return value is the number of |
| 1616 | @@ -665,71 +665,59 @@ by @var{pwc} if @var{pwc} is not null. |
| 1617 | If the first @var{n} bytes of the multibyte string possibly form a valid |
| 1618 | multibyte character but there are more than @var{n} bytes needed to |
| 1619 | complete it, the return value of the function is @code{(size_t) -2} and |
| 1620 | -no value is stored. Please note that this can happen even if @var{n} |
| 1621 | -has a value greater than or equal to @code{MB_CUR_MAX} since the input |
| 1622 | -might contain redundant shift sequences. |
| 1623 | +no value is stored in @code{*@var{pwc}}. The conversion state is |
| 1624 | +updated and all @var{n} input bytes are consumed and should not be |
| 1625 | +submitted again. Please note that this can happen even if @var{n} has a |
| 1626 | +value greater than or equal to @code{MB_CUR_MAX} since the input might |
| 1627 | +contain redundant shift sequences. |
| 1628 | |
| 1629 | If the first @code{n} bytes of the multibyte string cannot possibly form |
| 1630 | a valid multibyte character, no value is stored, the global variable |
| 1631 | @code{errno} is set to the value @code{EILSEQ}, and the function returns |
| 1632 | @code{(size_t) -1}. The conversion state is afterwards undefined. |
| 1633 | |
| 1634 | +As specified, the @code{mbrtowc} function could deal with multibyte |
| 1635 | +sequences which contain embedded null bytes (which happens in Unicode |
| 1636 | +encodings such as UTF-16), but @theglibc{} does not support such |
| 1637 | +multibyte encodings. When encountering a null input byte, the function |
| 1638 | +will either return zero, or return @code{(size_t) -1)} and report a |
| 1639 | +@code{EILSEQ} error. The @code{iconv} function can be used for |
| 1640 | +converting between arbitrary encodings. @xref{Generic Conversion |
| 1641 | +Interface}. |
| 1642 | + |
| 1643 | @pindex wchar.h |
| 1644 | @code{mbrtowc} was introduced in @w{Amendment 1} to @w{ISO C90} and |
| 1645 | is declared in @file{wchar.h}. |
| 1646 | @end deftypefun |
| 1647 | |
| 1648 | -Use of @code{mbrtowc} is straightforward. A function that copies a |
| 1649 | -multibyte string into a wide character string while at the same time |
| 1650 | -converting all lowercase characters into uppercase could look like this |
| 1651 | -(this is not the final version, just an example; it has no error |
| 1652 | -checking, and sometimes leaks memory): |
| 1653 | +A function that copies a multibyte string into a wide character string |
| 1654 | +while at the same time converting all lowercase characters into |
| 1655 | +uppercase could look like this: |
| 1656 | |
| 1657 | @smallexample |
| 1658 | -wchar_t * |
| 1659 | -mbstouwcs (const char *s) |
| 1660 | -@{ |
| 1661 | - size_t len = strlen (s); |
| 1662 | - wchar_t *result = malloc ((len + 1) * sizeof (wchar_t)); |
| 1663 | - wchar_t *wcp = result; |
| 1664 | - wchar_t tmp[1]; |
| 1665 | - mbstate_t state; |
| 1666 | - size_t nbytes; |
| 1667 | - |
| 1668 | - memset (&state, '\0', sizeof (state)); |
| 1669 | - while ((nbytes = mbrtowc (tmp, s, len, &state)) > 0) |
| 1670 | - @{ |
| 1671 | - if (nbytes >= (size_t) -2) |
| 1672 | - /* Invalid input string. */ |
| 1673 | - return NULL; |
| 1674 | - *wcp++ = towupper (tmp[0]); |
| 1675 | - len -= nbytes; |
| 1676 | - s += nbytes; |
| 1677 | - @} |
| 1678 | - return result; |
| 1679 | -@} |
| 1680 | +@include mbstouwcs.c.texi |
| 1681 | @end smallexample |
| 1682 | |
| 1683 | -The use of @code{mbrtowc} should be clear. A single wide character is |
| 1684 | -stored in @code{@var{tmp}[0]}, and the number of consumed bytes is stored |
| 1685 | -in the variable @var{nbytes}. If the conversion is successful, the |
| 1686 | -uppercase variant of the wide character is stored in the @var{result} |
| 1687 | -array and the pointer to the input string and the number of available |
| 1688 | -bytes is adjusted. |
| 1689 | - |
| 1690 | -The only non-obvious thing about @code{mbrtowc} might be the way memory |
| 1691 | -is allocated for the result. The above code uses the fact that there |
| 1692 | -can never be more wide characters in the converted result than there are |
| 1693 | -bytes in the multibyte input string. This method yields a pessimistic |
| 1694 | -guess about the size of the result, and if many wide character strings |
| 1695 | -have to be constructed this way or if the strings are long, the extra |
| 1696 | -memory required to be allocated because the input string contains |
| 1697 | -multibyte characters might be significant. The allocated memory block can |
| 1698 | -be resized to the correct size before returning it, but a better solution |
| 1699 | -might be to allocate just the right amount of space for the result right |
| 1700 | -away. Unfortunately there is no function to compute the length of the wide |
| 1701 | -character string directly from the multibyte string. There is, however, a |
| 1702 | -function that does part of the work. |
| 1703 | +In the inner loop, a single wide character is stored in @code{wc}, and |
| 1704 | +the number of consumed bytes is stored in the variable @code{nbytes}. |
| 1705 | +If the conversion is successful, the uppercase variant of the wide |
| 1706 | +character is stored in the @code{result} array and the pointer to the |
| 1707 | +input string and the number of available bytes is adjusted. If the |
| 1708 | +@code{mbrtowc} function returns zero, the null input byte has not been |
| 1709 | +converted, so it must be stored explicitly in the result. |
| 1710 | + |
| 1711 | +The above code uses the fact that there can never be more wide |
| 1712 | +characters in the converted result than there are bytes in the multibyte |
| 1713 | +input string. This method yields a pessimistic guess about the size of |
| 1714 | +the result, and if many wide character strings have to be constructed |
| 1715 | +this way or if the strings are long, the extra memory required to be |
| 1716 | +allocated because the input string contains multibyte characters might |
| 1717 | +be significant. The allocated memory block can be resized to the |
| 1718 | +correct size before returning it, but a better solution might be to |
| 1719 | +allocate just the right amount of space for the result right away. |
| 1720 | +Unfortunately there is no function to compute the length of the wide |
| 1721 | +character string directly from the multibyte string. There is, however, |
| 1722 | +a function that does part of the work. |
| 1723 | |
| 1724 | @deftypefun size_t mbrlen (const char *restrict @var{s}, size_t @var{n}, mbstate_t *@var{ps}) |
| 1725 | @standards{ISO, wchar.h} |
| 1726 | diff --git a/manual/creature.texi b/manual/creature.texi |
| 1727 | index 96f8ee0a0c..fe7a7790a2 100644 |
| 1728 | --- a/manual/creature.texi |
| 1729 | +++ b/manual/creature.texi |
| 1730 | @@ -8,7 +8,7 @@ is controlled by which @dfn{feature test macros} you define. |
| 1731 | If you compile your programs using @samp{gcc -ansi}, you get only the |
| 1732 | @w{ISO C} library features, unless you explicitly request additional |
| 1733 | features by defining one or more of the feature macros. |
| 1734 | -@xref{Invoking GCC,, GNU CC Command Options, gcc.info, The GNU CC Manual}, |
| 1735 | +@xref{Invoking GCC,, GNU CC Command Options, gcc, The GNU CC Manual}, |
| 1736 | for more information about GCC options.@refill |
| 1737 | |
| 1738 | You should define these macros by using @samp{#define} preprocessor |
| 1739 | @@ -61,13 +61,27 @@ If you define this macro to a value greater than or equal to @code{199309L}, |
| 1740 | then the functionality from the 1993 edition of the POSIX.1b standard |
| 1741 | (IEEE Standard 1003.1b-1993) is made available. |
| 1742 | |
| 1743 | +If you define this macro to a value greater than or equal to |
| 1744 | +@code{199506L}, then the functionality from the 1995 edition of the |
| 1745 | +POSIX.1c standard (IEEE Standard 1003.1c-1995) is made available. |
| 1746 | + |
| 1747 | +If you define this macro to a value greater than or equal to |
| 1748 | +@code{200112L}, then the functionality from the 2001 edition of the |
| 1749 | +POSIX standard (IEEE Standard 1003.1-2001) is made available. |
| 1750 | + |
| 1751 | +If you define this macro to a value greater than or equal to |
| 1752 | +@code{200809L}, then the functionality from the 2008 edition of the |
| 1753 | +POSIX standard (IEEE Standard 1003.1-2008) is made available. |
| 1754 | + |
| 1755 | Greater values for @code{_POSIX_C_SOURCE} will enable future extensions. |
| 1756 | The POSIX standards process will define these values as necessary, and |
| 1757 | @theglibc{} should support them some time after they become standardized. |
| 1758 | The 1996 edition of POSIX.1 (ISO/IEC 9945-1: 1996) states that |
| 1759 | if you define @code{_POSIX_C_SOURCE} to a value greater than |
| 1760 | or equal to @code{199506L}, then the functionality from the 1996 |
| 1761 | -edition is made available. |
| 1762 | +edition is made available. In general, in @theglibc{}, bugfixes to |
| 1763 | +the standards are included when specifying the base version; e.g., |
| 1764 | +POSIX.1-2004 will always be included with a value of @code{200112L}. |
| 1765 | @end defvr |
| 1766 | |
| 1767 | @defvr Macro _XOPEN_SOURCE |
| 1768 | @@ -87,7 +101,10 @@ available which are necessary for the X/Open Unix brand. |
| 1769 | |
| 1770 | If the macro @code{_XOPEN_SOURCE} has the value @math{500} this includes |
| 1771 | all functionality described so far plus some new definitions from the |
| 1772 | -Single Unix Specification, @w{version 2}. |
| 1773 | +Single Unix Specification, @w{version 2}. The value @math{600} |
| 1774 | +(corresponding to the sixth revision) includes definitions from SUSv3, |
| 1775 | +and using @math{700} (the seventh revision) includes definitions from |
| 1776 | +SUSv4. |
| 1777 | @end defvr |
| 1778 | |
| 1779 | @defvr Macro _LARGEFILE_SOURCE |
| 1780 | @@ -150,10 +167,14 @@ This macro was introduced as part of the Large File Support extension |
| 1781 | |
| 1782 | @defvr Macro _ISOC99_SOURCE |
| 1783 | @standards{GNU, (none)} |
| 1784 | -Until the revised @w{ISO C} standard is widely adopted the new features |
| 1785 | -are not automatically enabled. @Theglibc{} nevertheless has a complete |
| 1786 | -implementation of the new standard and to enable the new features the |
| 1787 | -macro @code{_ISOC99_SOURCE} should be defined. |
| 1788 | +If this macro is defined, features from ISO C99 are included. Since |
| 1789 | +these features are included by default, this macro is mostly relevant |
| 1790 | +when the compiler uses an earlier language version. |
| 1791 | +@end defvr |
| 1792 | + |
| 1793 | +@defvr Macro _ISOC11_SOURCE |
| 1794 | +@standards{C11, (none)} |
| 1795 | +If this macro is defined, ISO C11 extensions to ISO C99 are included. |
| 1796 | @end defvr |
| 1797 | |
| 1798 | @defvr Macro __STDC_WANT_LIB_EXT2__ |
| 1799 | @@ -209,6 +230,19 @@ enables those features even when the other options would otherwise |
| 1800 | cause them to be disabled. |
| 1801 | @end defvr |
| 1802 | |
| 1803 | +@defvr Macro _ATFILE_SOURCE |
| 1804 | +@standards{GNU, (none)} |
| 1805 | +If this macro is defined, additional @code{*at} interfaces are |
| 1806 | +included. |
| 1807 | +@end defvr |
| 1808 | + |
| 1809 | +@defvr Macro _FORTIFY_SOURCE |
| 1810 | +@standards{GNU, (none)} |
| 1811 | +If this macro is defined to @math{1}, security hardening is added to |
| 1812 | +various library functions. If defined to @math{2}, even stricter |
| 1813 | +checks are applied. |
| 1814 | +@end defvr |
| 1815 | + |
| 1816 | @defvr Macro _REENTRANT |
| 1817 | @defvrx Macro _THREAD_SAFE |
| 1818 | @standards{Obsolete, (none)} |
| 1819 | diff --git a/manual/examples/mbstouwcs.c b/manual/examples/mbstouwcs.c |
| 1820 | new file mode 100644 |
| 1821 | index 0000000000..c94e1fa790 |
| 1822 | --- /dev/null |
| 1823 | +++ b/manual/examples/mbstouwcs.c |
| 1824 | @@ -0,0 +1,53 @@ |
| 1825 | +#include <stdbool.h> |
| 1826 | +#include <stdlib.h> |
| 1827 | +#include <string.h> |
| 1828 | +#include <wchar.h> |
| 1829 | + |
| 1830 | +/* Do not include the above headers in the example. |
| 1831 | +*/ |
| 1832 | +wchar_t * |
| 1833 | +mbstouwcs (const char *s) |
| 1834 | +{ |
| 1835 | + /* Include the null terminator in the conversion. */ |
| 1836 | + size_t len = strlen (s) + 1; |
| 1837 | + wchar_t *result = reallocarray (NULL, len, sizeof (wchar_t)); |
| 1838 | + if (result == NULL) |
| 1839 | + return NULL; |
| 1840 | + |
| 1841 | + wchar_t *wcp = result; |
| 1842 | + mbstate_t state; |
| 1843 | + memset (&state, '\0', sizeof (state)); |
| 1844 | + |
| 1845 | + while (true) |
| 1846 | + { |
| 1847 | + wchar_t wc; |
| 1848 | + size_t nbytes = mbrtowc (&wc, s, len, &state); |
| 1849 | + if (nbytes == 0) |
| 1850 | + { |
| 1851 | + /* Terminate the result string. */ |
| 1852 | + *wcp = L'\0'; |
| 1853 | + break; |
| 1854 | + } |
| 1855 | + else if (nbytes == (size_t) -2) |
| 1856 | + { |
| 1857 | + /* Truncated input string. */ |
| 1858 | + errno = EILSEQ; |
| 1859 | + free (result); |
| 1860 | + return NULL; |
| 1861 | + } |
| 1862 | + else if (nbytes == (size_t) -1) |
| 1863 | + { |
| 1864 | + /* Some other error (including EILSEQ). */ |
| 1865 | + free (result); |
| 1866 | + return NULL; |
| 1867 | + } |
| 1868 | + else |
| 1869 | + { |
| 1870 | + /* A character was converted. */ |
| 1871 | + *wcp++ = towupper (wc); |
| 1872 | + len -= nbytes; |
| 1873 | + s += nbytes; |
| 1874 | + } |
| 1875 | + } |
| 1876 | + return result; |
| 1877 | +} |
| 1878 | diff --git a/manual/filesys.texi b/manual/filesys.texi |
| 1879 | index ca77996902..cc70a6b7ee 100644 |
| 1880 | --- a/manual/filesys.texi |
| 1881 | +++ b/manual/filesys.texi |
| 1882 | @@ -147,19 +147,20 @@ necessarily enough space to contain the directory name. That is why |
| 1883 | this function is deprecated. |
| 1884 | @end deftypefn |
| 1885 | |
| 1886 | +@vindex PWD |
| 1887 | @deftypefun {char *} get_current_dir_name (void) |
| 1888 | @standards{GNU, unistd.h} |
| 1889 | @safety{@prelim{}@mtsafe{@mtsenv{}}@asunsafe{@ascuheap{}}@acunsafe{@acsmem{} @acsfd{}}} |
| 1890 | @c Besides getcwd, which this function calls as a fallback, it calls |
| 1891 | @c getenv, with the potential thread-safety issues that brings about. |
| 1892 | -@vindex PWD |
| 1893 | -This @code{get_current_dir_name} function is basically equivalent to |
| 1894 | -@w{@code{getcwd (NULL, 0)}}. The only difference is that the value of |
| 1895 | -the @code{PWD} variable is returned if this value is correct. This is a |
| 1896 | -subtle difference which is visible if the path described by the |
| 1897 | -@code{PWD} value is using one or more symbol links in which case the |
| 1898 | -value returned by @code{getcwd} can resolve the symbol links and |
| 1899 | -therefore yield a different result. |
| 1900 | +The @code{get_current_dir_name} function is basically equivalent to |
| 1901 | +@w{@code{getcwd (NULL, 0)}}, except the value of the @env{PWD} |
| 1902 | +environment variable is first examined, and if it does in fact |
| 1903 | +correspond to the current directory, that value is returned. This is |
| 1904 | +a subtle difference which is visible if the path described by the |
| 1905 | +value in @env{PWD} is using one or more symbolic links, in which case |
| 1906 | +the value returned by @code{getcwd} would resolve the symbolic links |
| 1907 | +and therefore yield a different result. |
| 1908 | |
| 1909 | This function is a GNU extension. |
| 1910 | @end deftypefun |
| 1911 | diff --git a/manual/llio.texi b/manual/llio.texi |
| 1912 | index 642e56e710..7d877992d9 100644 |
| 1913 | --- a/manual/llio.texi |
| 1914 | +++ b/manual/llio.texi |
| 1915 | @@ -1271,6 +1271,9 @@ Per-IO synchronization as if the file was opened with @code{O_SYNC} flag. |
| 1916 | @item RWF_NOWAIT |
| 1917 | Use nonblocking mode for this operation; that is, this call to @code{preadv2} |
| 1918 | will fail and set @code{errno} to @code{EAGAIN} if the operation would block. |
| 1919 | + |
| 1920 | +@item RWF_APPEND |
| 1921 | +Per-IO synchronization as if the file was opened with @code{O_APPEND} flag. |
| 1922 | @end vtable |
| 1923 | |
| 1924 | When the source file is compiled with @code{_FILE_OFFSET_BITS == 64} the |
| 1925 | diff --git a/manual/platform.texi b/manual/platform.texi |
| 1926 | index b8721a0712..504addc956 100644 |
| 1927 | --- a/manual/platform.texi |
| 1928 | +++ b/manual/platform.texi |
| 1929 | @@ -123,7 +123,7 @@ when it is not allowed, the priority is set to medium. |
| 1930 | Cache management facilities specific to RISC-V systems that implement the Linux |
| 1931 | ABI are declared in @file{sys/cachectl.h}. |
| 1932 | |
| 1933 | -@deftypefun {void} __riscv_flush_icache(void *@var{start}, void *@var{end}, unsigned long int @var{flags}) |
| 1934 | +@deftypefun {void} __riscv_flush_icache (void *@var{start}, void *@var{end}, unsigned long int @var{flags}) |
| 1935 | @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}} |
| 1936 | Enforce ordering between stores and instruction cache fetches. The range of |
| 1937 | addresses over which ordering is enforced is specified by @var{start} and |
| 1938 | diff --git a/manual/stdio.texi b/manual/stdio.texi |
| 1939 | index 5d7b50c442..38be236991 100644 |
| 1940 | --- a/manual/stdio.texi |
| 1941 | +++ b/manual/stdio.texi |
| 1942 | @@ -1808,7 +1808,7 @@ verifies that the correct number and types of arguments are supplied. |
| 1943 | There is also a GNU C syntax to tell the compiler that a function you |
| 1944 | write uses a @code{printf}-style format string. |
| 1945 | @xref{Function Attributes, , Declaring Attributes of Functions, |
| 1946 | -gcc.info, Using GNU CC}, for more information. |
| 1947 | +gcc, Using GNU CC}, for more information. |
| 1948 | |
| 1949 | @node Table of Output Conversions |
| 1950 | @subsection Table of Output Conversions |
| 1951 | @@ -2730,7 +2730,7 @@ This tells the compiler that @code{eprintf} uses a format string like |
| 1952 | the format string appears as the first argument; |
| 1953 | and the arguments to satisfy the format begin with the second. |
| 1954 | @xref{Function Attributes, , Declaring Attributes of Functions, |
| 1955 | -gcc.info, Using GNU CC}, for more information. |
| 1956 | +gcc, Using GNU CC}, for more information. |
| 1957 | |
| 1958 | @node Parsing a Template String |
| 1959 | @subsection Parsing a Template String |
| 1960 | @@ -3478,7 +3478,7 @@ verifies that the correct number and types of arguments are supplied. |
| 1961 | There is also a GNU C syntax to tell the compiler that a function you |
| 1962 | write uses a @code{scanf}-style format string. |
| 1963 | @xref{Function Attributes, , Declaring Attributes of Functions, |
| 1964 | -gcc.info, Using GNU CC}, for more information. |
| 1965 | +gcc, Using GNU CC}, for more information. |
| 1966 | |
| 1967 | @node Table of Input Conversions |
| 1968 | @subsection Table of Input Conversions |
| 1969 | @@ -4033,7 +4033,7 @@ know that a function uses a @code{scanf}-style format string. Then it |
| 1970 | can check the number and types of arguments in each call to the |
| 1971 | function, and warn you when they do not match the format string. |
| 1972 | For details, see @ref{Function Attributes, , Declaring Attributes of Functions, |
| 1973 | -gcc.info, Using GNU CC}. |
| 1974 | +gcc, Using GNU CC}. |
| 1975 | |
| 1976 | @node EOF and Errors |
| 1977 | @section End-Of-File and Errors |
| 1978 | diff --git a/manual/string.texi b/manual/string.texi |
| 1979 | index ac02c6d85e..b07cfb4550 100644 |
| 1980 | --- a/manual/string.texi |
| 1981 | +++ b/manual/string.texi |
| 1982 | @@ -1087,7 +1087,7 @@ are often easier and safer automatic techniques that cause buffer |
| 1983 | overruns to reliably terminate a program, such as GCC's |
| 1984 | @option{-fcheck-pointer-bounds} and @option{-fsanitize=address} |
| 1985 | options. @xref{Debugging Options,, Options for Debugging Your Program |
| 1986 | -or GCC, gcc.info, Using GCC}. Because truncation functions can mask |
| 1987 | +or GCC, gcc, Using GCC}. Because truncation functions can mask |
| 1988 | application bugs that would otherwise be caught by the automatic |
| 1989 | techniques, these functions should be used only when the application's |
| 1990 | underlying logic requires truncation. |
| 1991 | diff --git a/math/math.h b/math/math.h |
| 1992 | index 3c515f817f..0fcbd91366 100644 |
| 1993 | --- a/math/math.h |
| 1994 | +++ b/math/math.h |
| 1995 | @@ -1223,7 +1223,7 @@ template<> struct __iseqsig_type<double> |
| 1996 | |
| 1997 | template<> struct __iseqsig_type<long double> |
| 1998 | { |
| 1999 | - static int __call (double __x, double __y) throw () |
| 2000 | + static int __call (long double __x, long double __y) throw () |
| 2001 | { |
| 2002 | # ifndef __NO_LONG_DOUBLE_MATH |
| 2003 | return __iseqsigl (__x, __y); |
| 2004 | diff --git a/misc/tst-preadvwritev2-common.c b/misc/tst-preadvwritev2-common.c |
| 2005 | index 89fd0a3ff5..f889a21544 100644 |
| 2006 | --- a/misc/tst-preadvwritev2-common.c |
| 2007 | +++ b/misc/tst-preadvwritev2-common.c |
| 2008 | @@ -34,7 +34,11 @@ do_test_with_invalid_flags (void) |
| 2009 | #ifndef RWF_NOWAIT |
| 2010 | # define RWF_NOWAIT 0 |
| 2011 | #endif |
| 2012 | -#define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT) |
| 2013 | +#ifndef RWF_APPEND |
| 2014 | +# define RWF_APPEND 0 |
| 2015 | +#endif |
| 2016 | +#define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT \ |
| 2017 | + | RWF_APPEND) |
| 2018 | /* Set the next bit from the mask of all supported flags. */ |
| 2019 | int invalid_flag = RWF_SUPPORTED != 0 ? __builtin_clz (RWF_SUPPORTED) : 2; |
| 2020 | invalid_flag = 0x1 << ((sizeof (int) * CHAR_BIT) - invalid_flag); |
| 2021 | diff --git a/nscd/gai.c b/nscd/gai.c |
| 2022 | index d081747797..576fd0045b 100644 |
| 2023 | --- a/nscd/gai.c |
| 2024 | +++ b/nscd/gai.c |
| 2025 | @@ -45,3 +45,6 @@ |
| 2026 | #ifdef HAVE_LIBIDN |
| 2027 | # include <libidn/idn-stub.c> |
| 2028 | #endif |
| 2029 | + |
| 2030 | +/* Some variables normally defined in libc. */ |
| 2031 | +service_user *__nss_hosts_database attribute_hidden; |
| 2032 | diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c |
| 2033 | index b832c9315f..2f187b208c 100644 |
| 2034 | --- a/nscd/netgroupcache.c |
| 2035 | +++ b/nscd/netgroupcache.c |
| 2036 | @@ -480,7 +480,7 @@ addinnetgrX (struct database_dyn *db, int fd, request_header *req, |
| 2037 | { |
| 2038 | const char *group = key; |
| 2039 | key = (char *) rawmemchr (key, '\0') + 1; |
| 2040 | - size_t group_len = key - group - 1; |
| 2041 | + size_t group_len = key - group; |
| 2042 | const char *host = *key++ ? key : NULL; |
| 2043 | if (host != NULL) |
| 2044 | key = (char *) rawmemchr (key, '\0') + 1; |
| 2045 | diff --git a/nss/nsswitch.c b/nss/nsswitch.c |
| 2046 | index d5e655974f..b0f0c11a3e 100644 |
| 2047 | --- a/nss/nsswitch.c |
| 2048 | +++ b/nss/nsswitch.c |
| 2049 | @@ -62,7 +62,7 @@ static service_library *nss_new_service (name_database *database, |
| 2050 | |
| 2051 | /* Declare external database variables. */ |
| 2052 | #define DEFINE_DATABASE(name) \ |
| 2053 | - extern service_user *__nss_##name##_database attribute_hidden; \ |
| 2054 | + service_user *__nss_##name##_database attribute_hidden; \ |
| 2055 | weak_extern (__nss_##name##_database) |
| 2056 | #include "databases.def" |
| 2057 | #undef DEFINE_DATABASE |
| 2058 | diff --git a/nss/nsswitch.h b/nss/nsswitch.h |
| 2059 | index eccb535ef5..63573b9ebc 100644 |
| 2060 | --- a/nss/nsswitch.h |
| 2061 | +++ b/nss/nsswitch.h |
| 2062 | @@ -226,10 +226,10 @@ libc_hidden_proto (__nss_hostname_digits_dots) |
| 2063 | #define MAX_NR_ADDRS 48 |
| 2064 | |
| 2065 | /* Prototypes for __nss_*_lookup2 functions. */ |
| 2066 | -#define DEFINE_DATABASE(arg) \ |
| 2067 | - service_user *__nss_##arg##_database attribute_hidden; \ |
| 2068 | - int __nss_##arg##_lookup2 (service_user **, const char *, \ |
| 2069 | - const char *, void **); \ |
| 2070 | +#define DEFINE_DATABASE(arg) \ |
| 2071 | + extern service_user *__nss_##arg##_database attribute_hidden; \ |
| 2072 | + int __nss_##arg##_lookup2 (service_user **, const char *, \ |
| 2073 | + const char *, void **); \ |
| 2074 | libc_hidden_proto (__nss_##arg##_lookup2) |
| 2075 | #include "databases.def" |
| 2076 | #undef DEFINE_DATABASE |
| 2077 | diff --git a/po/pt_BR.po b/po/pt_BR.po |
| 2078 | index b7c1650957..d49d6ec279 100644 |
| 2079 | --- a/po/pt_BR.po |
| 2080 | +++ b/po/pt_BR.po |
| 2081 | @@ -1,4283 +1,7213 @@ |
| 2082 | -# Brazilian portuguese messages for glibc. |
| 2083 |