Successfully identified regression in *glibc* in CI configuration tcwg_cross/gnu-master-aarch64-build_cross. So far, this commit has regressed CI configurations: - tcwg_cross/gnu-master-aarch64-build_cross
Culprit: <cut> commit c8935581de4ff931bc32fb03da5d87f0ee2378a1 Author: Khem Raj raj.khem@gmail.com Date: Fri Jul 2 13:28:10 2021 -0700
linux: Check for null value msghdr struct before use
This avoids crashes in libc when cmsg is null and refrencing msg structure when it is null
Signed-off-by: Khem Raj raj.khem@gmail.com Reviewed-by: Adhemerval Zanella adhemerval.zanella@linaro.org </cut>
Results regressed to (for first_bad == c8935581de4ff931bc32fb03da5d87f0ee2378a1) # reset_artifacts: -10 # true: 0 # build_abe binutils: 1 # build_abe stage1: 2 # build_abe linux: 3 # First few build errors in logs: # 00:00:14 make[2]: *** [/home/tcwg-buildslave/workspace/tcwg_gnu_0/abe/builds/x86_64-pc-linux-gnu/aarch64-linux-gnu/glibc-glibc.git~master/sysd-rules:499: /home/tcwg-buildslave/workspace/tcwg_gnu_0/abe/builds/x86_64-pc-linux-gnu/aarch64-linux-gnu/glibc-glibc.git~master/csu/start.os] Error 1 # 00:00:14 make[2]: *** [/home/tcwg-buildslave/workspace/tcwg_gnu_0/abe/builds/x86_64-pc-linux-gnu/aarch64-linux-gnu/glibc-glibc.git~master/sysd-rules:483: /home/tcwg-buildslave/workspace/tcwg_gnu_0/abe/builds/x86_64-pc-linux-gnu/aarch64-linux-gnu/glibc-glibc.git~master/csu/crti.o] Error 1 # 00:00:14 make[2]: *** [/home/tcwg-buildslave/workspace/tcwg_gnu_0/abe/builds/x86_64-pc-linux-gnu/aarch64-linux-gnu/glibc-glibc.git~master/sysd-rules:483: /home/tcwg-buildslave/workspace/tcwg_gnu_0/abe/builds/x86_64-pc-linux-gnu/aarch64-linux-gnu/glibc-glibc.git~master/csu/start.o] Error 1 # 00:00:14 make[2]: *** [/home/tcwg-buildslave/workspace/tcwg_gnu_0/abe/builds/x86_64-pc-linux-gnu/aarch64-linux-gnu/glibc-glibc.git~master/sysd-rules:483: /home/tcwg-buildslave/workspace/tcwg_gnu_0/abe/builds/x86_64-pc-linux-gnu/aarch64-linux-gnu/glibc-glibc.git~master/csu/crtn.o] Error 1 # 00:00:14 make[2]: *** [../o-iterator.mk:9: /home/tcwg-buildslave/workspace/tcwg_gnu_0/abe/builds/x86_64-pc-linux-gnu/aarch64-linux-gnu/glibc-glibc.git~master/csu/check_fds.os] Error 1 # 00:00:14 make[2]: *** [../o-iterator.mk:9: /home/tcwg-buildslave/workspace/tcwg_gnu_0/abe/builds/x86_64-pc-linux-gnu/aarch64-linux-gnu/glibc-glibc.git~master/csu/check_fds.o] Error 1 # 00:00:14 ../sysdeps/aarch64/nptl/tls.h:91:19: error: ‘__builtin_thread_pointer’ is not supported on this target # 00:00:14 make[2]: *** [/home/tcwg-buildslave/workspace/tcwg_gnu_0/abe/builds/x86_64-pc-linux-gnu/aarch64-linux-gnu/glibc-glibc.git~master/sysd-rules:485: /home/tcwg-buildslave/workspace/tcwg_gnu_0/abe/builds/x86_64-pc-linux-gnu/aarch64-linux-gnu/glibc-glibc.git~master/csu/libc-tls.o] Error 1 # 00:00:14 ../sysdeps/unix/sysv/linux/aarch64/sysdep.h:190:17: error: invalid register name for ‘_x0’ # 00:00:14 ../sysdeps/unix/sysv/linux/aarch64/sysdep.h:174:22: error: invalid register name for ‘_x8’
from (for last_good == 91fb0f17a5779da6e7877eb74119a83dbe8bf167) # reset_artifacts: -10 # true: 0 # build_abe binutils: 1 # build_abe stage1: 2 # build_abe linux: 3 # build_abe glibc: 4 # build_abe stage2: 5 # build_abe qemu: 6
Artifacts of last_good build: https://ci.linaro.org/job/tcwg_cross-bisect-gnu-master-aarch64-build_cross/2... Artifacts of first_bad build: https://ci.linaro.org/job/tcwg_cross-bisect-gnu-master-aarch64-build_cross/2... Build top page/logs: https://ci.linaro.org/job/tcwg_cross-bisect-gnu-master-aarch64-build_cross/2...
Configuration details:
Reproduce builds: <cut> mkdir investigate-glibc-c8935581de4ff931bc32fb03da5d87f0ee2378a1 cd investigate-glibc-c8935581de4ff931bc32fb03da5d87f0ee2378a1
git clone https://git.linaro.org/toolchain/jenkins-scripts
mkdir -p artifacts/manifests curl -o artifacts/manifests/build-baseline.sh https://ci.linaro.org/job/tcwg_cross-bisect-gnu-master-aarch64-build_cross/2... --fail curl -o artifacts/manifests/build-parameters.sh https://ci.linaro.org/job/tcwg_cross-bisect-gnu-master-aarch64-build_cross/2... --fail curl -o artifacts/test.sh https://ci.linaro.org/job/tcwg_cross-bisect-gnu-master-aarch64-build_cross/2... --fail chmod +x artifacts/test.sh
# Reproduce the baseline build (build all pre-requisites) ./jenkins-scripts/tcwg_gnu-build.sh @@ artifacts/manifests/build-baseline.sh
cd glibc
# Reproduce first_bad build git checkout --detach c8935581de4ff931bc32fb03da5d87f0ee2378a1 ../artifacts/test.sh
# Reproduce last_good build git checkout --detach 91fb0f17a5779da6e7877eb74119a83dbe8bf167 ../artifacts/test.sh
cd .. </cut>
History of pending regressions and results: https://git.linaro.org/toolchain/ci/base-artifacts.git/log/?h=linaro-local/c...
Artifacts: https://ci.linaro.org/job/tcwg_cross-bisect-gnu-master-aarch64-build_cross/2... Build log: https://ci.linaro.org/job/tcwg_cross-bisect-gnu-master-aarch64-build_cross/2...
Full commit (up to 1000 lines): <cut> commit c8935581de4ff931bc32fb03da5d87f0ee2378a1 Author: Khem Raj raj.khem@gmail.com Date: Fri Jul 2 13:28:10 2021 -0700
linux: Check for null value msghdr struct before use
This avoids crashes in libc when cmsg is null and refrencing msg structure when it is null
Signed-off-by: Khem Raj raj.khem@gmail.com Reviewed-by: Adhemerval Zanella adhemerval.zanella@linaro.org --- sysdeps/unix/sysv/linux/convert_scm_timestamps.c | 2 ++ sysdeps/unix/sysv/linux/recvmsg.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/convert_scm_timestamps.c b/sysdeps/unix/sysv/linux/convert_scm_timestamps.c index d75a4618dd..5af71847f5 100644 --- a/sysdeps/unix/sysv/linux/convert_scm_timestamps.c +++ b/sysdeps/unix/sysv/linux/convert_scm_timestamps.c @@ -87,6 +87,8 @@ __convert_scm_timestamps (struct msghdr *msg, socklen_t msgsize)
msg->msg_controllen += CMSG_SPACE (sizeof tvts); cmsg = CMSG_NXTHDR(msg, last); + if (cmsg == NULL) + return; cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = type; cmsg->cmsg_len = CMSG_LEN (sizeof tvts); diff --git a/sysdeps/unix/sysv/linux/recvmsg.c b/sysdeps/unix/sysv/linux/recvmsg.c index a2a600228b..57c3cf7e36 100644 --- a/sysdeps/unix/sysv/linux/recvmsg.c +++ b/sysdeps/unix/sysv/linux/recvmsg.c @@ -25,7 +25,7 @@ __libc_recvmsg (int fd, struct msghdr *msg, int flags) { ssize_t r; #ifndef __ASSUME_TIME64_SYSCALLS - socklen_t orig_controllen = msg->msg_controllen; + socklen_t orig_controllen = msg != NULL ? msg->msg_controllen : 0; #endif
#ifdef __ASSUME_RECVMSG_SYSCALL @@ -35,7 +35,7 @@ __libc_recvmsg (int fd, struct msghdr *msg, int flags) #endif
#ifndef __ASSUME_TIME64_SYSCALLS - if (r >= 0) + if (r >= 0 && orig_controllen != 0) __convert_scm_timestamps (msg, orig_controllen); #endif
</cut>
linaro-toolchain@lists.linaro.org