From 2fac7996326cef9734c6234d633f33366c948852 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Thu, 9 Mar 2017 14:01:25 -0800 Subject: [PATCH 1/6] Add travis CI script and rename README to README.md - add Travis-CI build status - Add License badge - Add coverity scan - Add clang static analyser Signed-off-by: Khem Raj --- .travis.yml | 36 ++++++++++++++++++++++++++++++++++++ README => README.md | 9 ++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 .travis.yml rename README => README.md (70%) diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..a1c8e0300 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,36 @@ +dist: bionic +sudo: required +language: c +compiler: +- clang +env: + matrix: + #- ANALYZE=1 + - ANALYZE=0 + global: + # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created + # via the "travis encrypt" command using the project repo's public key + - secure: "Lts0gdnm5ZpO0EBhK86Wi86y9spIaXGJr1uiJ1OX5NGmXyrniNx0myJsq9TW8q21pBCX83742VAOS/0ZOihMAW09tPxjkqP97waDIynu1L+eum58T68ftJX2vxtBiYpvD/OLSyy8iBZTVn1/NhcvT4HSHgmXdbu8ukVr1NKwc+R8msMPB9xEj+VIQJoiehzrRDdt5/PNvd4gudT2VYwI5i6RhLLqnIGyfKW3gnRAKYDW7j9KCjX9MA4uZ/V+PIcMBTqM897fccYLLRsAsNnjhH1CblhTVeiGpHAR+FWCL25220BMvUtRTnUw5EsxBntoicCuvOReoZIb/goWaF97mOrMjWECzVmPOYmdWG+U4LGK7tXwrRqfbOwWetwF1G4PpoiFs+DBQDhNWxvyHi+lcm4/T6jqlhZGzAcFF85mLacOgDyNLhg8mJ9GkkLMJcm53+tqNrlZgKayQZcpeOIFg/ceQrY+j6Y4u0Tu9J3ZCqtoHS3xxa5Oqkc1tEN+1W2sNPQp1rZyFkSsP1dHB/70K48jvah+duhO1TReUa1iojOLAMo283nNfvGYdgL+1eDUG9iEWP4dyMR5zEp5RJF5r9FkF1FizyYak1F7Kj/oCyYyPHpxL4BvSLUqWT4ehoCoYdqdiF5NWPQSgyIqGpnt2tcyS/6q2ONArtaIUP3gUQA=" + +before_install: +- echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca- +- sudo pip install codecov + +addons: + coverity_scan: + project: + name: kraj/musl + notification_email: raj.khem@gmail.com + build_command_prepend: ./configure + build_command: make -j4 + branch_pattern: coverity_scan +install: +- sudo apt-get update -qq +- sudo apt-get install -y -qq clang lcov +script: +- if [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then ./configure ; fi +- if [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then make -j4 ; fi +- if [ "${ANALYZE}" = 1 ]; then make clean ; fi +- if [ "${ANALYZE}" = 1 ]; then /usr/bin/scan-build --status-bugs -v make -j4 ; fi +after_success: +- codecov diff --git a/README b/README.md similarity index 70% rename from README rename to README.md index a30eb1127..9f8460fe6 100644 --- a/README +++ b/README.md @@ -1,5 +1,5 @@ - musl libc +# musl libc musl, pronounced like the word "mussel", is an MIT-licensed implementation of the standard C library targetting the Linux syscall @@ -21,3 +21,10 @@ bootstrapping, and Linux distributions built on musl can be found on the project website: http://www.musl-libc.org/ + +[![Build Status](https://travis-ci.org/kraj/musl.svg?branch=kraj%2Fmaster)](https://travis-ci.org/kraj/musl) + + Coverity Scan Build Status + +[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/kraj/musl/blob/kraj/master/COPYRIGHT) From dcd5a33e3e2b7ed4420f22f793ca31f1105c285e Mon Sep 17 00:00:00 2001 From: Amarnath Valluri Date: Wed, 18 Jan 2017 16:14:37 +0200 Subject: [PATCH 2/6] Make dynamic linker a relative symlink to libc absolute symlink into $(libdir) fails to load in a cross build environment, especially when executing qemu in usermode to run target applications, which cross build systems often do, since not everything can be computed during cross builds, qemu in usermode often comes to aid in such situations to feed into cross builds. V2: Make use of 'ln -r' to create relative symlinks, as most fo the distros shipping coreutils 8.16+ Signed-off-by: Khem Raj Signed-off-by: Amarnath Valluri --- Makefile | 2 +- tools/install.sh | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 3ad88b359..f10f0d6c4 100644 --- a/Makefile +++ b/Makefile @@ -210,7 +210,7 @@ $(DESTDIR)$(includedir)/%: $(srcdir)/include/% $(INSTALL) -D -m 644 $< $@ $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so - $(INSTALL) -D -l $(libdir)/libc.so $@ || true + $(INSTALL) -D -r $(DESTDIR)$(libdir)/libc.so $@ || true install-libs: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),) diff --git a/tools/install.sh b/tools/install.sh index 855a8ca2d..a2e6a5eb5 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -6,18 +6,20 @@ # usage() { -printf "usage: %s [-D] [-l] [-m mode] src dest\n" "$0" 1>&2 +printf "usage: %s [-D] [-l] [-r] [-m mode] src dest\n" "$0" 1>&2 exit 1 } mkdirp= symlink= +symlinkflags="-s" mode=755 -while getopts Dlm: name ; do +while getopts Dlrm: name ; do case "$name" in D) mkdirp=yes ;; l) symlink=yes ;; +r) symlink=yes; symlinkflags="$symlinkflags -r" ;; m) mode=$OPTARG ;; ?) usage ;; esac @@ -49,7 +51,7 @@ umask 077 if test "$symlink" ; then umask 000 -ln -s "$1" "$tmp" +ln $symlinkflags "$1" "$tmp" umask 077 else cat < "$1" > "$tmp" From 87f409d3c8a85f337b2f3ea4a461db4c288828ea Mon Sep 17 00:00:00 2001 From: Serhey Popovych Date: Tue, 11 Dec 2018 05:44:20 -0500 Subject: [PATCH 3/6] ldso: Use syslibdir and libdir as default pathes to libdirs In absence of /etc/ld-musl-$(ARCH).path ldso uses default path to search libraries /lib:/usr/local/lib:/usr/lib. However this path isn't relevant in case when library is put in dirs like lib64 or libx32. Adjust CFLAGS_ALL to pass syslibdir as SYSLIBDIR and libdir as LIBDIR preprocessor macroses to construct default ldso library search path in ldso/dynlink.c::SYS_PATH_DFLT. Upstream-Status: Pending Signed-off-by: Serhey Popovych --- Makefile | 3 ++- ldso/dynlink.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f10f0d6c4..4d30a6e7f 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,8 @@ CFLAGS_AUTO = -Os -pipe CFLAGS_C99FSE = -std=c99 -ffreestanding -nostdinc CFLAGS_ALL = $(CFLAGS_C99FSE) -CFLAGS_ALL += -D_XOPEN_SOURCE=700 -I$(srcdir)/arch/$(ARCH) -I$(srcdir)/arch/generic -Iobj/src/internal -I$(srcdir)/src/include -I$(srcdir)/src/internal -Iobj/include -I$(srcdir)/include +CFLAGS_ALL += -D_XOPEN_SOURCE=700 -DSYSLIBDIR='"$(syslibdir)"' -DLIBDIR='"$(libdir)"' +CFLAGS_ALL += -I$(srcdir)/arch/$(ARCH) -I$(srcdir)/arch/generic -Iobj/src/internal -I$(srcdir)/src/include -I$(srcdir)/src/internal -Iobj/include -I$(srcdir)/include CFLAGS_ALL += $(CPPFLAGS) $(CFLAGS_AUTO) $(CFLAGS) LDFLAGS_ALL = $(LDFLAGS_AUTO) $(LDFLAGS) diff --git a/ldso/dynlink.c b/ldso/dynlink.c index 715948f4f..f23cf4a0c 100644 --- a/ldso/dynlink.c +++ b/ldso/dynlink.c @@ -37,6 +37,8 @@ static size_t ldso_page_size; #define realloc __libc_realloc #define free __libc_free +#define SYS_PATH_DFLT SYSLIBDIR ":" LIBDIR + static void error_impl(const char *, ...); static void error_noop(const char *, ...); static void (*error)(const char *, ...) = error_noop; @@ -1157,7 +1159,7 @@ static struct dso *load_library(const char *name, struct dso *needed_by) sys_path = ""; } } - if (!sys_path) sys_path = "/lib:/usr/local/lib:/usr/lib"; + if (!sys_path) sys_path = SYS_PATH_DFLT; fd = path_open(name, sys_path, buf, sizeof buf); } pathname = buf; From 97f3c560f613023a375c86f3e9bcc78ada84a4b4 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 15 Mar 2017 22:08:23 -0700 Subject: [PATCH 4/6] configure: Use -print-libgcc-file-name first to detect compiler runtime This uses compiler to provide the path to its default runtime library libgcc/compiler-rt, when using clang we can set CC="clang --rtlib={compiler-rt|libgcc}" and it will find the right compiler runtime when autodetecting it Signed-off-by: Khem Raj --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index bc9fbe48c..81a7315a6 100755 --- a/configure +++ b/configure @@ -615,10 +615,10 @@ tryldflag LDFLAGS_AUTO -Wl,--exclude-libs=ALL tryldflag LDFLAGS_AUTO -Wl,--dynamic-list="$srcdir/dynamic.list" # Find compiler runtime library -test -z "$LIBCC" && tryldflag LIBCC -lgcc && tryldflag LIBCC -lgcc_eh -test -z "$LIBCC" && tryldflag LIBCC -lcompiler_rt test -z "$LIBCC" && try_libcc=`$CC -print-libgcc-file-name 2>/dev/null` \ && tryldflag LIBCC "$try_libcc" +test -z "$LIBCC" && tryldflag LIBCC -lgcc && tryldflag LIBCC -lgcc_eh +test -z "$LIBCC" && tryldflag LIBCC -lcompiler_rt test -z "$LIBCC" && try_libcc=`$CC -print-file-name=libpcc.a 2>/dev/null` \ && tryldflag LIBCC "$try_libcc" printf "using compiler runtime libraries: %s\n" "$LIBCC" From d1c1058ee7a61cf86dc0292590e3f7eb09212d70 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 4 Dec 2024 11:16:43 -0800 Subject: [PATCH 5/6] Update syscalls for r32/rv64 from kernel 6.4 through 6.10 --- arch/riscv32/bits/syscall.h.in | 11 +++++++++++ arch/riscv64/bits/syscall.h.in | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/arch/riscv32/bits/syscall.h.in b/arch/riscv32/bits/syscall.h.in index 9228d8408..a54d9ffc7 100644 --- a/arch/riscv32/bits/syscall.h.in +++ b/arch/riscv32/bits/syscall.h.in @@ -216,6 +216,7 @@ #define __NR_perf_event_open 241 #define __NR_accept4 242 #define __NR_arch_specific_syscall 244 +#define __NR_riscv_hwprobe 258 #define __NR_prlimit64 261 #define __NR_fanotify_init 262 #define __NR_fanotify_mark 263 @@ -295,6 +296,16 @@ #define __NR_cachestat 451 #define __NR_fchmodat2 452 #define __NR_futex __NR_futex_time64 +#define __NR_map_shadow_stack 453 +#define __NR_futex_wake 454 +#define __NR_futex_wait 455 +#define __NR_futex_requeue 456 +#define __NR_statmount 457 +#define __NR_listmount 458 +#define __NR_lsm_get_self_attr 459 +#define __NR_lsm_list_modules 461 +#define __NR_lsm_set_self_attr 460 +#define __NR_mseal 462 #define __NR_sysriscv __NR_arch_specific_syscall #define __NR_riscv_flush_icache (__NR_sysriscv + 15) diff --git a/arch/riscv64/bits/syscall.h.in b/arch/riscv64/bits/syscall.h.in index e362bd0ec..6991a89c3 100644 --- a/arch/riscv64/bits/syscall.h.in +++ b/arch/riscv64/bits/syscall.h.in @@ -242,6 +242,7 @@ #define __NR_accept4 242 #define __NR_recvmmsg 243 #define __NR_arch_specific_syscall 244 +#define __NR_riscv_hwprobe 258 #define __NR_wait4 260 #define __NR_prlimit64 261 #define __NR_fanotify_init 262 @@ -304,6 +305,16 @@ #define __NR_set_mempolicy_home_node 450 #define __NR_cachestat 451 #define __NR_fchmodat2 452 +#define __NR_map_shadow_stack 453 +#define __NR_futex_wake 454 +#define __NR_futex_wait 455 +#define __NR_futex_requeue 456 +#define __NR_statmount 457 +#define __NR_listmount 458 +#define __NR_lsm_get_self_attr 459 +#define __NR_lsm_list_modules 461 +#define __NR_lsm_set_self_attr 460 +#define __NR_mseal 462 #define __NR_sysriscv __NR_arch_specific_syscall #define __NR_riscv_flush_icache (__NR_sysriscv + 15) From 54c143ad7e699a747e7d064156a1acece252f6e3 Mon Sep 17 00:00:00 2001 From: sherryzy Date: Thu, 25 Sep 2025 17:33:50 +0000 Subject: [PATCH 6/6] feat(sys/prctl): Add PR_SET_VMA definitions Add the new definitions for PR_SET_VMA from the Linux kernel, which allows naming anonymous Virtual Memory Areas (VMAs). --- include/sys/prctl.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/sys/prctl.h b/include/sys/prctl.h index 087a75c9d..04ce0d4f3 100644 --- a/include/sys/prctl.h +++ b/include/sys/prctl.h @@ -177,6 +177,9 @@ struct prctl_mm_map { #define PR_PAC_SET_ENABLED_KEYS 60 #define PR_PAC_GET_ENABLED_KEYS 61 +#define PR_SET_VMA 0x53564d41 +#define PR_SET_VMA_ANON_NAME 0 + int prctl (int, ...); #ifdef __cplusplus