public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] getcpu: Add testcase for EFAULT
Date: Thu, 1 Aug 2024 11:41:08 +0200	[thread overview]
Message-ID: <20240801094108.GB1487933@pevik> (raw)
In-Reply-To: <ZqtQCpA2MCZLeC-x@rei>

> Hi!
> > > +static void run(void)
> > > +{
> > > +	unsigned int cpu_id, node_id = 0;
> > > +
> > > +	TST_EXP_FAIL(getcpu(tst_get_bad_addr(NULL), &node_id), EFAULT);
> > I'm not sure why, but I get SIGSEGV due tst_get_bad_addr(NULL) on various
> > kernels (SLES 5.14.21, Tumbleweed 6.5.1, 6.10, Debian 6.9, ...).

> > But the test works on SLES 4.4.180.

> If you are getting SIGSEGV that means that the address is used in
> userspace. Looking at man getcpu() it suggests that on some
> architectures it may be implemented as VDSO, which would explain it.

> So I suppose that the easies solution here would be to run the test in a
> child process and accepting SIGSEGV as a correct outcome as well.

Thanks, Cyril.

Ma Xinjian, could you please send another version?

You can get inspiration in:
testcases/kernel/syscalls/setrlimit/setrlimit05.c

Or in others:
$ git grep -l .forks_child $(git grep -l SIGSEGV)

Kind regards,
Petr

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

      reply	other threads:[~2024-08-01  9:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-17  2:27 [LTP] [PATCH] getcpu: Add testcase for EFAULT Ma Xinjian via ltp
2024-07-17 14:01 ` Cyril Hrubis
2024-07-18  6:55   ` [LTP] [PATCH v2] " Ma Xinjian via ltp
2024-07-29 22:57     ` Petr Vorel
2024-08-01  9:06       ` Cyril Hrubis
2024-08-01  9:41         ` Petr Vorel [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=20240801094108.GB1487933@pevik \
    --to=pvorel@suse.cz \
    --cc=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