From: Xiao Yang <yangx.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 4/4] syscalls/mlock202: Add new testcase
Date: Thu, 30 Aug 2018 15:41:09 +0800 [thread overview]
Message-ID: <5B879F95.10200@cn.fujitsu.com> (raw)
In-Reply-To: <1782237279.43470847.1535546646343.JavaMail.zimbra@redhat.com>
On 2018/08/29 20:44, Jan Stancek wrote:
> ----- Original Message -----
>> Check various errnos for mlock2(2) since kernel v2.6.9.
> mlock2() is available since Linux 4.4.
>
>> +static struct tcase {
>> + char **taddr;
>> + int flag;
>> + unsigned long *max_size;
>> + /* 1: nobody expected 0: root expected */
>> + int exp_user;
> I'd drop the "expected" prefix here, this isn't something syscall provides as "output".
Hi Jan,
OK, I will drop it.
>> + int exp_err;
>> +} tcases[] = {
>> + {&addr, -1, NULL, 0, EINVAL},
>> + {&addr, 0,&max_sz1, 1, ENOMEM},
>> + {&addr, 0,&max_sz2, 1, EPERM},
>> + {&unmapped_addr, 0, NULL, 0, ENOMEM},
>> +};
>> +
> ..
>> +static void setup(void)
>> +{
>> + pgsz = getpagesize();
>> + nobody = SAFE_GETPWNAM("nobody");
>> +
>> + addr = SAFE_MMAP(NULL, pgsz, PROT_WRITE,
>> + MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
>> + unmapped_addr = SAFE_MMAP(NULL, pgsz, PROT_READ,
>> + MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
>> + SAFE_MUNMAP(unmapped_addr, pgsz);
> I suggest larger map here (couple M) and pick address in middle.
> Single page can easily be mapped by glibc for some buffer.
OK, i will map a larger one and pick address in middle.
Thanks,
Xiao Yang
>> +
>> + max_sz1 = pgsz - 1;
>> +}
>> +
> Regards,
> Jan
>
>
>
next prev parent reply other threads:[~2018-08-30 7:41 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-21 9:38 [LTP] [PATCH 1/4] lapi/syscalls: Add syscall numbers for mlock2 Xiao Yang
2018-08-21 9:38 ` [LTP] [PATCH 2/4] safe_macros: Add SAFE_MLOCK() and SAFE_MUNLOCK() macros Xiao Yang
2018-08-29 12:11 ` Jan Stancek
2018-08-21 9:38 ` [LTP] [PATCH 3/4] syscalls/mlock201: Add new testcase Xiao Yang
2018-08-29 12:19 ` Jan Stancek
2018-08-29 12:42 ` Jan Stancek
2018-08-30 1:17 ` Xiao Yang
2018-08-31 7:13 ` [LTP] [PATCH v2 " Xiao Yang
2018-08-30 12:41 ` Jan Stancek
2018-08-31 7:13 ` [LTP] [PATCH v2 4/4] syscalls/mlock202: " Xiao Yang
2018-08-30 12:43 ` Jan Stancek
2018-09-04 8:10 ` Jan Stancek
2018-08-21 9:38 ` [LTP] [PATCH " Xiao Yang
2018-08-29 12:44 ` Jan Stancek
2018-08-30 7:41 ` Xiao Yang [this message]
2018-08-29 12:11 ` [LTP] [PATCH 1/4] lapi/syscalls: Add syscall numbers for mlock2 Jan Stancek
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=5B879F95.10200@cn.fujitsu.com \
--to=yangx.jy@cn.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