From: Kees Cook <keescook@chromium.org>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
jcmvbkbc@gmail.com
Subject: Re: [PATCH] selftests/harness: Flush stdout before forking
Date: Thu, 17 Sep 2020 15:07:35 -0700 [thread overview]
Message-ID: <202009171506.7147F47FE@keescook> (raw)
In-Reply-To: <20200917041519.3284582-1-mpe@ellerman.id.au>
On Thu, Sep 17, 2020 at 02:15:19PM +1000, Michael Ellerman wrote:
> The test harness forks() a child to run each test. Both the parent and
> the child print to stdout using libc functions. That can lead to
> duplicated (or more) output if the libc buffers are not flushed before
> forking.
>
> It's generally not seen when running programs directly, because stdout
> will usually be line buffered when it's pointing to a terminal.
>
> This was noticed when running the seccomp_bpf test, eg:
>
> $ ./seccomp_bpf | tee test.log
> $ grep -c "TAP version 13" test.log
> 2
Oh thank you for tracking this down! I thought seccomp wasn't killing a
child or something, and hadn't found it yet. :)
Acked-by: Kees Cook <keescook@chromium.org>
--
Kees Cook
prev parent reply other threads:[~2020-09-17 22:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-17 4:15 [PATCH] selftests/harness: Flush stdout before forking Michael Ellerman
2020-09-17 4:53 ` Max Filippov
2020-09-17 12:58 ` Shuah Khan
2020-09-17 16:51 ` Shuah Khan
2020-09-17 22:06 ` Kees Cook
2020-09-18 3:37 ` Michael Ellerman
2020-09-18 14:32 ` Shuah Khan
2020-09-17 22:07 ` Kees Cook [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202009171506.7147F47FE@keescook \
--to=keescook@chromium.org \
--cc=jcmvbkbc@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mpe@ellerman.id.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).