BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next] selftests/bpf: workaround stdout issue in VM launched by vmtest.sh
@ 2022-02-23  0:05 Yucong Sun
  2022-02-23  5:18 ` Song Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Yucong Sun @ 2022-02-23  0:05 UTC (permalink / raw)
  To: bpf; +Cc: andrii, fallentree, sunyucong

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(+)

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next] selftests/bpf: workaround stdout issue in VM launched by vmtest.sh
  2022-02-23  0:05 [PATCH bpf-next] selftests/bpf: workaround stdout issue in VM launched by vmtest.sh Yucong Sun
@ 2022-02-23  5:18 ` Song Liu
  2022-02-23 19:02   ` sunyucong
  0 siblings, 1 reply; 3+ messages in thread
From: Song Liu @ 2022-02-23  5:18 UTC (permalink / raw)
  To: Yucong Sun; +Cc: bpf, Andrii Nakryiko, sunyucong

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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next] selftests/bpf: workaround stdout issue in VM launched by vmtest.sh
  2022-02-23  5:18 ` Song Liu
@ 2022-02-23 19:02   ` sunyucong
  0 siblings, 0 replies; 3+ messages in thread
From: sunyucong @ 2022-02-23 19:02 UTC (permalink / raw)
  To: Song Liu; +Cc: Yucong Sun, bpf, Andrii Nakryiko

> 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-23 19:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-23  0:05 [PATCH bpf-next] selftests/bpf: workaround stdout issue in VM launched by vmtest.sh Yucong Sun
2022-02-23  5:18 ` Song Liu
2022-02-23 19:02   ` sunyucong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox