diff mbox series

[bpf-next] selftests/bpf: workaround stdout issue in VM launched by vmtest.sh

Message ID 20220223000544.3524440-1-fallentree@fb.com (mailing list archive)
State Changes Requested
Delegated to: BPF
Headers show
Series [bpf-next] selftests/bpf: workaround stdout issue in VM launched by vmtest.sh | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for bpf-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 10 maintainers not CCed: linux-kselftest@vger.kernel.org kpsingh@kernel.org daniel@iogearbox.net john.fastabend@gmail.com kafai@fb.com shuah@kernel.org songliubraving@fb.com ast@kernel.org yhs@fb.com netdev@vger.kernel.org
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-next-PR fail PR summary
bpf/vmtest-bpf-next fail VM_Test

Commit Message

Yucong Sun Feb. 23, 2022, 12:05 a.m. UTC
This apply a workaround to fix stdout issue in `./vmtest.sh` invocations,
but doesn't work on `./vmtest.sh -s`

Signed-off-by: Yucong Sun <fallentree@fb.com>
---
 tools/testing/selftests/bpf/vmtest.sh | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Song Liu Feb. 23, 2022, 5:18 a.m. UTC | #1
On Tue, Feb 22, 2022 at 4:06 PM Yucong Sun <fallentree@fb.com> wrote:
>
> This apply a workaround to fix stdout issue in `./vmtest.sh` invocations,
> but doesn't work on `./vmtest.sh -s`
>
> Signed-off-by: Yucong Sun <fallentree@fb.com>

Could you please provide more information about the issue?

> ---
>  tools/testing/selftests/bpf/vmtest.sh | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/vmtest.sh b/tools/testing/selftests/bpf/vmtest.sh
> index e0bb04a97e10..a9f943a84ed5 100755
> --- a/tools/testing/selftests/bpf/vmtest.sh
> +++ b/tools/testing/selftests/bpf/vmtest.sh
> @@ -184,6 +184,10 @@ EOF
>         fi
>
>         sudo bash -c "echo '#!/bin/bash' > ${init_script}"
> +       sudo bash -c "cat >>${init_script}" <<EOF
> +# Force rebinding stdout/stderr to /dev/ttyS0, to workaround a mysterious issue
> +exec 1>/dev/ttyS0 2>/dev/ttyS0
> +EOF
>
>         if [[ "${command}" != "" ]]; then
>                 sudo bash -c "cat >>${init_script}" <<EOF
> --
> 2.30.2
>
sunyucong@gmail.com Feb. 23, 2022, 7:02 p.m. UTC | #2
> Could you please provide more information about the issue?

Still trying to get to the root cause of this issue, I've found that
after https://github.com/kernel-patches/bpf/commit/cb80ddc67152e72f28ff6ea8517acdf875d7381d
, the init process would lose stdout on startup .

ls -lah /proc/1/fd/0 /proc/1/fd/1 /proc/1/fd/2 /proc/1/fd/6 /proc/1/fd/7
lrwx------1 root root 64 Feb 23 17:20 /proc/1/fd/0 -> /dev/null
lrwx------ 1 root root 64 Feb 23 17:20 /proc/1/fd/1 -> /dev/null
lrwx------ 1 root root 64 Feb 23 17:20 /proc/1/fd/2 -> /dev/console
lrwx------ 1 root root 64 Feb 23 17:20 /proc/1/fd/6 -> /dev/console
lrwx------ 1 root root 64 Feb 23 17:20 /proc/1/fd/7 -> /dev/console

and same command on the good commit
ls -lah /proc/1/fd/0 /proc/1/fd/1 /proc/1/fd/2
lrwx------ 1 root root 64 Feb 23 17:23 /proc/1/fd/0 -> /dev/console
lrwx------ 1 root root 64 Feb 23 17:23 /proc/1/fd/1 -> /dev/console
lrwx------ 1 root root 64 Feb 23 17:23 /proc/1/fd/2 -> /dev/console

This patch is merely a workaround until we find and fix the real issue.

Cheers.
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/vmtest.sh b/tools/testing/selftests/bpf/vmtest.sh
index e0bb04a97e10..a9f943a84ed5 100755
--- a/tools/testing/selftests/bpf/vmtest.sh
+++ b/tools/testing/selftests/bpf/vmtest.sh
@@ -184,6 +184,10 @@  EOF
 	fi
 
 	sudo bash -c "echo '#!/bin/bash' > ${init_script}"
+	sudo bash -c "cat >>${init_script}" <<EOF
+# Force rebinding stdout/stderr to /dev/ttyS0, to workaround a mysterious issue
+exec 1>/dev/ttyS0 2>/dev/ttyS0
+EOF
 
 	if [[ "${command}" != "" ]]; then
 		sudo bash -c "cat >>${init_script}" <<EOF