From nobody Mon Apr 6 23:08:23 2026 Received: from mail-yw1-f179.google.com (mail-yw1-f179.google.com [209.85.128.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D2AC3630B5 for ; Tue, 17 Mar 2026 22:09:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773785387; cv=none; b=sy7c5MiLupVt82wyWm4CYSQnBcCP5vWyfgAkCE6cP8RsErmpdEoXmp5pPhGzV7f7AZ4gzag6tz5iWBaGHymQXm3+tDFI+GQwtf2eH5eGu5D7Ea3CVNbMdh8J4Fs4L9ukgpwAIX3Vxf1qaI/fgiuW+seiv52ceC8jmw76Yx8RS28= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773785387; c=relaxed/simple; bh=b+CHW6D+Tes3tWuDt2z0es3oTuQs3Fq7ETrR7tgvf/U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Y6UUowqdf27EHVueNO0g2OD+A7US+OI/Gd7o23FeQd+wsQgG0GbOwxJQBPh4JAdbX3zBilul/WKrJD7BfgGo7LNCrspRZnQNsXliyS9vL+1dimvVrtJM85FeVhf3lHDG0cyOII0z6CsMD8JCr+cZkA79XWaPLivb0UosejtWvJw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ThwnO0+Q; arc=none smtp.client-ip=209.85.128.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ThwnO0+Q" Received: by mail-yw1-f179.google.com with SMTP id 00721157ae682-7982c3b7dfcso59853397b3.0 for ; Tue, 17 Mar 2026 15:09:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773785384; x=1774390184; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=vpW8gynkMYuHb0nRn7cLLL0m7fiOcOBnsG4vYKWVvhU=; b=ThwnO0+Q1lO3HCL59UulCoQuYvAvR5chFdDDMd+m7rkQZhVRwD5SukQIbvaZLssAkw tbnS7h/k7WqDSq5cNv43Cm/JFZfmRjizxMYSIQpIRgBU99RQVX0q7v8+Vzc9S5WiYej+ oXeV/p83OZ6D5+x1o2ONH32ZS5Ng3F8ABVF5aa8XCHY8agqs1AFKrd2YaGsKhDLSAhUd wBwBosrR/uD2Z9VlUkYy9OEM8AbXbQfPIGbm27dVO6EUWhAHcsr7p2wyzuO7EOaUorF9 o4DyiKHxjz//2ivg0S2OUOeYlLzWsw/yvv5QEOnzvODt/nEilZHG7AFDwKBA31uoPzwI WHhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773785384; x=1774390184; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=vpW8gynkMYuHb0nRn7cLLL0m7fiOcOBnsG4vYKWVvhU=; b=UGjSVre0N7NuH35T2mFkzsEY8O7C0KJyHCs8fraNkRrdbr99be6mJrAl/jlJ4WNP9K a2MsTzNsOjoBYPPos8AW3QVL0+fWUtnqwJPqYklKy23ljwJ2zCmKNL36pjYFUd6Vovyy KqHX1rEL4dLMUOqv6YDayMs/OhC0wpU6SRx7Di/9XsygTYhrIrtlbzxuIQbzI4QNkosk 0bwwFMH01f4jd19rnBgFJ/BVFj/0OvObtOfsYM6KnKR+MD1UXbAmszmK2n9N0o2SfH6Z 0283Z/8a4Skm2QRxB3uHOU6+Sj2RhD1XNEkvG2hIDVXZvMbvX+XsehEjMhMaM8/gGJu8 uqxQ== X-Forwarded-Encrypted: i=1; AJvYcCU0lN/VJan58Ys9ySxjEMYYhHWD536vN835Yzlt/xfpu5FzM74D4EILq7OByl0d8CDueVAofyb7YBgyBT8=@vger.kernel.org X-Gm-Message-State: AOJu0YxFahpKhUT1Gh0PCWj4ic6wH+w1iOS9wwT6D+HPEEO7Y4gVUogP LhucxWNLRh1UU+Z3BeNrzUrdjiwoLBzfZQwMrcpzZ8vNMiXgupkGsYESeGT1pQ== X-Gm-Gg: ATEYQzw92IzzbY9UFq96XAYarXD0TH/4jBQ4N9lVSebJr8a8asPLgxbeQT6gpcJF/oP raaNxj+Lvs39UE31cBa4aFWIQI0fdGGG5AAs8rkDBMYwD3gvCnZ6Lras7rGRgMpXoxGQGfVL8uc DNq0qcWDjunsytduraN0hG5tY0RFJ07X7beG/kVSYjho3ohg85wl2MK6E+j6aPCByDN0SNvUnk4 dvmX/P9LpzPeQvBb33Y/Ma5oR+EG2aOxFb8iwH/ll/gDCLSOiexfTntAj9zx6U7GRDXruMEijYt yKeUlJTUyYKeHpMi1A74x8rtjlGdu+iNJSDNjHLIOVLWZGcLKpl4AXEJjG5e0rY1lW0283FgrUY G/0K+hZX8jtDWFEoIiwv9SUVlrgS8PO8NuCJ6++e8BA69EPZ2iIEXEhxlPI4oNBGiwFmM7gBP5+ 6rcFRTtQ8QLfgDiKaQZI/07g== X-Received: by 2002:a05:690c:c50d:b0:79a:5164:bb08 with SMTP id 00721157ae682-79a7181bd39mr11782367b3.8.1773785384400; Tue, 17 Mar 2026 15:09:44 -0700 (PDT) Received: from localhost ([2a03:2880:25ff:45::]) by smtp.gmail.com with ESMTPSA id 00721157ae682-79a713f31b8sm6186507b3.18.2026.03.17.15.09.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2026 15:09:44 -0700 (PDT) From: Bobby Eshleman Date: Tue, 17 Mar 2026 15:09:35 -0700 Subject: [PATCH net-next v2 1/2] selftests/vsock: fix vmtest.sh for read-only nested VM runners Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260317-vsock-vmtest-nested-fixes-v2-1-0b3f53b80a0f@meta.com> References: <20260317-vsock-vmtest-nested-fixes-v2-0-0b3f53b80a0f@meta.com> In-Reply-To: <20260317-vsock-vmtest-nested-fixes-v2-0-0b3f53b80a0f@meta.com> To: Stefano Garzarella , Shuah Khan Cc: virtualization@lists.linux.dev, netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Jakub Kicinski , Bobby Eshleman X-Mailer: b4 0.14.3 From: Bobby Eshleman When running vmtest.sh inside a nested VM, there occurs a problem with stacking two sets of virtiofs/overlay layers (the first set from the outer VM and the second set from the inner VM). The virtme init scripts (sshd, udhcpd, etc...) fail to execute basic programs (e.g., /bin/cat) and load library dependencies (e.g., libpam) due to ESTALE. This only occurs when both layers (outer and inner) use virtiofs. Work around this by using 9p in the inner VM via --force-9p. Additionally, when the outer VM is read-only, the inner VM's attempt at populating SSH keys to the root filesystem fails: virtme-ng-init: mkdir: cannot create directory '/root/.cache': Read-only fi= le system Work around this by creating a temporary home directory with generated SSH keys and passing it through to the guest as /root via --rwdir. Disable strict host key checking in vm_ssh() since the VM will be seen as a new host each run. The --rw arg had to be removed to prevent a vng complaint about overlay (in combination with the other parameters). The guest doesn't really need write access anyway, so this was probably overly permissive to begin with. Signed-off-by: Bobby Eshleman --- tools/testing/selftests/vsock/vmtest.sh | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/vsock/vmtest.sh b/tools/testing/selfte= sts/vsock/vmtest.sh index 86e338886b33..a4b56322ce9b 100755 --- a/tools/testing/selftests/vsock/vmtest.sh +++ b/tools/testing/selftests/vsock/vmtest.sh @@ -42,6 +42,8 @@ readonly KERNEL_CMDLINE=3D"\ virtme.ssh virtme_ssh_channel=3Dtcp virtme_ssh_user=3D$USER \ " readonly LOG=3D$(mktemp /tmp/vsock_vmtest_XXXX.log) +readonly TEST_HOME=3D"$(mktemp -d /tmp/vmtest_home_XXXX)" +readonly SSH_KEY_PATH=3D"${TEST_HOME}"/.ssh/id_ed25519 =20 # Namespace tests must use the ns_ prefix. This is checked in check_netns(= ) and # is used to determine if a test needs namespace setup before test executi= on. @@ -257,7 +259,12 @@ vm_ssh() { =20 shift =20 - ${ns_exec} ssh -q -o UserKnownHostsFile=3D/dev/null -p "${SSH_HOST_PORT}"= localhost "$@" + ${ns_exec} ssh -q \ + -i "${SSH_KEY_PATH}" \ + -o UserKnownHostsFile=3D/dev/null \ + -o StrictHostKeyChecking=3Dno \ + -p "${SSH_HOST_PORT}" \ + localhost "$@" =20 return $? } @@ -265,6 +272,7 @@ vm_ssh() { cleanup() { terminate_pidfiles "${!PIDFILES[@]}" del_namespaces + rm -rf "${TEST_HOME}" } =20 check_args() { @@ -382,6 +390,11 @@ handle_build() { popd &>/dev/null } =20 +setup_home() { + mkdir -p "$(dirname "${SSH_KEY_PATH}")" + ssh-keygen -t ed25519 -f "${SSH_KEY_PATH}" -N "" -q +} + create_pidfile() { local pidfile =20 @@ -451,11 +464,14 @@ vm_start() { --run \ ${kernel_opt} \ ${verbose_opt} \ + --rwdir=3D/root=3D"${TEST_HOME}" \ + --force-9p \ + --cwd /root \ --qemu-opts=3D"${qemu_opts}" \ --qemu=3D"${qemu}" \ --user root \ --append "${KERNEL_CMDLINE}" \ - --rw &> ${logfile} & + &> ${logfile} & =20 timeout "${WAIT_QEMU}" \ bash -c 'while [[ ! -s '"${pidfile}"' ]]; do sleep 1; done; exit 0' @@ -1532,6 +1548,7 @@ check_deps check_vng check_socat handle_build +setup_home =20 echo "1..${#ARGS[@]}" =20 --=20 2.52.0