Skip to content
Open
Show file tree
Hide file tree
Changes from 15 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 @@ -31,6 +31,7 @@ See docs/process.md for more on how version tagging works.
in emscripten. If you still need to support extremely old browsers, you can
manually transpile the output of emscripten (e.g. using babel for JS and
binaryen for wasm). (#26677)
- musl libc updated from v1.2.5 to v1.2.6. (#26860)

5.0.7 - 04/30/26
----------------
Expand Down
2 changes: 1 addition & 1 deletion src/lib/libsyscall.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ var SyscallsLibrary = {
{{{ makeSetValue('buf', C_STRUCTS.stat.st_size, 'stat.size', 'i64') }}};
{{{ makeSetValue('buf', C_STRUCTS.stat.st_blksize, '4096', 'i32') }}};
{{{ makeSetValue('buf', C_STRUCTS.stat.st_blocks, 'stat.blocks', 'i32') }}};
{{{ makeSetValue('buf', C_STRUCTS.stat.st_ino, 'stat.ino', 'i64') }}};
var atime = stat.atime.getTime();
var mtime = stat.mtime.getTime();
var ctime = stat.ctime.getTime();
Expand All @@ -57,7 +58,6 @@ var SyscallsLibrary = {
{{{ makeSetValue('buf', C_STRUCTS.stat.st_mtim.tv_nsec, '(mtime % 1000) * 1000 * 1000', SIZE_TYPE) }}};
{{{ makeSetValue('buf', C_STRUCTS.stat.st_ctim.tv_sec, 'Math.floor(ctime / 1000)', 'i64') }}};
{{{ makeSetValue('buf', C_STRUCTS.stat.st_ctim.tv_nsec, '(ctime % 1000) * 1000 * 1000', SIZE_TYPE) }}};
{{{ makeSetValue('buf', C_STRUCTS.stat.st_ino, 'stat.ino', 'i64') }}};
return 0;
},
writeStatFs(buf, stats) {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/libwasmfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,10 @@ addToLibrary({
size: {{{ makeGetValue('statBuf', C_STRUCTS.stat.st_size, "i53") }}},
blksize: {{{ makeGetValue('statBuf', C_STRUCTS.stat.st_blksize, "i32") }}},
blocks: {{{ makeGetValue('statBuf', C_STRUCTS.stat.st_blocks, "i32") }}},
ino: {{{ makeGetValue('statBuf', C_STRUCTS.stat.st_ino, "u53") }}},
atime: {{{ makeGetValue('statBuf', C_STRUCTS.stat.st_atim.tv_sec, "i53") }}},
mtime: {{{ makeGetValue('statBuf', C_STRUCTS.stat.st_mtim.tv_sec, "i53") }}},
ctime: {{{ makeGetValue('statBuf', C_STRUCTS.stat.st_ctim.tv_sec, "i53") }}},
ino: {{{ makeGetValue('statBuf', C_STRUCTS.stat.st_ino, "u53") }}}
ctime: {{{ makeGetValue('statBuf', C_STRUCTS.stat.st_ctim.tv_sec, "i53") }}}
}
},
stat(path) {
Expand Down
14 changes: 7 additions & 7 deletions src/struct_info_generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -1077,24 +1077,24 @@
"__size__": 96,
"st_atim": {
"__size__": 16,
"tv_nsec": 48,
"tv_sec": 40
"tv_nsec": 56,
"tv_sec": 48
},
"st_blksize": 32,
"st_blocks": 36,
"st_ctim": {
"__size__": 16,
"tv_nsec": 80,
"tv_sec": 72
"tv_nsec": 88,
"tv_sec": 80
},
"st_dev": 0,
"st_gid": 16,
"st_ino": 88,
"st_ino": 40,
"st_mode": 4,
"st_mtim": {
"__size__": 16,
"tv_nsec": 64,
"tv_sec": 56
"tv_nsec": 72,
"tv_sec": 64
},
"st_nlink": 8,
"st_rdev": 20,
Expand Down
14 changes: 7 additions & 7 deletions src/struct_info_generated_wasm64.json
Original file line number Diff line number Diff line change
Expand Up @@ -1077,24 +1077,24 @@
"__size__": 104,
"st_atim": {
"__size__": 16,
"tv_nsec": 56,
"tv_sec": 48
"tv_nsec": 64,
"tv_sec": 56
},
"st_blksize": 40,
"st_blocks": 44,
"st_ctim": {
"__size__": 16,
"tv_nsec": 88,
"tv_sec": 80
"tv_nsec": 96,
"tv_sec": 88
},
"st_dev": 0,
"st_gid": 20,
"st_ino": 96,
"st_ino": 48,
"st_mode": 4,
"st_mtim": {
"__size__": 16,
"tv_nsec": 72,
"tv_sec": 64
"tv_nsec": 80,
"tv_sec": 72
},
"st_nlink": 8,
"st_rdev": 24,
Expand Down
5 changes: 2 additions & 3 deletions system/lib/libc/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
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.5, with some exceptions listed below.
Most of the source comes from musl v1.2.6, 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.

Some changes have been made to the version that was taken from upstream, including:

* Emscripten-specific changes (from before this readme existed). These should be marked with `XXX EMSCRIPTEN` in the source, or ifdefed with `#if __EMSCRIPTEN__`. They are mostly in pthreads code and hopefully temporary.
* Backporting an operator-precedence warning fix from 6e76e1540fc58a418494bf5eb832b556f9c5763e in the upstream version.
* Emscripten-specific changes (from before this readme existed). These should be marked with `XXX EMSCRIPTEN` in the source, or ifdefed with `#ifdef __EMSCRIPTEN__`. They are mostly in pthreads code and hopefully temporary.
* Switch to using the wasi `fd_write` syscall instead of `writev`.
* Simplify stdout stream handling: do not support seeking, terminal handling, etc., as it just increases code size and Emscripten doesn't have those features anyhow.
* Setting `_POSIX_REALTIME_SIGNALS` and `_POSIX_SPAWN` macros to -1, to exclude unsupported functions.
Expand Down
4 changes: 2 additions & 2 deletions system/lib/libc/musl/COPYRIGHT
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Kylie McClain
Leah Neukirchen
Luca Barbato
Luka Perkov
Lynn Ochs
M Farkas-Dyck (Strake)
Mahesh Bodapati
Markus Wichmann
Expand Down Expand Up @@ -103,7 +104,6 @@ Stefan O'Rear
Szabolcs Nagy
Timo Teräs
Trutz Behn
Valentin Ochs
Will Dietz
William Haddon
William Pitcock
Expand Down Expand Up @@ -143,7 +143,7 @@ domain. The code also comes with a fallback permissive license for use
in jurisdictions that may not recognize the public domain.

The smoothsort implementation (src/stdlib/qsort.c) is Copyright © 2011
Valentin Ochs and is licensed under an MIT-style license.
Lynn Ochs and is licensed under an MIT-style license.

The x86_64 port was written by Nicholas J. Kain and is licensed under
the standard MIT terms.
Expand Down
2 changes: 1 addition & 1 deletion system/lib/libc/musl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ obj/src/internal/version.o obj/src/internal/version.lo: obj/src/internal/version

obj/crt/rcrt1.o obj/ldso/dlstart.lo obj/ldso/dynlink.lo: $(srcdir)/src/internal/dynlink.h $(srcdir)/arch/$(ARCH)/reloc.h

obj/crt/crt1.o obj/crt/scrt1.o obj/crt/rcrt1.o obj/ldso/dlstart.lo: $(srcdir)/arch/$(ARCH)/crt_arch.h
obj/crt/crt1.o obj/crt/Scrt1.o obj/crt/rcrt1.o obj/ldso/dlstart.lo: $(srcdir)/arch/$(ARCH)/crt_arch.h

obj/crt/rcrt1.o: $(srcdir)/ldso/dlstart.c

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.5
1.2.6
53 changes: 53 additions & 0 deletions system/lib/libc/musl/WHATSNEW
Original file line number Diff line number Diff line change
Expand Up @@ -2438,3 +2438,56 @@ arch-specific bugs fixed:
- riscv64 icache flush operation was non-functional
- sh sigsetjmp failed to properly restore call-saved register r8 on return
- sh dlsym RTLD_NEXT did not identify calling module correctly



1.2.6 release notes

new features:
- posix_getdents interface (new in POSIX-2024)
- renameat2 interface (linux extension)
- iconv support for CP858
- vdso clock_gettime for riscv{32,64}, powerpc{,64}, and s390x
- loongarch64 TLSDESC support
- exposed __getauxval for compiler runtime use detecting cpu features

compatibility:
- initgroups no longer artificially limits number of supplementary groups
- getusershell now skips blank lines and comments
- exit is now explicitly thread-safe (possible future requirement)
- atexit now fails rather than deadlocking if called from late dtor
- strerror now has error strings for EUCLEAN and ENAVAIL
- isatty no longer collapses errors to ENOTTY
- sched.h namespace pollution with _GNU_SOURCE is reduced
- hasmntopt now matches only whole options, not arbitrary substrings
- shadow.h no longer declares an unimplemented sgetspent interface
- vdso with missing sysv hash table (only gnu hash) is now supported

conformance:
- pwrite now handles O_APPEND correctly, reports error if it can't
- mbnrtowcs now conforms to new POSIX-2024 requirement for partial character
- iconv GBK now properly includes euro symbol
- strptime now accepts conversion specifiers added in POSIX-2024
- inet_ntop IPv6 "zero compression" now conforms to RFC 5952

bugs fixed:
- iconv euc-kr decoder could do oob writes on invalid inputs (CVE-2025-26519)
- iconv shift_jis decoder could produce wrong outputs for some invalid inputs
- printf did not honor hex float precision correctly in some cases
- lost or delayed wakes in sem_post under race condition
- termios input speed handling was wrong
- strcasestr failed to match zero-length needle
- fma handled corner case with negative zero wrongly
- syslog LOG_MAKEPRI macro was incorrect
- timer_create is no longer affected by known pthread_barrier bugs
- sysconf(_SC_MINSIGSTKSZ) computed min size incorrectly
- statx emulation left some fields uninitialized
- mntent wrongly included final newline in parsed field output
- SIGEV_THREAD timers could abort process if SIGTIMER became unblocked
- bind_textdomain_codeset returned wrong value

arch-specific bugs fixed:
- early dynamic linker handled page size wrong on dynamic pagesize archs
- arm and aarch64 crti/n files had wrong alignment
- m68k POLLWRNORM and POLLWRBAND values were incorrect
- x32 mq ABI was mismatched
1 change: 0 additions & 1 deletion system/lib/libc/musl/arch/emscripten/bits/endian.h

This file was deleted.

15 changes: 1 addition & 14 deletions system/lib/libc/musl/arch/emscripten/bits/fenv.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,7 @@
typedef unsigned short fexcept_t;

typedef struct {
unsigned short __control_word;
unsigned short __unused1;
unsigned short __status_word;
unsigned short __unused2;
unsigned short __tags;
unsigned short __unused3;
unsigned int __eip;
unsigned short __cs_selector;
unsigned int __opcode:11;
unsigned int __unused4:5;
unsigned int __data_offset;
unsigned short __data_selector;
unsigned short __unused5;
unsigned int __mxcsr;
unsigned __cw;
} fenv_t;

#define FE_DFL_ENV ((const fenv_t *) -1)
4 changes: 3 additions & 1 deletion system/lib/libc/musl/arch/emscripten/bits/limits.h
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
#define PAGE_SIZE 65536
// A value used historically in Emscripten, and which we don't have a strong
// reason to change so far.
#define PAGESIZE 65536
4 changes: 4 additions & 0 deletions system/lib/libc/musl/arch/emscripten/bits/mman.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// XXX Emscripten in sync with both:
// - musl/arch/x86_64/bits/mman.h
// - musl/arch/i386/bits/mman.h
#define MAP_32BIT 0x40
2 changes: 0 additions & 2 deletions system/lib/libc/musl/arch/emscripten/bits/posix.h

This file was deleted.

6 changes: 0 additions & 6 deletions system/lib/libc/musl/arch/emscripten/bits/reg.h

This file was deleted.

1 change: 1 addition & 0 deletions system/lib/libc/musl/arch/emscripten/bits/setjmp.h
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
// XXX Emscripten in sync with musl/arch/i386/bits/setjmp.h
typedef unsigned long __jmp_buf[6];
70 changes: 45 additions & 25 deletions system/lib/libc/musl/arch/emscripten/bits/signal.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// XXX Emscripten in sync with musl/arch/i386/bits/signal.h
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)

Expand All @@ -7,33 +8,46 @@
#endif

#ifdef _GNU_SOURCE
#define REG_GS 0
#define REG_FS 1
#define REG_ES 2
#define REG_DS 3
#define REG_EDI 4
#define REG_ESI 5
#define REG_EBP 6
#define REG_ESP 7
#define REG_EBX 8
#define REG_EDX 9
#define REG_ECX 10
#define REG_EAX 11
#define REG_TRAPNO 12
#define REG_ERR 13
#define REG_EIP 14
#define REG_CS 15
#define REG_EFL 16
#define REG_UESP 17
#define REG_SS 18
enum { REG_GS = 0 };
#define REG_GS REG_GS
enum { REG_FS = 1 };
#define REG_FS REG_FS
enum { REG_ES = 2 };
#define REG_ES REG_ES
enum { REG_DS = 3 };
#define REG_DS REG_DS
enum { REG_EDI = 4 };
#define REG_EDI REG_EDI
enum { REG_ESI = 5 };
#define REG_ESI REG_ESI
enum { REG_EBP = 6 };
#define REG_EBP REG_EBP
enum { REG_ESP = 7 };
#define REG_ESP REG_ESP
enum { REG_EBX = 8 };
#define REG_EBX REG_EBX
enum { REG_EDX = 9 };
#define REG_EDX REG_EDX
enum { REG_ECX = 10 };
#define REG_ECX REG_ECX
enum { REG_EAX = 11 };
#define REG_EAX REG_EAX
enum { REG_TRAPNO = 12 };
#define REG_TRAPNO REG_TRAPNO
enum { REG_ERR = 13 };
#define REG_ERR REG_ERR
enum { REG_EIP = 14 };
#define REG_EIP REG_EIP
enum { REG_CS = 15 };
#define REG_CS REG_CS
enum { REG_EFL = 16 };
#define REG_EFL REG_EFL
enum { REG_UESP = 17 };
#define REG_UESP REG_UESP
enum { REG_SS = 18 };
#define REG_SS REG_SS
#endif

struct sigaltstack {
void *ss_sp;
int ss_flags;
size_t ss_size;
};

#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
typedef int greg_t, gregset_t[19];
typedef struct _fpstate {
Expand Down Expand Up @@ -64,6 +78,12 @@ typedef struct {
} mcontext_t;
#endif

struct sigaltstack {
void *ss_sp;
int ss_flags;
size_t ss_size;
};

typedef struct __ucontext {
unsigned long uc_flags;
struct __ucontext *uc_link;
Expand Down
14 changes: 10 additions & 4 deletions system/lib/libc/musl/arch/emscripten/bits/stat.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// XXX Emscripten in sync with musl/arch/i386/bits/stat.h except for the padding and 64-bit time_t redirections change.

/* copied from kernel definition, but with padding replaced
* by the corresponding correctly-sized userspace types. */

struct stat
{
struct stat {
dev_t st_dev;
#ifndef __EMSCRIPTEN__
int __st_dev_padding;
Expand All @@ -19,8 +19,14 @@ struct stat
off_t st_size;
blksize_t st_blksize;
blkcnt_t st_blocks;
#ifndef __EMSCRIPTEN__ // XXX Emscripten no need to activate the symbol redirections for 64-bit time_t.
struct {
long tv_sec;
long tv_nsec;
} __st_atim32, __st_mtim32, __st_ctim32;
#endif
ino_t st_ino;
struct timespec st_atim;
struct timespec st_mtim;
struct timespec st_ctim;
ino_t st_ino;
};
Loading
Loading