public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: xuyang2018.jy@fujitsu.com <xuyang2018.jy@fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v1 2/4] syscalls/shmget*: Convert into new api
Date: Thu, 3 Jun 2021 09:49:36 +0000	[thread overview]
Message-ID: <60B8A5D6.1080308@fujitsu.com> (raw)
In-Reply-To: <609BB199.5040409@fujitsu.com>

Hi!
Ping. Also add a url[1] for the missing EPRERM error(should see lastest
man-page).

[1]https://github.com/mkerrisk/man-pages/commit/090fdddb4342f92a1dbeba687462f4bcee816232

Best Regards
Yang Xu
> Hi ALL
>> 1) merge shmget05.c into shmget02.c
>> 2) Use SHMMIN -1 and SHMMAX + 1 to trigger EINVAL error
>> 3) Use SHM_RD, SHM_WR, SHM_RW to trigger EACCES error under unpriviledged user
> 
> Sorry for missing EPERM error in shmget02.c(I will add it in v2 when you
> have comment on rest patches)
> 
> diff --git a/testcases/kernel/syscalls/ipc/shmget/shmget02.c
> b/testcases/kernel/syscalls/ipc/shmget/shmget02.c
> index a57904ce9..319d1e972 100644
> --- a/testcases/kernel/syscalls/ipc/shmget/shmget02.c
> +++ b/testcases/kernel/syscalls/ipc/shmget/shmget02.c
> @@ -17,6 +17,9 @@
>    * greater than SHMMAX. Or a segment for the given key exists, but size is
>    * greater than the size of that segment.
>    * EACCES - The user does not have permission to access the shared
> memory segment.
> + * EPERM - The SHM_HUGETLB flag was specified, but the caller was not
> privileged
> + * (did not have the CAP_IPC_LOCK capability). Also the caller's group
> id should
> + * be not in hugetlb_shm_group proc file.
>    */
>   #include<errno.h>
>   #include<sys/types.h>
> @@ -47,6 +50,7 @@ static struct tcase {
>          {&shmkey1, SHMMAX + 1, IPC_CREAT | IPC_EXCL, 0, EINVAL},
>          {&shmkey, SHM_SIZE * 2, IPC_EXCL, 0, EINVAL},
>          {&shmkey, SHM_SIZE, SHM_RD, 1, EACCES},
> +       {&shmkey1, SHM_SIZE, IPC_CREAT | SHM_HUGETLB, 1, EPERM}
>   };
> 
>   static void verify_shmget(struct tcase *tc)
> @@ -91,6 +95,7 @@ static void setup(void)
>          shmkey = GETIPCKEY();
>          shmkey1 = GETIPCKEY();
> 
> +       SAFE_FILE_PRINTF("/proc/sys/vm/hugetlb_shm_group", "1");
>          shm_id = SAFE_SHMGET(shmkey, SHM_SIZE, IPC_CREAT | IPC_EXCL);
>          pw = SAFE_GETPWNAM("nobody");
>          tst_res(TINFO, "%d %d", shmkey, shmkey1);
> @@ -110,4 +115,8 @@ static struct tst_test test = {
>          .cleanup = cleanup,
>          .test = do_test,
>          .tcnt = ARRAY_SIZE(tcases),
> +       .save_restore = (const char * const[]) {
> +                "?/proc/sys/vm/hugetlb_shm_group",
> +               NULL,
> +       }
>   };
> 

  reply	other threads:[~2021-06-03  9:49 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-12  8:52 [LTP] [PATCH v1 1/4] syscalls/shmget01: Remove it Yang Xu
2021-05-12  8:52 ` [LTP] [PATCH v1 2/4] syscalls/shmget*: Convert into new api Yang Xu
2021-05-12 10:44   ` xuyang2018.jy
2021-06-03  9:49     ` xuyang2018.jy [this message]
2021-06-18 14:28   ` Cyril Hrubis
2021-06-21  9:48     ` xuyang2018.jy
2021-06-22  8:31     ` [LTP] [PATCH v2] " Yang Xu
2021-06-23 13:35       ` Cyril Hrubis
2021-06-24  3:46         ` xuyang2018.jy
2021-05-12  8:52 ` [LTP] [PATCH v1 3/4] syscalls/shmget05: Add test for /proc/sys/kernel/shm_next_id Yang Xu
2021-06-29  3:25   ` xuyang2018.jy
2021-07-12  2:37     ` xuyang2018.jy
2021-07-22 11:52   ` Cyril Hrubis
2021-07-23  9:10     ` xuyang2018.jy
2021-05-12  8:52 ` [LTP] [PATCH v1 4/4] syscalls/shmget06: Add test when the id of shm_next_id has existed Yang Xu
2021-07-22 12:08   ` Cyril Hrubis
2021-07-23  9:15     ` xuyang2018.jy
2021-07-23  9:41     ` [LTP] [PATCH v2 1/2] syscalls/shmget05: Add test for /proc/sys/kernel/shm_next_id Yang Xu
2021-07-23  9:42       ` [LTP] [PATCH v2 2/2] syscalls/shmget06: Add test when shm_next_id is already in use Yang Xu
2021-07-27  2:13         ` xuyang2018.jy
2021-06-18 12:54 ` [LTP] [PATCH v1 1/4] syscalls/shmget01: Remove it 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=60B8A5D6.1080308@fujitsu.com \
    --to=xuyang2018.jy@fujitsu.com \
    --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