public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] lib: fputs() in print_result() is not signal safe
Date: Fri, 21 Feb 2020 17:29:04 +0100	[thread overview]
Message-ID: <20200221162903.GA26343@rei.lan> (raw)
In-Reply-To: <bac938d8a2d57653b9f22e55c6d222a990b6a5cf.1582301521.git.jstancek@redhat.com>

Hi!
> We have tests that use tst_res() from signal handler and current
> implementation leads to rare hangs if signal arrives in bad time:
>   main
>    tst_run_tcases
>     fork_testrun
>      testrun
>       run_tests
>        run
>         tst_res_ -> TINFO from main process
>          tst_vres_
>           print_result
>            fputs
>             __lll_lock_wait_private
>             <signal handler called>
>              tst_res_ -> TINFO from signal handler
>               tst_vres_
>                print_result
>                 fputs
>                  __lll_lock_wait_private -> HANGS
> 
> One example is timer_settime01, where we have TPASS from main process
> and TINFO as response to SIGALRM. SIGALRM happening immediately on older
> kernels might be a bug, but that is beside the point of this patch.

I guess that tst_res() wasn't even supposed to be signal-async-safe but
looking at the code I guess that this is the only change needed to make
it so.

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2020-02-21 16:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-21 16:12 [LTP] [PATCH] lib: fputs() in print_result() is not signal safe Jan Stancek
2020-02-21 16:29 ` Cyril Hrubis [this message]
2020-02-25  7:35 ` Petr Vorel
2020-02-25  8:40   ` Jan Stancek

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=20200221162903.GA26343@rei.lan \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /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