All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: nobuhiro1.iwamatsu@toshiba.co.jp
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] lib: tst_fd: Add kernel version check to memfd_secret
Date: Fri, 21 Jun 2024 11:05:53 +0200	[thread overview]
Message-ID: <ZnVCcU6jOU98DYek@yuki> (raw)
In-Reply-To: <OS3PR01MB639110A9BC48CA10A9D97FEC92CF2@OS3PR01MB6391.jpnprd01.prod.outlook.com>

Hi!
> I would suggest using tst_syscall() to check for syscall undefined instead
> of this modification. How about this modification? 
> 
> ```
> --- a/lib/tst_fd.c
> +++ b/lib/tst_fd.c
> @@ -255,7 +255,8 @@ static void open_memfd(struct tst_fd *fd)
> 
>  static void open_memfd_secret(struct tst_fd *fd)
>  {
> -       fd->fd = syscall(__NR_memfd_secret, 0);
> +       fd->fd = tst_syscall(__NR_memfd_secret, 0);
>         if (fd->fd < 0) {
>                 tst_res(TCONF | TERRNO,
>                         "Skipping %s", tst_fd_desc(fd));
> ```

We cannot use tst_syscall() in the tst_fd library because it calls
tst_brk() with TCONF which exits the test immediately, but in this case
we actually want to continue with the rest of the tests.

I guess that the best fix is to add fallback definitions for
memfd_secret into include/lapi/syscalls/*.in files. That way we should
get -1 and EINVAL properly even when kernel does not support the
syscall.

-- 
Cyril Hrubis
chrubis@suse.cz

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

  parent reply	other threads:[~2024-06-21  9:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-18  8:49 [LTP] [PATCH] lib: tst_fd: Add kernel version check to memfd_secret Nobuhiro Iwamatsu
2024-06-18 10:15 ` Cyril Hrubis
2024-06-19  5:24   ` nobuhiro1.iwamatsu
2024-06-19 17:33     ` Petr Vorel
2024-06-19 17:33       ` Petr Vorel
2024-06-20  1:22       ` nobuhiro1.iwamatsu
2024-06-20  1:22         ` nobuhiro1.iwamatsu
2024-06-20 13:25         ` Petr Vorel
2024-06-20 13:25           ` Petr Vorel
2024-06-21  9:07           ` Cyril Hrubis
2024-06-21  9:07             ` Cyril Hrubis
2024-06-21  9:05     ` Cyril Hrubis [this message]
2024-06-21 11:09 ` Petr Vorel
2024-06-28  8:40   ` nobuhiro1.iwamatsu
2024-07-12 18:40     ` Edward Liaw via ltp
2024-07-16  4:25       ` nobuhiro1.iwamatsu
  -- strict thread matches above, loose matches on Subject: below --
2024-06-18  9:09 Nobuhiro Iwamatsu
2024-06-21 11:13 ` Petr Vorel

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=ZnVCcU6jOU98DYek@yuki \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=nobuhiro1.iwamatsu@toshiba.co.jp \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.