linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe-Gsx/Oe8HsFggBc27wqDAHg@public.gmane.org>
To: David Drysdale <drysdale-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Cc: "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Linux API <linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Geert Uytterhoeven
	<geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>,
	Shuah Khan <shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>,
	davej-rdkfGonbjUTCLXcRTR1eJlpr/1R2p/CL@public.gmane.org
Subject: Re: [PATCH] selftests/exec: Check if the syscall exists and bail if not
Date: Fri, 23 Jan 2015 17:01:26 +1100	[thread overview]
Message-ID: <1421992886.24984.17.camel@ellerman.id.au> (raw)
In-Reply-To: <CAHse=S_AWuY4YG7DJeU+Rma-kPuQLGZH2oqVV27RvF4unu61Aw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Wed, 2015-01-21 at 10:22 +0000, David Drysdale wrote:
> On Wed, Jan 21, 2015 at 7:41 AM, Michael Ellerman <mpe-Gsx/Oe8HsFggBc27wqDAHg@public.gmane.org> wrote:
> > On systems which don't implement sys_execveat(), this test produces a
> > lot of output.
> >
> > Add a check at the beginning to see if the syscall is present, and if
> > not just note one error and return.
> 
> Good point, thanks.
> 
> > diff --git a/tools/testing/selftests/exec/execveat.c b/tools/testing/selftests/exec/execveat.c
> > index e238c9559caf..b87e4a843bea 100644
> > --- a/tools/testing/selftests/exec/execveat.c
> > +++ b/tools/testing/selftests/exec/execveat.c
> > @@ -234,6 +234,14 @@ static int run_tests(void)
> >         int fd_cloexec = open_or_die("execveat", O_RDONLY|O_CLOEXEC);
> >         int fd_script_cloexec = open_or_die("script", O_RDONLY|O_CLOEXEC);
> >
> > +       /* Check if we have execveat at all, and bail early if not */
> > +       errno = 0;
> > +       execveat_(-1, NULL, NULL, NULL, 0);
> > +       if (errno == -ENOSYS) {
> 
> Could we change this to ENOSYS (no minus) and also change
> the execveat_() function similarly, so that a binary built where
> __NR_execveat is available but running where it isn't also exits
> early?  (My bad for having the minus sign in execveat_() in the
> first place -- fingers too used to kernel mode.)

Ah yeah, me too, -ENOSYS just came naturally.

Will fix up and retest and resend.

cheers

      parent reply	other threads:[~2015-01-23  6:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-21  7:41 [PATCH] selftests/exec: Check if the syscall exists and bail if not Michael Ellerman
     [not found] ` <1421826060-2237-1-git-send-email-mpe-Gsx/Oe8HsFggBc27wqDAHg@public.gmane.org>
2015-01-21 10:22   ` David Drysdale
     [not found]     ` <CAHse=S_AWuY4YG7DJeU+Rma-kPuQLGZH2oqVV27RvF4unu61Aw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-23  6:01       ` Michael Ellerman [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=1421992886.24984.17.camel@ellerman.id.au \
    --to=mpe-gsx/oe8hsfggbc27wqdahg@public.gmane.org \
    --cc=davej-rdkfGonbjUTCLXcRTR1eJlpr/1R2p/CL@public.gmane.org \
    --cc=drysdale-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org \
    /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).