Skip to content

Commit 37629c0

Browse files
authored
Update musl to v1.2.4 (#19812)
1 parent 8b5c868 commit 37629c0

File tree

171 files changed

+918
-425
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+918
-425
lines changed

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ See docs/process.md for more on how version tagging works.
2020

2121
3.1.44 (in development)
2222
-----------------------
23+
- musl libc updated from v1.2.3 to v1.2.4. (#19812)
2324
- The `EM_LOG_FUNC_PARAMS` flag to `emscripten_log`/`emscripten_get_callstack`
2425
has been deprecated and no longer has any effect. It was based on a
2526
long-deprecated JS API. (#19820)

src/generated_struct_info32.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,15 +302,12 @@
302302
"F_GETFD": 1,
303303
"F_GETFL": 3,
304304
"F_GETLK": 5,
305-
"F_GETLK64": 5,
306305
"F_GETOWN": 9,
307306
"F_GETOWN_EX": 16,
308307
"F_SETFD": 2,
309308
"F_SETFL": 4,
310309
"F_SETLK": 6,
311-
"F_SETLK64": 6,
312310
"F_SETLKW": 7,
313-
"F_SETLKW64": 7,
314311
"F_SETOWN": 8,
315312
"F_UNLCK": 2,
316313
"File::DataFileKind": 1,

src/generated_struct_info64.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,15 +302,12 @@
302302
"F_GETFD": 1,
303303
"F_GETFL": 3,
304304
"F_GETLK": 5,
305-
"F_GETLK64": 5,
306305
"F_GETOWN": 9,
307306
"F_GETOWN_EX": 16,
308307
"F_SETFD": 2,
309308
"F_SETFL": 4,
310309
"F_SETLK": 6,
311-
"F_SETLK64": 6,
312310
"F_SETLKW": 7,
313-
"F_SETLKW64": 7,
314311
"F_SETOWN": 8,
315312
"F_UNLCK": 2,
316313
"File::DataFileKind": 1,

src/library_syscall.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -766,9 +766,7 @@ var SyscallsLibrary = {
766766
stream.flags |= arg;
767767
return 0;
768768
}
769-
case {{{ cDefs.F_GETLK }}}:
770-
/* case {{{ cDefs.F_GETLK64 }}}: Currently in musl F_GETLK64 has same value as F_GETLK, so omitted to avoid duplicate case blocks. If that changes, uncomment this */ {
771-
{{{ assert(cDefs.F_GETLK === cDefs.F_GETLK64), '' }}}
769+
case {{{ cDefs.F_GETLK }}}: {
772770
var arg = SYSCALLS.get();
773771
var offset = {{{ C_STRUCTS.flock.l_type }}};
774772
// We're always unlocked.
@@ -777,10 +775,6 @@ var SyscallsLibrary = {
777775
}
778776
case {{{ cDefs.F_SETLK }}}:
779777
case {{{ cDefs.F_SETLKW }}}:
780-
/* case {{{ cDefs.F_SETLK64 }}}: Currently in musl F_SETLK64 has same value as F_SETLK, so omitted to avoid duplicate case blocks. If that changes, uncomment this */
781-
/* case {{{ cDefs.F_SETLKW64 }}}: Currently in musl F_SETLKW64 has same value as F_SETLKW, so omitted to avoid duplicate case blocks. If that changes, uncomment this */
782-
{{{ assert(cDefs.F_SETLK64 === cDefs.F_SETLK), '' }}}
783-
{{{ assert(cDefs.F_SETLKW64 === cDefs.F_SETLKW), '' }}}
784778
return 0; // Pretend that the locking is successful.
785779
case {{{ cDefs.F_GETOWN_EX }}}:
786780
case {{{ cDefs.F_SETOWN }}}:

src/struct_info.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,7 @@
8888
"F_UNLCK",
8989
"O_RDWR",
9090
"S_IRWXO",
91-
"F_GETLK64",
92-
"F_SETLKW64",
9391
"F_SETLKW",
94-
"F_SETLK64",
9592
"F_GETLK",
9693
"S_ISVTX",
9794
"O_RDONLY",

system/lib/libc/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
This folder contains the musl version of libc at `/musl`. The upstream version
22
can be found at http://www.musl-libc.org/.
33

4-
Most of the source comes from musl v1.2.2, with some exceptions listed below.
4+
Most of the source comes from musl v1.2.4, with some exceptions listed below.
55
We track these changes from upstream in https://github.com/emscripten-core/musl
66
and use a script (`system/lib/update_musl.py`) to pull in updates.
77

system/lib/libc/musl/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.3
1+
1.2.4

system/lib/libc/musl/WHATSNEW

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2327,3 +2327,72 @@ bugs fixed:
23272327
arch-specific bugs fixed:
23282328
- powerpc (32-bit) struct shmid_ds layout was wrong for some fields
23292329
- time64 struct layout was wrong in sound ioctl fallback (32-bit archs)
2330+
2331+
2332+
2333+
1.2.4 release notes
2334+
2335+
new features:
2336+
- large dns record lookups via tcp fallback
2337+
- new getaddrinfo EAI_NODATA result to distinguish NODATA/NxDomain
2338+
- support for new RELR compressed format for relative relocations
2339+
- sysconf keys for querying signal stack size requirements
2340+
- real vfork on riscv64
2341+
2342+
performance:
2343+
- mallocng no longer uses MADV_FREE (high performance cost, little gain)
2344+
- vdso clock_gettime is supported once again on 32-bit arm
2345+
2346+
compatibility:
2347+
- gethostbyname family now distinguishes NO_DATA from HOST_NOT_FOUND
2348+
- res_send now works with caller-provided edns0 queries
2349+
- arpa/nameser.h RR types list is now up-to-date
2350+
- previously-missing POSIX confstr keys have been added
2351+
- mntent interfaces now accept missing fields
2352+
- alt signal stack, if any, is now used for internal signals
2353+
- the LFS64 macros are no longer exposed without _LARGEFILE64_SOURCE
2354+
- memmem (POSIX-future) is now exposed in default feature profile
2355+
- pthread_atfork now admits calls from an application-provided malloc
2356+
- debugger tracking of shared libraries now works on MIPS PIE binaries
2357+
- sendmsg now supports up to SCM_MAX_FD fds in SCM_RIGHTS messages
2358+
2359+
bugs fixed:
2360+
- gethostbyname[2]_r wrongly returned nonzero (error) on negative result
2361+
- parallel v4/v6 address queries could fail on query id collisions
2362+
- spurious getaddrinfo/AI_ADDRCONFIG failures due to errno clobbering
2363+
- dns search domains ending in dot (including lone dot) broke lookups
2364+
- ipv6 servers in resolv.conf broke lookups on systems with v6 disabled
2365+
- systems with bindv6only failed to query both v4 and v6 nameservers
2366+
- res_mkquery mishandled consecutive final dots in name
2367+
- res_send could malfunction for very small answer buffer sizes
2368+
- resolver dns backend accepted answers with wrong (A vs AAAA) RR type
2369+
- getservbyport_r returned junk or ENOENT (vs ERANGE) on buffer size errors
2370+
- dns result parsing of malformed responses could process uninitialized data
2371+
- freopen didn't reset stream orientation (byte/wide) & encoding rule
2372+
- fwprintf didn't print most fields on open_wmemstream FILEs
2373+
- wide printf %lc ignored field width
2374+
- wide printf erroneously processed %n after encoding errors
2375+
- use of wide printf %9$ argument slot overflowed undersized buffer
2376+
- swprintf malfunctioned on nul character in output
2377+
- strverscmp ordered digit sequences vs nondigits incorrectly
2378+
- timer_create/SIGEV_THREAD failure leaked the thread
2379+
- semaphores were subject to missed-wake under certain usage patterns
2380+
- several possible rare deadlocks with lock handling at thread exit
2381+
- several possible rare deadlocks with aio and multithreaded fork
2382+
- dynamic linker relro processing was broken on archs w/variable pagesize
2383+
- async cancellation could run cancellation handlers in invalid context
2384+
- pthread_detach was wrongly a cancellation point in rare race code path
2385+
- use-after-close/double-close errors in mq_notify error paths
2386+
- mq_notify event thread wrongly ran with signals unmasked
2387+
- wcs{,n}cmp, wmemcmp returned wrong results when difference overflowed
2388+
- accept4, pipe2, and dup3 handled unknown flags wrong in fallback cases
2389+
- CPU_SETSIZE macro had wrong unit
2390+
- select fallback for pre-time64 kernels truncated timeout (vs clamping)
2391+
2392+
arch-specific bugs fixed:
2393+
- x32 new socketcalls took fallback path due to pointer sign extension
2394+
- x32 wait4 didn't fill rusage structure (time64 regression)
2395+
- x32 semtimedop mismatched timespec ABI with kernel (time64 regression)
2396+
- sigaction signal mask was bogus on or1k, microblaze, mips, and riscv
2397+
- powerpc-sf longjmp asm clobbered value argument
2398+
- or1k poll function passed timeout to syscall in wrong form

system/lib/libc/musl/configure

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,14 @@ tryflag CFLAGS_C99FSE -fexcess-precision=standard \
353353
|| { test "$ARCH" = i386 && tryflag CFLAGS_C99FSE -ffloat-store ; }
354354
tryflag CFLAGS_C99FSE -frounding-math
355355

356+
#
357+
# Semantically we want to insist that our sources follow the
358+
# C rules for type-based aliasing, but most if not all real-world
359+
# compilers are known or suspected to have critical bugs in their
360+
# type-based aliasing analysis. See for example GCC bug 107107.
361+
#
362+
tryflag CFLAGS_C99FSE -fno-strict-aliasing
363+
356364
#
357365
# We may use the may_alias attribute if __GNUC__ is defined, so
358366
# if the compiler defines __GNUC__ but does not provide it,
@@ -723,11 +731,6 @@ fi
723731
test "$SUBARCH" \
724732
&& printf "configured for %s variant: %s\n" "$ARCH" "$ARCH$SUBARCH"
725733

726-
case "$ARCH$SUBARCH" in
727-
arm) ASMSUBARCH=el ;;
728-
*) ASMSUBARCH=$SUBARCH ;;
729-
esac
730-
731734
#
732735
# Some archs (powerpc) have different possible long double formats
733736
# that the compiler can be configured for. The logic for whether this

system/lib/libc/musl/include/arpa/nameser.h

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,36 @@ typedef enum __ns_type {
188188
ns_t_sink = 40,
189189
ns_t_opt = 41,
190190
ns_t_apl = 42,
191+
ns_t_ds = 43,
192+
ns_t_sshfp = 44,
193+
ns_t_ipseckey = 45,
194+
ns_t_rrsig = 46,
195+
ns_t_nsec = 47,
196+
ns_t_dnskey = 48,
197+
ns_t_dhcid = 49,
198+
ns_t_nsec3 = 50,
199+
ns_t_nsec3param = 51,
200+
ns_t_tlsa = 52,
201+
ns_t_smimea = 53,
202+
ns_t_hip = 55,
203+
ns_t_ninfo = 56,
204+
ns_t_rkey = 57,
205+
ns_t_talink = 58,
206+
ns_t_cds = 59,
207+
ns_t_cdnskey = 60,
208+
ns_t_openpgpkey = 61,
209+
ns_t_csync = 62,
210+
ns_t_spf = 99,
211+
ns_t_uinfo = 100,
212+
ns_t_uid = 101,
213+
ns_t_gid = 102,
214+
ns_t_unspec = 103,
215+
ns_t_nid = 104,
216+
ns_t_l32 = 105,
217+
ns_t_l64 = 106,
218+
ns_t_lp = 107,
219+
ns_t_eui48 = 108,
220+
ns_t_eui64 = 109,
191221
ns_t_tkey = 249,
192222
ns_t_tsig = 250,
193223
ns_t_ixfr = 251,
@@ -196,6 +226,11 @@ typedef enum __ns_type {
196226
ns_t_maila = 254,
197227
ns_t_any = 255,
198228
ns_t_zxfr = 256,
229+
ns_t_uri = 256,
230+
ns_t_caa = 257,
231+
ns_t_avc = 258,
232+
ns_t_ta = 32768,
233+
ns_t_dlv = 32769,
199234
ns_t_max = 65536
200235
} ns_type;
201236

@@ -430,12 +465,48 @@ typedef struct {
430465
#define T_NAPTR ns_t_naptr
431466
#define T_A6 ns_t_a6
432467
#define T_DNAME ns_t_dname
468+
#define T_DS ns_t_ds
469+
#define T_SSHFP ns_t_sshfp
470+
#define T_IPSECKEY ns_t_ipseckey
471+
#define T_RRSIG ns_t_rrsig
472+
#define T_NSEC ns_t_nsec
473+
#define T_DNSKEY ns_t_dnskey
474+
#define T_DHCID ns_t_dhcid
475+
#define T_NSEC3 ns_t_nsec3
476+
#define T_NSEC3PARAM ns_t_nsec3param
477+
#define T_TLSA ns_t_tlsa
478+
#define T_SMIMEA ns_t_smimea
479+
#define T_HIP ns_t_hip
480+
#define T_NINFO ns_t_ninfo
481+
#define T_RKEY ns_t_rkey
482+
#define T_TALINK ns_t_talink
483+
#define T_CDS ns_t_cds
484+
#define T_CDNSKEY ns_t_cdnskey
485+
#define T_OPENPGPKEY ns_t_openpgpkey
486+
#define T_CSYNC ns_t_csync
487+
#define T_SPF ns_t_spf
488+
#define T_UINFO ns_t_uinfo
489+
#define T_UID ns_t_uid
490+
#define T_GID ns_t_gid
491+
#define T_UNSPEC ns_t_unspec
492+
#define T_NID ns_t_nid
493+
#define T_L32 ns_t_l32
494+
#define T_L64 ns_t_l64
495+
#define T_LP ns_t_lp
496+
#define T_EUI48 ns_t_eui48
497+
#define T_EUI64 ns_t_eui64
498+
#define T_TKEY ns_t_tkey
433499
#define T_TSIG ns_t_tsig
434500
#define T_IXFR ns_t_ixfr
435501
#define T_AXFR ns_t_axfr
436502
#define T_MAILB ns_t_mailb
437503
#define T_MAILA ns_t_maila
438504
#define T_ANY ns_t_any
505+
#define T_URI ns_t_uri
506+
#define T_CAA ns_t_caa
507+
#define T_AVC ns_t_avc
508+
#define T_TA ns_t_ta
509+
#define T_DLV ns_t_dlv
439510

440511
#define C_IN ns_c_in
441512
#define C_CHAOS ns_c_chaos

system/lib/libc/musl/include/dirent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ int getdents(int, struct dirent *, size_t);
5656
int versionsort(const struct dirent **, const struct dirent **);
5757
#endif
5858

59-
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
59+
#if defined(_LARGEFILE64_SOURCE)
6060
#define dirent64 dirent
6161
#define readdir64 readdir
6262
#define readdir64_r readdir_r

system/lib/libc/musl/include/elf.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,8 @@ typedef struct {
385385
#define SHT_PREINIT_ARRAY 16
386386
#define SHT_GROUP 17
387387
#define SHT_SYMTAB_SHNDX 18
388-
#define SHT_NUM 19
388+
#define SHT_RELR 19
389+
#define SHT_NUM 20
389390
#define SHT_LOOS 0x60000000
390391
#define SHT_GNU_ATTRIBUTES 0x6ffffff5
391392
#define SHT_GNU_HASH 0x6ffffff6
@@ -436,6 +437,7 @@ typedef struct {
436437
} Elf64_Chdr;
437438

438439
#define ELFCOMPRESS_ZLIB 1
440+
#define ELFCOMPRESS_ZSTD 2
439441
#define ELFCOMPRESS_LOOS 0x60000000
440442
#define ELFCOMPRESS_HIOS 0x6fffffff
441443
#define ELFCOMPRESS_LOPROC 0x70000000
@@ -754,7 +756,10 @@ typedef struct {
754756
#define DT_PREINIT_ARRAY 32
755757
#define DT_PREINIT_ARRAYSZ 33
756758
#define DT_SYMTAB_SHNDX 34
757-
#define DT_NUM 35
759+
#define DT_RELRSZ 35
760+
#define DT_RELR 36
761+
#define DT_RELRENT 37
762+
#define DT_NUM 38
758763
#define DT_LOOS 0x6000000d
759764
#define DT_HIOS 0x6ffff000
760765
#define DT_LOPROC 0x70000000

system/lib/libc/musl/include/fcntl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ ssize_t tee(int, int, size_t, unsigned);
205205
#define loff_t off_t
206206
#endif
207207

208-
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
208+
#if defined(_LARGEFILE64_SOURCE)
209209
#define F_GETLK64 F_GETLK
210210
#define F_SETLK64 F_SETLK
211211
#define F_SETLKW64 F_SETLKW

system/lib/libc/musl/include/ftw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct FTW {
2929
int ftw(const char *, int (*)(const char *, const struct stat *, int), int);
3030
int nftw(const char *, int (*)(const char *, const struct stat *, int, struct FTW *), int, int);
3131

32-
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
32+
#if defined(_LARGEFILE64_SOURCE)
3333
#define ftw64 ftw
3434
#define nftw64 nftw
3535
#endif

system/lib/libc/musl/include/glob.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void globfree(glob_t *);
3939
#define GLOB_NOMATCH 3
4040
#define GLOB_NOSYS 4
4141

42-
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
42+
#if defined(_LARGEFILE64_SOURCE)
4343
#define glob64 glob
4444
#define globfree64 globfree
4545
#define glob64_t glob_t

system/lib/libc/musl/include/netdb.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ struct addrinfo {
4444
#define EAI_NONAME -2
4545
#define EAI_AGAIN -3
4646
#define EAI_FAIL -4
47+
#define EAI_NODATA -5
4748
#define EAI_FAMILY -6
4849
#define EAI_SOCKTYPE -7
4950
#define EAI_SERVICE -8

system/lib/libc/musl/include/sched.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ __CPU_op_func_S(XOR, ^)
124124
#define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
125125
#define CPU_FREE(set) free(set)
126126

127-
#define CPU_SETSIZE 128
127+
#define CPU_SETSIZE 1024
128128

129129
#define CPU_SET(i, set) CPU_SET_S(i,sizeof(cpu_set_t),set)
130130
#define CPU_CLR(i, set) CPU_CLR_S(i,sizeof(cpu_set_t),set)

system/lib/libc/musl/include/stdio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ typedef struct _IO_cookie_io_functions_t {
215215
FILE *fopencookie(void *, const char *, cookie_io_functions_t);
216216
#endif
217217

218-
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
218+
#if defined(_LARGEFILE64_SOURCE)
219219
#define tmpfile64 tmpfile
220220
#define fopen64 fopen
221221
#define freopen64 freopen

system/lib/libc/musl/include/stdlib.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ size_t __ctype_get_mb_cur_max(void);
9595
#define WTERMSIG(s) ((s) & 0x7f)
9696
#define WSTOPSIG(s) WEXITSTATUS(s)
9797
#define WIFEXITED(s) (!WTERMSIG(s))
98-
#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00)
98+
#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001U)>>8) > 0x7f00)
9999
#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
100100

101101
int posix_memalign (void **, size_t, size_t);
@@ -163,7 +163,7 @@ double strtod_l(const char *__restrict, char **__restrict, struct __locale_struc
163163
long double strtold_l(const char *__restrict, char **__restrict, struct __locale_struct *);
164164
#endif
165165

166-
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
166+
#if defined(_LARGEFILE64_SOURCE)
167167
#define mkstemp64 mkstemp
168168
#define mkostemp64 mkostemp
169169
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)

0 commit comments

Comments
 (0)