From 9978ff77e3f2b86812807f4c7b7aa3f2aa02f66f Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Sat, 24 Oct 2026 05:36:52 -0300 Subject: [PATCH 1/6] test(xcat-test): the machine type the case writes is never checked against the vmhost vm_machine_type_for_arch returns a machine type from a fixed table. Nothing asks the host that runs the guest whether it accepts that name, so a name that the host dropped is written and libvirt refuses the domain. The bats file now stubs virsh and ssh for the vmhost and asserts the name that comes back: the plain alias when the host accepts it, the host's own default when it does not, the alias again when the host cannot be reached, and the architecture and host the probe asks about. ppc64el is covered beside ppc64le because the Ubuntu cells name the architecture that way. Nine tests fail against the current script, which answers machine:pseries-rhel7.6.0 for every ppc64 architecture. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- xCAT-test/bats/vm_machine_type.bats | 160 ++++++++++++++++++++++++++-- 1 file changed, 154 insertions(+), 6 deletions(-) diff --git a/xCAT-test/bats/vm_machine_type.bats b/xCAT-test/bats/vm_machine_type.bats index 22480c09ed..3d37c76d80 100644 --- a/xCAT-test/bats/vm_machine_type.bats +++ b/xCAT-test/bats/vm_machine_type.bats @@ -1,6 +1,8 @@ #!/usr/bin/env bats # vm_machine_type.sh sets machine:invalid, then a valid machine type, then clears it again. # lsdef and chdef are shell functions that read and write vmothersetting of node cn1 in a file. +# virsh is a shell function that answers for the vmhost, and ssh runs the command it is given +# so that function answers it. MACHINES is what that vmhost declares. load 'helpers/shell_source' @@ -14,6 +16,17 @@ setup() LSDEF_FAIL=0 CHDEF_FAIL=0 CHDEF_CALLS=0 + # The vmhost of cn1, and what its libvirt declares. Every plain alias is in the set, so a + # test that does not care which host answers gets the alias. + VMHOST='' + MACHINES='pseries pseries-10.2 pc pc-i440fx-rhel10.0.0 q35 virt virt-10.2' + DEFAULT_MACHINE='' + SSH_FAIL=0 + VIRSH_ABSENT=0 + SSH_TARGETS="${BATS_TEST_TMPDIR}/ssh-targets" + VIRSH_ARCHS="${BATS_TEST_TMPDIR}/virsh-archs" + : >"$SSH_TARGETS" + : >"$VIRSH_ARCHS" } # lsdef prints no line for an attribute without a value. @@ -24,9 +37,16 @@ lsdef() return 1 fi printf 'Object name: %s\n' "$1" - if [ -s "$VMOTHER" ]; then - printf ' vmothersetting=%s\n' "$(cat "$VMOTHER")" - fi + case "$3" in + vmhost) + [ -z "$VMHOST" ] || printf ' vmhost=%s\n' "$VMHOST" + ;; + *) + if [ -s "$VMOTHER" ]; then + printf ' vmothersetting=%s\n' "$(cat "$VMOTHER")" + fi + ;; + esac } chdef() @@ -40,6 +60,56 @@ chdef() CHDEF_CALLS=$((CHDEF_CALLS + 1)) } +# virsh domcapabilities, as libvirt answers it: a --machine the host does not declare is an +# error, and the element names the default machine of the architecture. +virsh() +{ + local arch='' machine='' + + if [ "$VIRSH_ABSENT" -ne 0 ]; then + echo "bash: virsh: command not found" >&2 + return 127 + fi + [ "$1" = domcapabilities ] || return 1 + shift + while [ "$#" -gt 0 ]; do + case "$1" in + --arch) arch="$2"; shift 2 ;; + --machine) machine="$2"; shift 2 ;; + *) return 1 ;; + esac + done + printf '%s\n' "$arch" >>"$VIRSH_ARCHS" + if [ -n "$machine" ] && ! printf '%s\n' $MACHINES | grep -qx -- "$machine"; then + echo "error: invalid argument: the machine '$machine' is not supported by emulator" >&2 + return 1 + fi + echo '' + [ -z "$DEFAULT_MACHINE" ] || printf ' %s\n' "$DEFAULT_MACHINE" + echo '' +} + +# ssh records the host it was asked for and runs the command, so the virsh function above +# answers it. Real ssh joins the command words with spaces for the remote shell. +ssh() +{ + local target='' + + while [ "$#" -gt 0 ]; do + case "$1" in + -o) shift 2 ;; + -*) shift ;; + *) target="$1"; shift; break ;; + esac + done + printf '%s\n' "$target" >>"$SSH_TARGETS" + if [ "$SSH_FAIL" -ne 0 ]; then + echo "ssh: connect to host $target port 22: No route to host" >&2 + return 255 + fi + "$@" +} + set_vmother() { printf '%s' "$1" >"$VMOTHER" @@ -69,9 +139,9 @@ assert_arch() [ "$CHDEF_CALLS" -eq 3 ] } -@test "ppc64le: the case sets and clears pseries-rhel7.6.0" { - assert_arch ppc64le pseries-rhel7.6.0 '' - assert_arch ppc64le pseries-rhel7.6.0 'cpumode:host-passthrough' +@test "ppc64le: the case sets and clears pseries" { + assert_arch ppc64le pseries '' + assert_arch ppc64le pseries 'cpumode:host-passthrough' } @test "x86_64: the case sets and clears pc" { @@ -89,6 +159,84 @@ assert_arch() assert_arch aarch64 virt 'cpumode:host-passthrough' } +# The machine type comes from the vmhost, because the vmhost is what refuses the domain. +# AlmaLinux 10 on the ppc64le vmhost declares pseries-5.0 to pseries-10.2 and no rhel machine +# type at all, so a name from the RHEL 7.6 era is rejected at define time. + +@test "ppc64le: the machine type is the alias the vmhost accepts" { + MACHINES='pseries pseries-10.2 pseries-9.2' + run vm_machine_type_for_arch ppc64le 192.0.2.10 + [ "$status" -eq 0 ] + [ "$output" = 'machine:pseries' ] +} + +@test "ppc64le: the vmhost accepts the machine type that comes back" { + local machine + MACHINES='pseries pseries-10.0 pseries-10.1 pseries-10.2' + machine="$(vm_machine_type_for_arch ppc64le 192.0.2.10)" + [ "${machine#machine:}" != "$machine" ] + run virsh domcapabilities --arch ppc64 --machine "${machine#machine:}" + [ "$status" -eq 0 ] +} + +@test "ppc64le: the libvirt default stands in when the vmhost refuses the alias" { + MACHINES='pseries-10.2' + DEFAULT_MACHINE='pseries-10.2' + run vm_machine_type_for_arch ppc64le 192.0.2.10 + [ "$status" -eq 0 ] + [ "$output" = 'machine:pseries-10.2' ] +} + +@test "ppc64le: the alias stands in when the vmhost cannot be reached" { + SSH_FAIL=1 + run vm_machine_type_for_arch ppc64le 192.0.2.10 + [ "$status" -eq 0 ] + [ "$output" = 'machine:pseries' ] +} + +@test "ppc64le: the alias stands in when the vmhost has no virsh" { + VIRSH_ABSENT=1 + run vm_machine_type_for_arch ppc64le 192.0.2.10 + [ "$status" -eq 0 ] + [ "$output" = 'machine:pseries' ] +} + +@test "ppc64el: the Debian architecture name gets the same machine type" { + MACHINES='pseries pseries-10.2' + run vm_machine_type_for_arch ppc64el 192.0.2.10 + [ "$status" -eq 0 ] + [ "$output" = 'machine:pseries' ] +} + +@test "apply asks the vmhost of the node about architecture ppc64" { + VMHOST=192.0.2.10 + MACHINES='pseries pseries-10.2' + set_vmother '' + vm_machine_type_main invalid cn1 + vm_machine_type_main apply cn1 ppc64le + [ "$(vmother)" = 'machine:pseries' ] + [ "$(sort -u "$SSH_TARGETS")" = '192.0.2.10' ] + [ "$(sort -u "$VIRSH_ARCHS")" = 'ppc64' ] +} + +@test "apply reads the local libvirt when the node names no vmhost" { + MACHINES='pseries pseries-10.2' + set_vmother '' + vm_machine_type_main invalid cn1 + vm_machine_type_main apply cn1 ppc64le + [ "$(vmother)" = 'machine:pseries' ] + [ ! -s "$SSH_TARGETS" ] + [ "$(sort -u "$VIRSH_ARCHS")" = 'ppc64' ] +} + +@test "x86_64: the machine type stays pc, which the vmhost accepts" { + MACHINES='pc pc-i440fx-rhel10.0.0 q35' + DEFAULT_MACHINE='pc-i440fx-rhel10.0.0' + run vm_machine_type_for_arch x86_64 192.0.2.10 + [ "$status" -eq 0 ] + [ "$output" = 'machine:pc' ] +} + # assert_round_trip -- the case ends with the exact value it started with. assert_round_trip() { From b37793400d26dfd0819a191e0712f72b2749ea2e Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Sat, 24 Oct 2026 05:38:14 -0300 Subject: [PATCH 2/6] fix(xcat-test): libvirt refuses the compute node machine type pseries-rhel7.6.0 reg_linux_diskless_installation_flat fails on every ppc64le cell. rpower boot leaves the compute node down and libvirt reports "unsupported configuration: Emulator '/usr/bin/qemu-system-ppc64' does not support machine type 'pseries-rhel7.6.0'". vm_machine_type_for_arch in vm_machine_type.sh answered machine:pseries-rhel7.6.0 for every ppc64 architecture. The ppc64le hypervisor runs AlmaLinux 10, whose qemu-system-ppc64 declares pseries-5.0 to pseries-10.2 and no rhel machine type, so the name the case writes cannot be defined there. The function now reads the vmhost of the node and asks that host's libvirt. It writes the plain alias when libvirt accepts it, that libvirt's own default when it does not, and the alias when the vmhost cannot be asked. x86_64 keeps machine:pc, which is an alias and stays valid. xCAT-test/bats/vm_machine_type.bats covers it. Nine of its tests fail on the previous commit, among them "the vmhost accepts the machine type that comes back" and "the machine type is the alias the vmhost accepts". Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- .../testcase/commoncmd/vm_machine_type.sh | 79 +++++++++++++++++-- 1 file changed, 73 insertions(+), 6 deletions(-) diff --git a/xCAT-test/autotest/testcase/commoncmd/vm_machine_type.sh b/xCAT-test/autotest/testcase/commoncmd/vm_machine_type.sh index 412a16c771..0f5914bdd2 100755 --- a/xCAT-test/autotest/testcase/commoncmd/vm_machine_type.sh +++ b/xCAT-test/autotest/testcase/commoncmd/vm_machine_type.sh @@ -33,17 +33,84 @@ vm_machine_type_private_dir() fi } -vm_machine_type_for_arch() +# alias -- the machine name qemu keeps pointed at the newest machine of a family. +vm_machine_type_alias() { case "$1" in - ppc64*) echo 'machine:pseries-rhel7.6.0' ;; - x86_64) echo 'machine:pc' ;; - riscv64) echo 'machine:virt' ;; - aarch64) echo 'machine:virt' ;; + ppc64*) echo 'pseries' ;; + x86_64) echo 'pc' ;; + riscv64) echo 'virt' ;; + aarch64) echo 'virt' ;; *) return 1 ;; esac } +# libvirt and qemu call the ppc64le guest architecture ppc64. A node on an +# Ubuntu cell names it ppc64el. +vm_machine_type_libvirt_arch() +{ + case "$1" in + ppc64*) echo 'ppc64' ;; + x86_64) echo 'x86_64' ;; + riscv64) echo 'riscv64' ;; + aarch64) echo 'aarch64' ;; + *) return 1 ;; + esac +} + +# virsh on , or here when is empty. kvm.pm reaches the vmhost over +# qemu+ssh://root@/system, so root can ssh there from this node. +vm_machine_type_virsh() +{ + local host="$1" + shift + if [ -n "$host" ]; then + ssh -o BatchMode=yes -o ConnectTimeout=10 -n "$host" virsh "$@" + else + virsh "$@" + fi +} + +# supported -- whether libvirt on accepts . +vm_machine_type_supported() +{ + vm_machine_type_virsh "$1" domcapabilities --arch "$2" --machine "$3" >/dev/null 2>&1 +} + +# default -- the machine type libvirt on uses for . +vm_machine_type_default() +{ + vm_machine_type_virsh "$1" domcapabilities --arch "$2" 2>/dev/null | + sed -n 's|.*\(.*\).*|\1|p' | head -n 1 +} + +# for_arch [] -- the machine type to write, as "machine:". +# +# The vmhost is what refuses the domain, so its libvirt picks the name: the plain +# alias when that libvirt accepts it, its own default when it does not, and the +# alias again when the vmhost cannot be asked. A versioned name does not survive +# a host upgrade -- no qemu on AlmaLinux 10 has a pseries-rhel machine type. +vm_machine_type_for_arch() +{ + local arch="$1" vmhost="${2-}" generic libvirt_arch name + + generic="$(vm_machine_type_alias "$arch")" || return 1 + libvirt_arch="$(vm_machine_type_libvirt_arch "$arch")" || return 1 + if vm_machine_type_supported "$vmhost" "$libvirt_arch" "$generic"; then + printf 'machine:%s\n' "$generic" + return + fi + name="$(vm_machine_type_default "$vmhost" "$libvirt_arch")" + printf 'machine:%s\n' "${name:-$generic}" +} + +# vmhost -- the host whose libvirt runs the guest, empty when unset. +vm_machine_type_vmhost() +{ + lsdef "$1" -i vmhost 2>/dev/null | + sed -n 's/^[[:space:]]*vmhost=//p' | head -n 1 +} + vm_machine_type_get() { local out @@ -109,7 +176,7 @@ vm_machine_type_apply() chdef "$node" "vmothersetting=$original" return fi - if ! machine="$(vm_machine_type_for_arch "$arch")"; then + if ! machine="$(vm_machine_type_for_arch "$arch" "$(vm_machine_type_vmhost "$node")")"; then echo "vm_machine_type.sh: no machine type for arch '$arch'" >&2 return 1 fi From 91e667211022b3bc7eaa27169d5820bda9053b8c Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Sat, 24 Oct 2026 20:36:08 -0300 Subject: [PATCH 3/6] fix(xcat-test): the diskless cases fail when the kernel mounts binfmt_misc The diskless cases snapshot the mount table before genimage and after it and require the two to be identical, ignoring only fusectl. The comparison is there to catch a bind mount genimage leaves inside the root image, which is worth catching. It also fails for mounts the kernel makes on its own. binfmt_misc is an autofs stub that becomes a real mount the first time a process reads /proc/sys/fs/binfmt_misc, and tracefs appears under /sys/kernel/debug the first time anything opens debugfs tracing. On openeuler22.03sp4 both appeared during genimage and failed reg_linux_diskless_installation_flat four minutes into a 1168 second case, while the provisioning that followed succeeded and the node reached booted. The single fusectl exclusion shows the same class was met once before and patched by name. mount_snapshot.sh drops the mounts whose mount POINT is under /proc or /sys, which is where the kernel keeps its on-demand mounts, and the three cases take their snapshots through it. Dropping them by filesystem TYPE would hide the leak the comparison exists for, because a leaked genimage bind is itself a proc or sysfs mount. fusectl needs no exclusion of its own any more. mount_snapshot.bats covers both directions. Taking the filter out fails the two ignore-the-kernel assertions and keeps both leak assertions; filtering by type instead of by mount point fails only the leaked-bind assertion. A test-only commit would skip rather than fail, because require_repo_file skips when the script is absent, so the proof is those two mutations. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- .../testcase/commoncmd/mount_snapshot.sh | 30 ++++++++ .../installation/SN_diskless_setup_case | 6 +- .../reg_linux_diskless_installation_flat | 12 +-- ...kless_installation_flat_postscripts_failed | 6 +- xCAT-test/bats/mount_snapshot.bats | 74 +++++++++++++++++++ 5 files changed, 116 insertions(+), 12 deletions(-) create mode 100755 xCAT-test/autotest/testcase/commoncmd/mount_snapshot.sh create mode 100644 xCAT-test/bats/mount_snapshot.bats diff --git a/xCAT-test/autotest/testcase/commoncmd/mount_snapshot.sh b/xCAT-test/autotest/testcase/commoncmd/mount_snapshot.sh new file mode 100755 index 0000000000..75460dc94c --- /dev/null +++ b/xCAT-test/autotest/testcase/commoncmd/mount_snapshot.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# +# mount_snapshot.sh [] +# +# Print the mount table without the kernel's own on-demand mounts, so the diskless cases can +# compare a snapshot taken before genimage with one taken after it. +# +# genimage bind mounts /proc, /sys and /dev inside the root image. A bind it fails to remove +# leaves the next image built on top of the host, so comparing the two snapshots is worth doing. +# +# What the comparison must not assert is that nothing else mounted anything meanwhile. +# binfmt_misc is an autofs stub that becomes a real mount the first time a process reads +# /proc/sys/fs/binfmt_misc, and tracefs appears under /sys/kernel/debug the first time anything +# opens debugfs tracing. Both are the kernel's doing and both can happen during genimage. On one +# openEuler 22.03 run both did, and the case failed four minutes in while the provisioning that +# followed succeeded. +# +# Filtering by filesystem type would hide the leak this guards, because a leaked genimage bind IS +# a proc or sysfs mount. The mount POINT separates them: the kernel keeps its on-demand mounts +# inside /proc and /sys, and a leaked bind sits under the root image directory. +# +# With a file argument, filter that file instead of asking the kernel, so the filter is testable. + +set -e + +if [ $# -ge 1 ]; then + cat -- "$1" +else + mount +fi | awk '$3 !~ /^\/(proc|sys)(\/|$)/' | sort diff --git a/xCAT-test/autotest/testcase/installation/SN_diskless_setup_case b/xCAT-test/autotest/testcase/installation/SN_diskless_setup_case index 9efe3f987d..d0e7b6d344 100644 --- a/xCAT-test/autotest/testcase/installation/SN_diskless_setup_case +++ b/xCAT-test/autotest/testcase/installation/SN_diskless_setup_case @@ -74,13 +74,13 @@ check:rc==0 cmd:osimage="__GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-netboot-service";otherpkglist=$(lsdef -t osimage $osimage -i otherpkglist -c|awk -F"=" '{print $2}'); cat $otherpkglist cmd:if [ ! -d /tmp/mountoutput ]; then mkdir -p /tmp/mountoutput; fi -cmd:mount |sort > /tmp/mountoutput/file.org +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/mount_snapshot.sh > /tmp/mountoutput/file.org cmd:genimage __GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-netboot-service check:rc==0 -cmd:mount |sort > /tmp/mountoutput/file.new -cmd:diff -y /tmp/mountoutput/file.org /tmp/mountoutput/file.new --ignore-matching-lines="fusectl" +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/mount_snapshot.sh > /tmp/mountoutput/file.new +cmd:diff -y /tmp/mountoutput/file.org /tmp/mountoutput/file.new check:rc==0 cmd:rm -rf /tmp/mountoutput diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat index b736721928..a38545435b 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat @@ -31,16 +31,16 @@ cmd:if [[ -f /test.synclist ]] ;then mv -f /test.synclist /test.synclist.bak;fi; cmd:echo "/test.synclist -> /test.synclist" > /test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/test.synclist check:rc==0 cmd:if [ ! -d /tmp/mountoutput ]; then mkdir -p /tmp/mountoutput; fi -cmd:mount |sort > /tmp/mountoutput/file.org +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/mount_snapshot.sh > /tmp/mountoutput/file.org cmd:cat /tmp/mountoutput/file.org cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu18.04.2" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ ppc64(el|le) ]] && [[ "__GETNODEATTR($$CN,mgt)__" =~ "kvm" ]] ; then mkdir -p /install/custom/netboot/ubuntu; sed -e 's@linux-image-generic-hwe-18.04@linux-image-generic@g' /install/custom/netboot/ubuntu/compute.ubuntu18.04.2.ppc64el.pkglist; chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute pkglist=/install/custom/netboot/ubuntu/compute.ubuntu18.04.2.ppc64el.pkglist; fi cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -p pkgdir="http://archive.ubuntu.com/ubuntu xenial universe main,http://archive.ubuntu.com/ubuntu xenial-updates universe main,http://security.ubuntu.com/ubuntu xenial-security main restricted";fi cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 -cmd:mount |sort > /tmp/mountoutput/file.new +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/mount_snapshot.sh > /tmp/mountoutput/file.new cmd:cat /tmp/mountoutput/file.new -cmd:diff /tmp/mountoutput/file.org /tmp/mountoutput/file.new --ignore-matching-lines="fusectl" +cmd:diff /tmp/mountoutput/file.org /tmp/mountoutput/file.new check:rc==0 cmd:rm -rf /tmp/mountoutput cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute @@ -148,16 +148,16 @@ cmd:if [[ -f /test.synclist ]] ;then mv -f /test.synclist /test.synclist.bak;fi; cmd:echo "/test.synclist -> /test.synclist" > /test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/test.synclist check:rc==0 cmd:if [ ! -d /tmp/mountoutput ]; then mkdir -p /tmp/mountoutput; fi -cmd:mount |sort > /tmp/mountoutput/file.org +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/mount_snapshot.sh > /tmp/mountoutput/file.org cmd:cat /tmp/mountoutput/file.org cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu18.04.2" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ ppc64(el|le) ]] && [[ "__GETNODEATTR($$CN,mgt)__" =~ "kvm" ]] ; then mkdir -p /install/custom/netboot/ubuntu; sed -e 's@linux-image-generic-hwe-18.04@linux-image-generic@g' /install/custom/netboot/ubuntu/compute.ubuntu18.04.2.ppc64el.pkglist; chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute pkglist=/install/custom/netboot/ubuntu/compute.ubuntu18.04.2.ppc64el.pkglist; fi cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -p pkgdir="http://archive.ubuntu.com/ubuntu xenial universe main,http://archive.ubuntu.com/ubuntu xenial-updates universe main,http://security.ubuntu.com/ubuntu xenial-security main restricted";fi cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 -cmd:mount |sort > /tmp/mountoutput/file.new +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/mount_snapshot.sh > /tmp/mountoutput/file.new cmd:cat /tmp/mountoutput/file.new -cmd:diff /tmp/mountoutput/file.org /tmp/mountoutput/file.new --ignore-matching-lines="fusectl" +cmd:diff /tmp/mountoutput/file.org /tmp/mountoutput/file.new check:rc==0 cmd:rm -rf /tmp/mountoutput diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_postscripts_failed b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_postscripts_failed index 41391a68f0..57064246ed 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_postscripts_failed +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_postscripts_failed @@ -35,15 +35,15 @@ cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arc check:rc==0 cmd:if [ ! -d /tmp/mountoutput ]; then mkdir -p /tmp/mountoutput; fi -cmd:mount |sort > /tmp/mountoutput/file.org +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/mount_snapshot.sh > /tmp/mountoutput/file.org cmd:cat /tmp/mountoutput/file.org cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -p pkgdir="http://archive.ubuntu.com/ubuntu xenial universe main,http://archive.ubuntu.com/ubuntu xenial-updates universe main,http://security.ubuntu.com/ubuntu xenial-security main restricted";fi cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 -cmd:mount |sort > /tmp/mountoutput/file.new +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/mount_snapshot.sh > /tmp/mountoutput/file.new cmd:cat /tmp/mountoutput/file.new -cmd:diff /tmp/mountoutput/file.org /tmp/mountoutput/file.new --ignore-matching-lines="fusectl" +cmd:diff /tmp/mountoutput/file.org /tmp/mountoutput/file.new check:rc==0 cmd:rm -rf /tmp/mountoutput cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute diff --git a/xCAT-test/bats/mount_snapshot.bats b/xCAT-test/bats/mount_snapshot.bats new file mode 100644 index 0000000000..b2b1fffc4d --- /dev/null +++ b/xCAT-test/bats/mount_snapshot.bats @@ -0,0 +1,74 @@ +#!/usr/bin/env bats +# +# Drive mount_snapshot.sh, which the diskless cases use to compare the mount table before and +# after genimage. The comparison exists to catch a bind mount genimage leaves inside the root +# image, and it must keep catching one. +# +# The snapshots below are real lines from an openEuler 22.03 management node. On that run +# binfmt_misc and tracefs appeared between the two snapshots and failed the case, so the first +# test holds down that they are ignored. The second test is the one that matters: a leaked +# genimage bind must still be reported, which is why filtering by filesystem type is wrong. + +load 'helpers/shell_source' + +ROOTIMG=/install/netboot/openeuler22.03sp4/x86_64/compute/rootimg + +setup() +{ + SCRIPT="$(require_repo_file 'xCAT-test/autotest/testcase/commoncmd/mount_snapshot.sh')" + BEFORE="${BATS_TEST_TMPDIR}/file.org" + AFTER="${BATS_TEST_TMPDIR}/file.new" + + cat >"$BEFORE" <>"$AFTER" <>"$AFTER" + + run diff <("$SCRIPT" "$BEFORE") <("$SCRIPT" "$AFTER") + [ "$status" -ne 0 ] + [[ "$output" == *"$ROOTIMG/proc"* ]] +} + +# An ordinary mount outside /proc and /sys is the other half of the same requirement. +@test "an NFS mount left behind is still reported" { + cp "$BEFORE" "$AFTER" + printf '192.0.2.1:/install on /mnt/install type nfs4 (rw,relatime)\n' >>"$AFTER" + + run diff <("$SCRIPT" "$BEFORE") <("$SCRIPT" "$AFTER") + [ "$status" -ne 0 ] + [[ "$output" == *"/mnt/install"* ]] +} + +@test "the snapshot keeps the real mounts and drops only the kernel's own" { + run "$SCRIPT" "$BEFORE" + [ "$status" -eq 0 ] + [[ "$output" == *" on / type xfs"* ]] + [[ "$output" == *" on /run type tmpfs"* ]] + [[ "$output" == *" on /dev type devtmpfs"* ]] + refute_grep -q ' on /proc ' <<<"$output" + refute_grep -q ' on /sys ' <<<"$output" + refute_grep -q '/sys/kernel/tracing' <<<"$output" +} From 0aefdb479b49ac4fec0350fd9bfc0b4c72e6391a Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Sun, 25 Oct 2026 21:13:33 -0300 Subject: [PATCH 4/6] test(xcat-test): a harness path beside an xCAT directory counts as an xCAT denial selinux_avc_check.sh decides which SELinux denials xCAT answers for by matching the audit record's path against XCAT_AVC_PATH. The match treats each entry as a string prefix, so a sibling directory whose name merely starts with one of them is kept. On build 2 of xcat-test-el10-x86_64-selinux the one denial the run attributed to xCAT was xcatd executing the CI's own notification hook under /var/lib/xcat-cluster-test, and selinux_cn_diskful_enforcing failed on it. The new bats test classifies that record and asserts nothing is kept. Two more assert the directories themselves and a file under one are still kept, so an over-anchored match does not pass silently. Without the fix 1 of 18 fails, and it is the sibling-path test. The other two pass before and after. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- xCAT-test/bats/selinux_avc_check.bats | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/xCAT-test/bats/selinux_avc_check.bats b/xCAT-test/bats/selinux_avc_check.bats index 060ec143b0..614a3c7135 100644 --- a/xCAT-test/bats/selinux_avc_check.bats +++ b/xCAT-test/bats/selinux_avc_check.bats @@ -66,6 +66,31 @@ SSH_RECORD='type=AVC msg=audit(1759000002.333:444): avc: denied { siginh } for [[ "$output" == *'comm="genimage"'* ]] } +# The hook cluster-test.pl registers with regnotif, executed by an xcatd worker. The +# harness wrote this file, not xCAT, and /var/lib/xcat-cluster-test is not /var/lib/xcat. +# Captured on build 2 of xcat-test-el10-x86_64-selinux, where it was the one denial the +# run attributed to xCAT and selinux_cn_diskful_enforcing failed on it. +HARNESS_RECORD='type=AVC msg=audit(1792858690.329:3003): avc: denied { execute_no_trans } for pid=51342 comm=78636174643A204442204163636573 path="/var/lib/xcat-cluster-test/event-notify.pl" dev="vda4" ino=75521321 scontext=system_u:system_r:xcat_t:s0 tcontext=unconfined_u:object_r:var_lib_t:s0 tclass=file permissive=1' + +@test "a path that merely starts with the name of an xCAT directory is not kept" { + run classify "$HARNESS_RECORD" + [ -z "$output" ] +} + +@test "an xCAT directory is kept when the path names the directory itself" { + local record='type=AVC msg=audit(1759000005.666:777): avc: denied { search } for pid=6789 comm="httpd" path="/install" dev="vda2" ino=56 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:default_t:s0 tclass=dir permissive=0' + run classify "$record" + [ "$status" -eq 0 ] + [[ "$output" == *'path="/install"'* ]] +} + +@test "a file under an xCAT directory is kept" { + local record='type=AVC msg=audit(1759000006.777:888): avc: denied { read } for pid=7890 comm="httpd" path="/var/lib/xcat/cert/server-cert.pem" dev="vda2" ino=57 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:var_lib_t:s0 tclass=file permissive=0' + run classify "$record" + [ "$status" -eq 0 ] + [[ "$output" == *'/var/lib/xcat/cert/server-cert.pem'* ]] +} + @test "a program whose name merely contains a kept word is not matched by accident" { local record='type=AVC msg=audit(1759000004.555:666): avc: denied { execute } for pid=5678 comm="systemd-udevd" scontext=system_u:system_r:udev_t:s0 tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=0' run classify "$record" From af66f78dfd05adc488e8e89d4d1dfc66c6267911 Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Sat, 24 Oct 2026 18:35:07 -0300 Subject: [PATCH 5/6] fix(xcat-core): Genesis on Ubuntu answers no ssh, so every case that reaches a node fails A compute node booted into legacy Genesis on Ubuntu refuses every ssh connection: [xcat100-mn]: xcat100-cn: ssh: connect to host xcat100-cn port 22: Connection refused and on the node's own console, once per boot: Missing privilege separation directory Debian and Ubuntu build sshd with --with-privsep-path=/run/sshd. The payload's own sshd carries that path and the format string "Missing privilege separation directory: %s", and the image ships /run holding only rpcbind. So sshd exits at startup and the node is unreachable. nodeset_shell, nodeset_cmdline, nodeset_runimg and genesis_boot_proof_legacy all fail on it, while seq_discovery, which needs no ssh, passes. doxcat already does this for the other family: it creates /usr/share/empty.sshd, the EL privsep path, with the comment "On some systems /usr/share/empty.sshd needs to be created before calling sshd". The Debian path was never added, although the tree knows about it twice -- remoteshell says "prepare the /var/run/sshd for ubuntu" and etc/init.d/functions creates it. This adds the same lines for /run/sshd and /var/run/sshd. Created immediately before sshd starts, not baked into the image: /run is a tmpfs on a running system, so a directory under it does not survive the mount. The mode is set whether or not the directory had to be created, because sshd refuses a group or world writable privsep directory with the SAME message as an absent one, so a wrong mode is indistinguishable from this bug. genesis_sshd_privsep.bats asserts what sshd imposes -- the path is a directory, owned by the user that will run sshd, and not group or world writable -- read at the moment sshd runs. The recorder is bound over /usr/sbin/sshd because doxcat calls that absolute path, and because recording from a later command cannot see the ORDER: with the recorder on a PATH command instead, moving the directories after the sshd line still passed. Five mutations, each red: removing the loop fails 2, never setting the mode fails 1, dropping /var/run/sshd fails 2, a group-writable mode fails 2, and creating the directories after sshd starts fails 2. The whole bats suite goes from 21 failures to 19 with this change, the difference being these two tests; the other 19 are unrelated and fail on the base. doxcat_sandbox.bash gains chmod, and a third test keeps the next one from being missed. The sandbox curates PATH without /usr/bin, so a command it does not copy resolves to nothing and fails SILENTLY: doxcat's chmod did nothing under test for as long as this sandbox has existed, and any assertion about a mode could never pass. The guard installs bash's command_not_found_handle through BASH_ENV and fails naming whatever doxcat invoked and could not resolve, so it needs no list to keep current. With chmod removed again it reports exactly "chmod". Its reach is the commands doxcat runs on the path the test drives, which is a floor rather than a completeness check on the helper's list. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- xCAT-genesis-scripts/usr/bin/doxcat | 12 ++ xCAT-test/bats/genesis_sshd_privsep.bats | 138 +++++++++++++++++++++ xCAT-test/bats/helpers/doxcat_sandbox.bash | 5 +- 3 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 xCAT-test/bats/genesis_sshd_privsep.bats diff --git a/xCAT-genesis-scripts/usr/bin/doxcat b/xCAT-genesis-scripts/usr/bin/doxcat index 2338e3337b..0e451050c2 100755 --- a/xCAT-genesis-scripts/usr/bin/doxcat +++ b/xCAT-genesis-scripts/usr/bin/doxcat @@ -100,6 +100,18 @@ fi if [ ! -e /usr/share/empty.sshd ]; then mkdir -p /usr/share/empty.sshd fi +# Debian and Ubuntu build sshd with --with-privsep-path=/run/sshd, and sshd exits with +# "Missing privilege separation directory" when it is absent. The image carries /run and not +# /run/sshd, so Genesis on Ubuntu answered no ssh and every case that reaches a booted node +# over xdsh failed. Created here rather than baked into the image: /run is a tmpfs on a +# running system, and a directory under it does not survive the mount. +# The mode is set whether or not the directory had to be created: sshd refuses a privsep +# directory that is group or world writable, with the same message, so a wrong mode looks +# exactly like an absent one. +for sshd_privsep in /run/sshd /var/run/sshd; do + mkdir -p "$sshd_privsep" + chmod 0755 "$sshd_privsep" +done echo 'Protocol 2' >> /etc/ssh/sshd_config /usr/sbin/sshd mkdir -p /etc/xcat diff --git a/xCAT-test/bats/genesis_sshd_privsep.bats b/xCAT-test/bats/genesis_sshd_privsep.bats new file mode 100644 index 0000000000..25f2f48f7f --- /dev/null +++ b/xCAT-test/bats/genesis_sshd_privsep.bats @@ -0,0 +1,138 @@ +#!/usr/bin/env bats +# +# The privilege separation directory sshd needs, at the moment doxcat starts sshd. +# +# Debian and Ubuntu build sshd with --with-privsep-path=/run/sshd. The Genesis image carries +# /run and not /run/sshd, so sshd exited with "Missing privilege separation directory" and the +# node answered no ssh at all. Every legacy Genesis case that reaches a booted node over xdsh +# failed on "Connection refused" while sequential discovery, which needs no ssh, passed. +# +# doxcat already did this for the other family -- it creates /usr/share/empty.sshd, the EL +# privsep path -- so this is the same line for Debian. The assertions are what SSHD IMPOSES, +# read at the moment sshd runs: the path is a directory, its owner is the user that will run +# sshd, and it is not group or world writable. sshd refuses a loose mode with the same message +# as an absent directory, so a wrong mode is indistinguishable from the bug. +# +# Read from inside the sandbox on purpose. /run there is a tmpfs, exactly as it is on a running +# system, so a directory made before that mount -- or baked into the image -- is not there when +# sshd starts and cannot be seen from outside afterwards. + +load 'helpers/doxcat_sandbox' + +PRIVSEP_PATHS='/run/sshd /var/run/sshd' + +# Record what each privsep path looks like AT THE MOMENT sshd runs. +# +# doxcat runs sshd as /usr/sbin/sshd, an absolute path, so a stub on PATH is never reached and +# the recorder is bound over that path instead. Recording from a later PATH command instead -- +# openssl is the next one -- cannot see the ORDER: moving the directories after the sshd line +# then passes, which is the one mutation that matters most here. +record_privsep() +{ + local stub="${BATS_TEST_TMPDIR}/sshd-recorder" + + cat >"$stub" <>/run/fixture/sshd-privsep + else + printf '%s absent\n' "\$d" >>/run/fixture/sshd-privsep + fi +done +exit 0 +SH + chmod 0755 "$stub" + sandbox+=(--ro-bind "$stub" /usr/sbin/sshd) +} + +seen() +{ + local path="$1" + awk -v p="$path" '$1 == p { print; exit }' "$fixture/sshd-privsep" +} + +@test "doxcat makes every privilege separation directory before it starts sshd" { + setup_doxcat + record_privsep + add_doxcat_link eth0 BROADCAST,MULTICAST,UP ether 02:bb:cc:dd:ee:ff + run_genesis 0 --setenv BOOTIF 01-02-bb-cc-dd-ee-ff + + # The recording ran, so it happened one statement after sshd was started. + [ -s "$fixture/sshd-privsep" ] + + for path in $PRIVSEP_PATHS; do + local line mode owner + line=$(seen "$path") + [ -n "$line" ] + [ "$(printf '%s\n' "$line" | cut -d' ' -f2)" = dir ] + mode=$(printf '%s\n' "$line" | cut -d' ' -f3) + owner=$(printf '%s\n' "$line" | cut -d' ' -f4) + # Owned by whoever runs sshd: root in Genesis, the invoking user here. ls in + # the sandbox has no passwd lookup, so the owner comes back numeric. + [ "$owner" = "$(id -u)" ] + # sshd refuses a group or world writable privsep directory. Positions 6 and 9 of the + # mode string are the group and other write bits. + [ "$(printf '%s\n' "$mode" | cut -c6)" = - ] + [ "$(printf '%s\n' "$mode" | cut -c9)" = - ] + done +} + +@test "a privilege separation directory left group writable is corrected, not kept" { + # The directory can already exist from an earlier boot with a mode sshd will not accept, + # and that failure prints the same message as an absent one. So the mode is set whether or + # not doxcat had to create the directory. + setup_doxcat + record_privsep + add_doxcat_link eth0 BROADCAST,MULTICAST,UP ether 02:bb:cc:dd:ee:ff + # /var is bound from the fixture, so this one survives into the sandbox. + mkdir -p "$fixture/var/run/sshd" + chmod 0777 "$fixture/var/run/sshd" + run_genesis 0 --setenv BOOTIF 01-02-bb-cc-dd-ee-ff + + local mode + mode=$(printf '%s\n' "$(seen /var/run/sshd)" | cut -d' ' -f3) + [ -n "$mode" ] + [ "$(printf '%s\n' "$mode" | cut -c6)" = - ] + [ "$(printf '%s\n' "$mode" | cut -c9)" = - ] +} + +@test "every command doxcat runs resolves inside the sandbox" { + # The sandbox curates PATH and does NOT include /usr/bin, so a command it does not copy + # resolves to nothing. That fails silently: doxcat's chmod did nothing under test for as + # long as this sandbox has existed, and an assertion about a mode could never pass. The + # mode half of the privsep fix was unmeasurable until chmod was added to the helper. + # + # Derived, not a list: bash calls command_not_found_handle for anything it cannot resolve, + # so this records whatever doxcat actually invokes and goes missing. A list here would go + # stale the next time doxcat gains a command. + # + # Its reach is the commands doxcat runs ON THE PATH THIS TEST DRIVES, which is not every + # command in the script -- a branch this boot does not take is not covered. It is a floor, + # not a completeness check on the helper's list. + setup_doxcat + record_privsep + local env_file="${BATS_TEST_TMPDIR}/bash_env" + cat >"$env_file" <<'SH' +command_not_found_handle() +{ + printf '%s\n' "$1" >>/run/fixture/not-found + return 127 +} +SH + sandbox+=(--ro-bind "$env_file" /run/bash_env --setenv BASH_ENV /run/bash_env) + add_doxcat_link eth0 BROADCAST,MULTICAST,UP ether 02:bb:cc:dd:ee:ff + run_genesis 0 --setenv BOOTIF 01-02-bb-cc-dd-ee-ff + + # The handler was installed, so an absence would have been recorded. + [ -s "$fixture/sshd-privsep" ] + if [ -e "$fixture/not-found" ]; then + printf 'doxcat runs commands the sandbox does not provide:\n%s\n' \ + "$(sort -u "$fixture/not-found")" >&2 + return 1 + fi +} diff --git a/xCAT-test/bats/helpers/doxcat_sandbox.bash b/xCAT-test/bats/helpers/doxcat_sandbox.bash index cbab15c095..559de3aa81 100644 --- a/xCAT-test/bats/helpers/doxcat_sandbox.bash +++ b/xCAT-test/bats/helpers/doxcat_sandbox.bash @@ -10,8 +10,11 @@ setup_doxcat() fips=$(repo_path xCAT-genesis-scripts/usr/lib/xcat/fips.sh) [ -r "$fips" ] mkdir -p "$fixture"/{etc/ssh,etc/pki/tls,real,links,addrs} + # chmod is in this list because doxcat runs it: the sandbox has no /usr/bin on PATH, so a + # command that is missing here is a command that silently does nothing under test. doxcat's + # chmod of the sshd privilege separation directory was not exercised until it was added. for utility in bash sh cat cp awk grep sed sort tr tail rm wc cut head uname \ - timeout env ls mkdir touch readlink basename sleep; do + timeout env ls mkdir touch readlink basename sleep chmod; do cp -L "$(PATH=/usr/bin:/bin type -P "$utility")" "$fixture/bin/$utility" done if [ -x /usr/bin/coreutils ]; then From 65f4de2c6b34d452df05d7a26687e772cbf81a32 Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Sun, 25 Oct 2026 21:13:46 -0300 Subject: [PATCH 6/6] fix(xcat-test): a path that only starts with an xCAT directory name is counted as xCAT selinux_avc_classify matched the entries of XCAT_AVC_PATH as string prefixes, with [^"]* before the alternation and no boundary after it. A directory name is not a string prefix: /var/lib/xcat-cluster-test is not /var/lib/xcat, and /installer is not /install. The CI writes its regnotif notification hook to /var/lib/xcat-cluster-test/event-notify.pl. xcatd executes it, the file carries var_lib_t, and xcat_t has no execute_no_trans on it, so the audit log holds the record. The classifier kept it on the strength of the prefix, the count read XCAT_AVC=1, and selinux_cn_diskful_enforcing failed on a file the product does not ship. The policy was confining xcat_t correctly. The path half of the pattern now starts at the opening quote and ends at a / or at the closing quote, so a listed directory matches itself and the files under it, and nothing else. The subject half is unchanged: a denial by an xCAT program is still kept whatever the path. selinux_avc_check.bats covers it. Reverting the boundary group fails the sibling-path test alone; requiring a trailing / fails the bare-directory test alone. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- xCAT-test/autotest/testcase/commoncmd/selinux_avc_check.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/commoncmd/selinux_avc_check.sh b/xCAT-test/autotest/testcase/commoncmd/selinux_avc_check.sh index ffe4357bd1..9968a0c254 100755 --- a/xCAT-test/autotest/testcase/commoncmd/selinux_avc_check.sh +++ b/xCAT-test/autotest/testcase/commoncmd/selinux_avc_check.sh @@ -40,9 +40,13 @@ XCAT_AVC_COMM='xcatd|genimage|packimage|nodeset|mknb|makedhcp|makedns|makehosts|makeknownhosts|copycds|liteimg|xdsh|xdcp|xcatprobe|xcatconfig' XCAT_AVC_PATH='/opt/xcat|/xcatpost|/tftpboot|/install|/var/log/xcat|/etc/xcat|/var/lib/xcat' +# The path must be one of those directories, or a file under one. A directory name is +# not a string prefix: /var/lib/xcat-cluster-test holds the CI's own notification hook, +# and matching it as /var/lib/xcat put an xcatd denial on a harness file into the count. +# So the name starts at the quote and ends at a / or at the closing quote. selinux_avc_classify() { - grep -E "(comm|exe)=\"[^\"]*(${XCAT_AVC_COMM})[^\"]*\"|(path|name)=\"[^\"]*(${XCAT_AVC_PATH})" + grep -E "(comm|exe)=\"[^\"]*(${XCAT_AVC_COMM})[^\"]*\"|(path|name)=\"(${XCAT_AVC_PATH})(/|\")" } # Report the denials ausearch answered with. An error message is not a clean window: