public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Wei Gao <wegao@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 2/2] mq_timedreceive01: Workaround segfault on libc variant on 32 bit
Date: Thu, 14 Nov 2024 15:53:01 +0100	[thread overview]
Message-ID: <20241114145301.GA349678@pevik> (raw)
In-Reply-To: <ZzQWRTZTrWWMDNDv@wegao>

Hi all,

> On Tue, Nov 12, 2024 at 06:18:31PM +0100, Petr Vorel wrote:
> > EFAULT test segfaults on newer kernels (e.g. 6.4) on libc variant on
> > 32bit.  Similarly to 1d4d5a0750 use typical LTP workaround to test by
> > forked child + checking the terminating signal.

...
> > +	unsigned int j;
> > +	unsigned int prio;

> >  	if (tc->invalid_msg)
> >  		len -= 1;
> > @@ -208,6 +192,60 @@ static void do_test(unsigned int i)
> >  			TST_RET, prio, len);
> >  }

> > +static void test_bad_addr(unsigned int i)
> > +{
> > +	struct time64_variants *tv = &variants[tst_variant];
> > +	pid_t pid;
> > +	int status;
> > +
> > +	pid = SAFE_FORK();
> > +	if (!pid) {
> > +		verify_mqt_receive(i, pid);
> > +		_exit(0);
> nit:
> If this is a normal exit, i suggest use s/_exit(0)/exit(0) ?

I copy pasted this from similar tests. IMHO both should work. According to man
exit() calls functions registered with atexit() and _exit(), _exit() just
immediately terminates the process. Any open file descriptors belonging to the process are closed.

@Jan, @Cyril Please correct me if I'm wrong.

Kind regards,
Petr

> > +	}
> > +
> > +	SAFE_WAITPID(pid, &status, 0);
> > +
> > +	if (WIFEXITED(status) && !WEXITSTATUS(status))
> > +		return;
> > +
> > +	if (tv->ts_type == TST_LIBC_TIMESPEC &&
> > +		WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV) {
> > +		tst_res(TPASS, "Child killed by expected signal");
> > +		return;
> > +	}
> > +
> > +	tst_res(TFAIL, "Child %s", tst_strstatus(status));
> > +}
...

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2024-11-14 14:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-12 17:18 [LTP] [PATCH 1/2] mq_timedreceive01: Fix different signedness error on 32bit Petr Vorel
2024-11-12 17:18 ` [LTP] [PATCH 2/2] mq_timedreceive01: Workaround segfault on libc variant on 32 bit Petr Vorel
2024-11-13  3:00   ` Wei Gao via ltp
2024-11-14 14:53     ` Petr Vorel [this message]
2024-11-15 12:57       ` Jan Stancek
2024-11-26 14:31   ` Cyril Hrubis
2024-11-26 18:32     ` Petr Vorel
2024-11-13  1:37 ` [LTP] [PATCH 1/2] mq_timedreceive01: Fix different signedness error on 32bit Wei Gao via ltp
2024-11-26 14:29 ` Cyril Hrubis

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=20241114145301.GA349678@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=wegao@suse.com \
    /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