From: Wanlong Gao <gaowanlong@cn.fujitsu.com>
To: Jan Stancek <jstancek@redhat.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] sched_setaffinity01: use ltp_syscall
Date: Fri, 25 Jul 2014 16:36:29 +0800 [thread overview]
Message-ID: <53D2170D.40201@cn.fujitsu.com> (raw)
In-Reply-To: <428ab3048d90dc9d998143aea2b2a624b43d5220.1406276230.git.jstancek@redhat.com>
On 07/25/2014 04:18 PM, Jan Stancek wrote:
> Using glibc wrapper on kernel with smaller CONFIG_NR_CPUS (for example
> 255) leads to segmentation fault in glibc, because it triggers check,
> which is verifying that there are no bits set beyond size of kernel cpu
> mask:
>
> int
> __sched_setaffinity_new (pid_t pid, size_t cpusetsize, const cpu_set_t *cpuset)
> ...
> /* We now know the size of the kernel cpumask_t. Make sure the user
> does not request to set a bit beyond that. */
> for (size_t cnt = __kernel_cpumask_size; cnt < cpusetsize; ++cnt)
> if (((char *) cpuset)[cnt] != '\0') --> CRASH HERE
>
> Call this syscall directly with ltp_syscall().
>
> Reported-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
> ---
> .../sched_setaffinity/sched_setaffinity01.c | 11 ++++++++---
> 1 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/sched_setaffinity/sched_setaffinity01.c b/testcases/kernel/syscalls/sched_setaffinity/sched_setaffinity01.c
> index 0ac4478..33a90b8 100644
> --- a/testcases/kernel/syscalls/sched_setaffinity/sched_setaffinity01.c
> +++ b/testcases/kernel/syscalls/sched_setaffinity/sched_setaffinity01.c
> @@ -42,6 +42,7 @@
> #include "usctest.h"
> #include "safe_macros.h"
> #include "sched_setaffinity.h"
> +#include "linux_syscall_numbers.h"
>
> char *TCID = "sched_setaffinity01";
>
> @@ -151,9 +152,13 @@ int main(int argc, char *argv[])
> for (lc = 0; TEST_LOOPING(lc); lc++) {
> tst_count = 0;
> for (i = 0; i < TST_TOTAL; i++) {
> - TEST(sched_setaffinity(*(test_cases[i].pid),
> - *(test_cases[i].mask_size),
> - *(test_cases[i].mask)));
> + /* Avoid calling glibc wrapper function, as it may
> + * try to read/validate data in cpu mask. This test
> + * is passing invalid pointer on purpose. */
> + TEST(ltp_syscall(__NR_sched_setaffinity,
> + *(test_cases[i].pid),
> + *(test_cases[i].mask_size),
> + *(test_cases[i].mask)));
>
> if (TEST_RETURN != -1)
> tst_resm(TFAIL,
>
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
prev parent reply other threads:[~2014-07-25 8:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-25 8:18 [LTP] [PATCH] sched_setaffinity01: use ltp_syscall Jan Stancek
2014-07-25 8:35 ` Stanislav Kholmanskikh
2014-07-25 9:58 ` Jan Stancek
2014-07-25 8:36 ` Wanlong Gao [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=53D2170D.40201@cn.fujitsu.com \
--to=gaowanlong@cn.fujitsu.com \
--cc=jstancek@redhat.com \
--cc=ltp-list@lists.sourceforge.net \
/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.