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/Makefile b/Makefile index 3ad88b359..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) @@ -210,7 +211,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/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) 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) 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" 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 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; 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"