From a86513b40ec92203cf73c27feed0f4045db15634 Mon Sep 17 00:00:00 2001 From: David Ward Date: Mon, 11 Nov 2019 14:06:01 -0500 Subject: [PATCH 1/3] Revert "Trim EXTRAVERSION in the Makefile on CI builds" This reverts commit 89c7d2ae30a43ba2960ce14cddd50f8d8a7da92f, which was causing kernel modules to be installed in a location other than /lib/modules/$(uname -r), preventing modprobe from locating them. CI builds no longer contain the Pagure UID in the package release: https://github.com/CentOS-PaaS-SIG/upstream-fedora-pipeline/pull/199 --- kernel.spec | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel.spec b/kernel.spec index 5d4f938fe..14e349b10 100644 --- a/kernel.spec +++ b/kernel.spec @@ -1427,9 +1427,7 @@ BuildKernel() { %endif # make sure EXTRAVERSION says what we want it to say - # Trim the release if this is a CI build, since KERNELVERSION is limited to 64 characters - ShortRel=$(perl -e "print \"%{release}\" =~ s/\.pr\.[0-9A-Fa-f]{32}//r") - perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -${ShortRel}.%{_target_cpu}${Flav}/" Makefile + perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{release}.%{_target_cpu}${Flav}/" Makefile # if pre-rc1 devel kernel, must fix up PATCHLEVEL for our versioning scheme %if !0%{?rcrev} From bee04eadf8306be0349b9f75559a1fea80591d7f Mon Sep 17 00:00:00 2001 From: David Ward Date: Mon, 11 Nov 2019 14:06:01 -0500 Subject: [PATCH 2/3] Fix existing CI test for memfd_create() The test was failing (after hanging for several hours) because of a hard-coded assumption about which file descriptor would be returned by memfd_create(). The actual file descriptor gets printed by the test program though, so read this and use it instead. (Adjust the test program so that this is not printed until the file is ready.) Resolve compiler warnings about implicit function declarations, by using the #include statements listed in the kernel.org man-pages. --- tests/memory/memfd_create/runtest.sh | 7 ++++--- tests/memory/memfd_create/t_get_seals.c | 3 ++- tests/memory/memfd_create/t_memfd_create.c | 18 +++++++++++------- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/tests/memory/memfd_create/runtest.sh b/tests/memory/memfd_create/runtest.sh index 24dfeb5b6..880c3096e 100755 --- a/tests/memory/memfd_create/runtest.sh +++ b/tests/memory/memfd_create/runtest.sh @@ -38,11 +38,12 @@ fi function sanity_memfd_create() { - rlRun "./t_memfd_create memf 1024 gswS &" - rlRun "./t_get_seals /proc/$!/fd/3 > seals" + rlRun "coproc ./t_memfd_create memf 1024 gswS" + rlRun "read -u ${COPROC[0]} MEMFD_PATH" + rlRun "./t_get_seals $MEMFD_PATH > ./seals" rlRun "cat ./seals" rlAssertGrep "SEAL GROW WRITE SHRINK" ./seals - rlRun "pkill t_memfd_create" + rlRun "kill $COPROC_PID" } diff --git a/tests/memory/memfd_create/t_get_seals.c b/tests/memory/memfd_create/t_get_seals.c index 8babe34d2..1a2c900e0 100644 --- a/tests/memory/memfd_create/t_get_seals.c +++ b/tests/memory/memfd_create/t_get_seals.c @@ -16,8 +16,9 @@ * */ -#include +#define _GNU_SOURCE #include +#include #include #include #include diff --git a/tests/memory/memfd_create/t_memfd_create.c b/tests/memory/memfd_create/t_memfd_create.c index 73d641a6e..4250d7174 100644 --- a/tests/memory/memfd_create/t_memfd_create.c +++ b/tests/memory/memfd_create/t_memfd_create.c @@ -16,11 +16,12 @@ * */ -#include -#include +#define _GNU_SOURCE +#include +#include +#include #include #include -#include #include #include @@ -66,10 +67,6 @@ int main(int argc, char *argv[]) if (write(fd, message, strlen(message)) <= 0) errExit("write"); - //printf("PID: %ld; fd: %d; /proc/%ld/fd/%d\n", - // (long) getpid(), fd, (long) getpid(), fd); - printf("/proc/%ld/fd/%d\n", (long) getpid(), fd); - /* Code to map the file and populate the mapping with data omitted */ @@ -92,6 +89,13 @@ int main(int argc, char *argv[]) errExit("fcntl"); } + /* Output the pathname of (a symbolic link to) the file + created by memfd_create() */ + + printf("/proc/%ld/fd/%d\n", (long) getpid(), fd); + + fflush(stdout); + /* Keep running, so that the file created by memfd_create() continues to exist */ From d753bc001a2a92bc325ccaca10497c7e2049f6ff Mon Sep 17 00:00:00 2001 From: David Ward Date: Mon, 11 Nov 2019 14:06:01 -0500 Subject: [PATCH 3/3] Resolve syntax warnings in SPEC file The "regular" definition of the with_kabichk macro does not need to be commented out while it is temporarily (re-)defined as 0 on the next line. This avoids a "Macro expanded in comment" warning. Remove comments on the same line as %endif directives. Instead, make a couple of these conditionals easier to read (and consistent with the surrounding ones) by deleting a few blank lines. --- kernel.spec | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/kernel.spec b/kernel.spec index 14e349b10..672b35354 100644 --- a/kernel.spec +++ b/kernel.spec @@ -146,7 +146,7 @@ Summary: The Linux kernel # Only build the debug kernel (--with dbgonly): %define with_dbgonly %{?_with_dbgonly: 1} %{?!_with_dbgonly: 0} # Control whether we perform a compat. check against published ABI. -#%define with_kabichk %{?_without_kabichk: 0} %{?!_without_kabichk: 1} +%define with_kabichk %{?_without_kabichk: 0} %{?!_without_kabichk: 1} # Temporarily disable kabi checks until RC. %define with_kabichk 0 # Control whether we perform a compat. check against DUP ABI. @@ -795,7 +795,6 @@ This package is required by %{name}-debuginfo subpackages. It provides the kernel source files common to all builds. %if %{with_selftests} - %package selftests-internal Summary: Kernel samples and selftests License: GPLv2 @@ -803,14 +802,13 @@ Requires: binutils, bpftool, iproute-tc, nmap-ncat Requires: kernel-modules-internal = %{version}-%{release} %description selftests-internal Kernel sample programs and selftests. - +%{nil} # Note that this pattern only works right to match the .build-id # symlinks because of the trailing nonmatching alternation and # the leading .*, because of find-debuginfo.sh's buggy handling # of matching the pattern against the symlinks file. %{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%%{_libexecdir}/(ksamples|kselftests)/.*|XXX' -o selftests-debuginfo.list} - -%endif # with_selftests +%endif %if %{with_gcov} %package gcov @@ -1000,7 +998,7 @@ Cortex-A15 devices with LPAE and HW virtualisation support %description zfcpdump-core The kernel package contains the Linux kernel (vmlinuz) for use by the zfcpdump infrastructure. -%endif # with_zfcpdump +%endif %define variant_summary The Linux kernel compiled with extra debugging enabled %kernel_variant_package debug @@ -1511,8 +1509,8 @@ BuildKernel() { %pesign -s -i $KernelImage -o vmlinuz.signed %else %pesign -s -i $SignImage -o vmlinuz.signed -a %{secureboot_ca} -c %{secureboot_key} -n %{pesign_name} - %endif # fedora - %endif # arches + %endif + %endif %ifarch s390x ppc64le if [ -x /usr/bin/rpm-sign ]; then rpm-sign --key "%{pesign_name}" --lkmsign $SignImage --output vmlinuz.signed @@ -2054,7 +2052,7 @@ docdir=$RPM_BUILD_ROOT%{_datadir}/doc/kernel-doc-%{rpmversion} mkdir -p $docdir tar -h -f - --exclude=man --exclude='.*' -c Documentation | tar xf - -C $docdir -%endif # with_doc +%endif # We have to do the headers install before the tools install because the # kernel headers_install will remove any header files in /usr/include that @@ -2096,10 +2094,9 @@ rm -rf $RPM_BUILD_ROOT/usr/tmp-headers # kabi directory INSTALL_KABI_PATH=$RPM_BUILD_ROOT/lib/modules/ mkdir -p $INSTALL_KABI_PATH - # install kabi releases directories tar xjvf %{SOURCE300} -C $INSTALL_KABI_PATH -%endif # with_kernel_abi_whitelists +%endif %if %{with_selftests} pushd samples