Skip to content

Update musl to v1.2.4 #19812

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ See docs/process.md for more on how version tagging works.

3.1.44 (in development)
-----------------------
- musl libc updated from v1.2.3 to v1.2.4. (#19812)
- The `EM_LOG_FUNC_PARAMS` flag to `emscripten_log`/`emscripten_get_callstack`
has been deprecated and no longer has any effect. It was based on a
long-deprecated JS API. (#19820)
Expand Down
3 changes: 0 additions & 3 deletions src/generated_struct_info32.json
Original file line number Diff line number Diff line change
Expand Up @@ -302,15 +302,12 @@
"F_GETFD": 1,
"F_GETFL": 3,
"F_GETLK": 5,
"F_GETLK64": 5,
"F_GETOWN": 9,
"F_GETOWN_EX": 16,
"F_SETFD": 2,
"F_SETFL": 4,
"F_SETLK": 6,
"F_SETLK64": 6,
"F_SETLKW": 7,
"F_SETLKW64": 7,
"F_SETOWN": 8,
"F_UNLCK": 2,
"File::DataFileKind": 1,
Expand Down
3 changes: 0 additions & 3 deletions src/generated_struct_info64.json
Original file line number Diff line number Diff line change
Expand Up @@ -302,15 +302,12 @@
"F_GETFD": 1,
"F_GETFL": 3,
"F_GETLK": 5,
"F_GETLK64": 5,
"F_GETOWN": 9,
"F_GETOWN_EX": 16,
"F_SETFD": 2,
"F_SETFL": 4,
"F_SETLK": 6,
"F_SETLK64": 6,
"F_SETLKW": 7,
"F_SETLKW64": 7,
"F_SETOWN": 8,
"F_UNLCK": 2,
"File::DataFileKind": 1,
Expand Down
8 changes: 1 addition & 7 deletions src/library_syscall.js
Original file line number Diff line number Diff line change
Expand Up @@ -766,9 +766,7 @@ var SyscallsLibrary = {
stream.flags |= arg;
return 0;
}
case {{{ cDefs.F_GETLK }}}:
/* 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 */ {
{{{ assert(cDefs.F_GETLK === cDefs.F_GETLK64), '' }}}
case {{{ cDefs.F_GETLK }}}: {
var arg = SYSCALLS.get();
var offset = {{{ C_STRUCTS.flock.l_type }}};
// We're always unlocked.
Expand All @@ -777,10 +775,6 @@ var SyscallsLibrary = {
}
case {{{ cDefs.F_SETLK }}}:
case {{{ cDefs.F_SETLKW }}}:
/* 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 */
/* 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 */
{{{ assert(cDefs.F_SETLK64 === cDefs.F_SETLK), '' }}}
{{{ assert(cDefs.F_SETLKW64 === cDefs.F_SETLKW), '' }}}
return 0; // Pretend that the locking is successful.
case {{{ cDefs.F_GETOWN_EX }}}:
case {{{ cDefs.F_SETOWN }}}:
Expand Down
3 changes: 0 additions & 3 deletions src/struct_info.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,7 @@
"F_UNLCK",
"O_RDWR",
"S_IRWXO",
"F_GETLK64",
"F_SETLKW64",
"F_SETLKW",
"F_SETLK64",
"F_GETLK",
"S_ISVTX",
"O_RDONLY",
Expand Down
2 changes: 1 addition & 1 deletion system/lib/libc/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
This folder contains the musl version of libc at `/musl`. The upstream version
can be found at http://www.musl-libc.org/.

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

Expand Down
2 changes: 1 addition & 1 deletion system/lib/libc/musl/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.3
1.2.4
69 changes: 69 additions & 0 deletions system/lib/libc/musl/WHATSNEW
Original file line number Diff line number Diff line change
Expand Up @@ -2327,3 +2327,72 @@ bugs fixed:
arch-specific bugs fixed:
- powerpc (32-bit) struct shmid_ds layout was wrong for some fields
- time64 struct layout was wrong in sound ioctl fallback (32-bit archs)



1.2.4 release notes

new features:
- large dns record lookups via tcp fallback
- new getaddrinfo EAI_NODATA result to distinguish NODATA/NxDomain
- support for new RELR compressed format for relative relocations
- sysconf keys for querying signal stack size requirements
- real vfork on riscv64

performance:
- mallocng no longer uses MADV_FREE (high performance cost, little gain)
- vdso clock_gettime is supported once again on 32-bit arm

compatibility:
- gethostbyname family now distinguishes NO_DATA from HOST_NOT_FOUND
- res_send now works with caller-provided edns0 queries
- arpa/nameser.h RR types list is now up-to-date
- previously-missing POSIX confstr keys have been added
- mntent interfaces now accept missing fields
- alt signal stack, if any, is now used for internal signals
- the LFS64 macros are no longer exposed without _LARGEFILE64_SOURCE
- memmem (POSIX-future) is now exposed in default feature profile
- pthread_atfork now admits calls from an application-provided malloc
- debugger tracking of shared libraries now works on MIPS PIE binaries
- sendmsg now supports up to SCM_MAX_FD fds in SCM_RIGHTS messages

bugs fixed:
- gethostbyname[2]_r wrongly returned nonzero (error) on negative result
- parallel v4/v6 address queries could fail on query id collisions
- spurious getaddrinfo/AI_ADDRCONFIG failures due to errno clobbering
- dns search domains ending in dot (including lone dot) broke lookups
- ipv6 servers in resolv.conf broke lookups on systems with v6 disabled
- systems with bindv6only failed to query both v4 and v6 nameservers
- res_mkquery mishandled consecutive final dots in name
- res_send could malfunction for very small answer buffer sizes
- resolver dns backend accepted answers with wrong (A vs AAAA) RR type
- getservbyport_r returned junk or ENOENT (vs ERANGE) on buffer size errors
- dns result parsing of malformed responses could process uninitialized data
- freopen didn't reset stream orientation (byte/wide) & encoding rule
- fwprintf didn't print most fields on open_wmemstream FILEs
- wide printf %lc ignored field width
- wide printf erroneously processed %n after encoding errors
- use of wide printf %9$ argument slot overflowed undersized buffer
- swprintf malfunctioned on nul character in output
- strverscmp ordered digit sequences vs nondigits incorrectly
- timer_create/SIGEV_THREAD failure leaked the thread
- semaphores were subject to missed-wake under certain usage patterns
- several possible rare deadlocks with lock handling at thread exit
- several possible rare deadlocks with aio and multithreaded fork
- dynamic linker relro processing was broken on archs w/variable pagesize
- async cancellation could run cancellation handlers in invalid context
- pthread_detach was wrongly a cancellation point in rare race code path
- use-after-close/double-close errors in mq_notify error paths
- mq_notify event thread wrongly ran with signals unmasked
- wcs{,n}cmp, wmemcmp returned wrong results when difference overflowed
- accept4, pipe2, and dup3 handled unknown flags wrong in fallback cases
- CPU_SETSIZE macro had wrong unit
- select fallback for pre-time64 kernels truncated timeout (vs clamping)

arch-specific bugs fixed:
- x32 new socketcalls took fallback path due to pointer sign extension
- x32 wait4 didn't fill rusage structure (time64 regression)
- x32 semtimedop mismatched timespec ABI with kernel (time64 regression)
- sigaction signal mask was bogus on or1k, microblaze, mips, and riscv
- powerpc-sf longjmp asm clobbered value argument
- or1k poll function passed timeout to syscall in wrong form
13 changes: 8 additions & 5 deletions system/lib/libc/musl/configure
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,14 @@ tryflag CFLAGS_C99FSE -fexcess-precision=standard \
|| { test "$ARCH" = i386 && tryflag CFLAGS_C99FSE -ffloat-store ; }
tryflag CFLAGS_C99FSE -frounding-math

#
# Semantically we want to insist that our sources follow the
# C rules for type-based aliasing, but most if not all real-world
# compilers are known or suspected to have critical bugs in their
# type-based aliasing analysis. See for example GCC bug 107107.
#
tryflag CFLAGS_C99FSE -fno-strict-aliasing

#
# We may use the may_alias attribute if __GNUC__ is defined, so
# if the compiler defines __GNUC__ but does not provide it,
Expand Down Expand Up @@ -723,11 +731,6 @@ fi
test "$SUBARCH" \
&& printf "configured for %s variant: %s\n" "$ARCH" "$ARCH$SUBARCH"

case "$ARCH$SUBARCH" in
arm) ASMSUBARCH=el ;;
*) ASMSUBARCH=$SUBARCH ;;
esac

#
# Some archs (powerpc) have different possible long double formats
# that the compiler can be configured for. The logic for whether this
Expand Down
71 changes: 71 additions & 0 deletions system/lib/libc/musl/include/arpa/nameser.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,36 @@ typedef enum __ns_type {
ns_t_sink = 40,
ns_t_opt = 41,
ns_t_apl = 42,
ns_t_ds = 43,
ns_t_sshfp = 44,
ns_t_ipseckey = 45,
ns_t_rrsig = 46,
ns_t_nsec = 47,
ns_t_dnskey = 48,
ns_t_dhcid = 49,
ns_t_nsec3 = 50,
ns_t_nsec3param = 51,
ns_t_tlsa = 52,
ns_t_smimea = 53,
ns_t_hip = 55,
ns_t_ninfo = 56,
ns_t_rkey = 57,
ns_t_talink = 58,
ns_t_cds = 59,
ns_t_cdnskey = 60,
ns_t_openpgpkey = 61,
ns_t_csync = 62,
ns_t_spf = 99,
ns_t_uinfo = 100,
ns_t_uid = 101,
ns_t_gid = 102,
ns_t_unspec = 103,
ns_t_nid = 104,
ns_t_l32 = 105,
ns_t_l64 = 106,
ns_t_lp = 107,
ns_t_eui48 = 108,
ns_t_eui64 = 109,
ns_t_tkey = 249,
ns_t_tsig = 250,
ns_t_ixfr = 251,
Expand All @@ -196,6 +226,11 @@ typedef enum __ns_type {
ns_t_maila = 254,
ns_t_any = 255,
ns_t_zxfr = 256,
ns_t_uri = 256,
ns_t_caa = 257,
ns_t_avc = 258,
ns_t_ta = 32768,
ns_t_dlv = 32769,
ns_t_max = 65536
} ns_type;

Expand Down Expand Up @@ -430,12 +465,48 @@ typedef struct {
#define T_NAPTR ns_t_naptr
#define T_A6 ns_t_a6
#define T_DNAME ns_t_dname
#define T_DS ns_t_ds
#define T_SSHFP ns_t_sshfp
#define T_IPSECKEY ns_t_ipseckey
#define T_RRSIG ns_t_rrsig
#define T_NSEC ns_t_nsec
#define T_DNSKEY ns_t_dnskey
#define T_DHCID ns_t_dhcid
#define T_NSEC3 ns_t_nsec3
#define T_NSEC3PARAM ns_t_nsec3param
#define T_TLSA ns_t_tlsa
#define T_SMIMEA ns_t_smimea
#define T_HIP ns_t_hip
#define T_NINFO ns_t_ninfo
#define T_RKEY ns_t_rkey
#define T_TALINK ns_t_talink
#define T_CDS ns_t_cds
#define T_CDNSKEY ns_t_cdnskey
#define T_OPENPGPKEY ns_t_openpgpkey
#define T_CSYNC ns_t_csync
#define T_SPF ns_t_spf
#define T_UINFO ns_t_uinfo
#define T_UID ns_t_uid
#define T_GID ns_t_gid
#define T_UNSPEC ns_t_unspec
#define T_NID ns_t_nid
#define T_L32 ns_t_l32
#define T_L64 ns_t_l64
#define T_LP ns_t_lp
#define T_EUI48 ns_t_eui48
#define T_EUI64 ns_t_eui64
#define T_TKEY ns_t_tkey
#define T_TSIG ns_t_tsig
#define T_IXFR ns_t_ixfr
#define T_AXFR ns_t_axfr
#define T_MAILB ns_t_mailb
#define T_MAILA ns_t_maila
#define T_ANY ns_t_any
#define T_URI ns_t_uri
#define T_CAA ns_t_caa
#define T_AVC ns_t_avc
#define T_TA ns_t_ta
#define T_DLV ns_t_dlv

#define C_IN ns_c_in
#define C_CHAOS ns_c_chaos
Expand Down
2 changes: 1 addition & 1 deletion system/lib/libc/musl/include/dirent.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int getdents(int, struct dirent *, size_t);
int versionsort(const struct dirent **, const struct dirent **);
#endif

#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
#if defined(_LARGEFILE64_SOURCE)
#define dirent64 dirent
#define readdir64 readdir
#define readdir64_r readdir_r
Expand Down
9 changes: 7 additions & 2 deletions system/lib/libc/musl/include/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,8 @@ typedef struct {
#define SHT_PREINIT_ARRAY 16
#define SHT_GROUP 17
#define SHT_SYMTAB_SHNDX 18
#define SHT_NUM 19
#define SHT_RELR 19
#define SHT_NUM 20
#define SHT_LOOS 0x60000000
#define SHT_GNU_ATTRIBUTES 0x6ffffff5
#define SHT_GNU_HASH 0x6ffffff6
Expand Down Expand Up @@ -436,6 +437,7 @@ typedef struct {
} Elf64_Chdr;

#define ELFCOMPRESS_ZLIB 1
#define ELFCOMPRESS_ZSTD 2
#define ELFCOMPRESS_LOOS 0x60000000
#define ELFCOMPRESS_HIOS 0x6fffffff
#define ELFCOMPRESS_LOPROC 0x70000000
Expand Down Expand Up @@ -754,7 +756,10 @@ typedef struct {
#define DT_PREINIT_ARRAY 32
#define DT_PREINIT_ARRAYSZ 33
#define DT_SYMTAB_SHNDX 34
#define DT_NUM 35
#define DT_RELRSZ 35
#define DT_RELR 36
#define DT_RELRENT 37
#define DT_NUM 38
#define DT_LOOS 0x6000000d
#define DT_HIOS 0x6ffff000
#define DT_LOPROC 0x70000000
Expand Down
2 changes: 1 addition & 1 deletion system/lib/libc/musl/include/fcntl.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ ssize_t tee(int, int, size_t, unsigned);
#define loff_t off_t
#endif

#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
#if defined(_LARGEFILE64_SOURCE)
#define F_GETLK64 F_GETLK
#define F_SETLK64 F_SETLK
#define F_SETLKW64 F_SETLKW
Expand Down
2 changes: 1 addition & 1 deletion system/lib/libc/musl/include/ftw.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct FTW {
int ftw(const char *, int (*)(const char *, const struct stat *, int), int);
int nftw(const char *, int (*)(const char *, const struct stat *, int, struct FTW *), int, int);

#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
#if defined(_LARGEFILE64_SOURCE)
#define ftw64 ftw
#define nftw64 nftw
#endif
Expand Down
2 changes: 1 addition & 1 deletion system/lib/libc/musl/include/glob.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void globfree(glob_t *);
#define GLOB_NOMATCH 3
#define GLOB_NOSYS 4

#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
#if defined(_LARGEFILE64_SOURCE)
#define glob64 glob
#define globfree64 globfree
#define glob64_t glob_t
Expand Down
1 change: 1 addition & 0 deletions system/lib/libc/musl/include/netdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ struct addrinfo {
#define EAI_NONAME -2
#define EAI_AGAIN -3
#define EAI_FAIL -4
#define EAI_NODATA -5
#define EAI_FAMILY -6
#define EAI_SOCKTYPE -7
#define EAI_SERVICE -8
Expand Down
2 changes: 1 addition & 1 deletion system/lib/libc/musl/include/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ __CPU_op_func_S(XOR, ^)
#define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
#define CPU_FREE(set) free(set)

#define CPU_SETSIZE 128
#define CPU_SETSIZE 1024

#define CPU_SET(i, set) CPU_SET_S(i,sizeof(cpu_set_t),set)
#define CPU_CLR(i, set) CPU_CLR_S(i,sizeof(cpu_set_t),set)
Expand Down
2 changes: 1 addition & 1 deletion system/lib/libc/musl/include/stdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ typedef struct _IO_cookie_io_functions_t {
FILE *fopencookie(void *, const char *, cookie_io_functions_t);
#endif

#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
#if defined(_LARGEFILE64_SOURCE)
#define tmpfile64 tmpfile
#define fopen64 fopen
#define freopen64 freopen
Expand Down
4 changes: 2 additions & 2 deletions system/lib/libc/musl/include/stdlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ size_t __ctype_get_mb_cur_max(void);
#define WTERMSIG(s) ((s) & 0x7f)
#define WSTOPSIG(s) WEXITSTATUS(s)
#define WIFEXITED(s) (!WTERMSIG(s))
#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00)
#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001U)>>8) > 0x7f00)
#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)

int posix_memalign (void **, size_t, size_t);
Expand Down Expand Up @@ -163,7 +163,7 @@ double strtod_l(const char *__restrict, char **__restrict, struct __locale_struc
long double strtold_l(const char *__restrict, char **__restrict, struct __locale_struct *);
#endif

#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
#if defined(_LARGEFILE64_SOURCE)
#define mkstemp64 mkstemp
#define mkostemp64 mkostemp
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
Expand Down
Loading