From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 04/10] Test for uname26 exploit CVE-2012-0957
Date: Fri, 26 May 2017 21:20:08 +0200 [thread overview]
Message-ID: <20170526192008.GB16233@rei.lan> (raw)
In-Reply-To: <20170522121341.4663-5-rpalethorpe@suse.com>
Hi!
> +static void try_leak_bytes(void)
> +{
> + struct utsname buf;
> +
> + if (uname(&buf))
> + tst_brk(TBROK | TERRNO, "Call to uname failed");
> +
> +#define CHECK_FIELD(field_name) \
> + (check_field(buf.field_name, ARRAY_SIZE(buf.field_name), #field_name))
> +
> + if (!(CHECK_FIELD(release) |
> + CHECK_FIELD(sysname) |
> + CHECK_FIELD(nodename) |
> + CHECK_FIELD(version) |
> + CHECK_FIELD(machine) |
> +#ifdef _GNU_SOURCE
> + CHECK_FIELD(domainname) |
> +#endif
The _GNU_SOURCE does not get defined automatically, unless you include a
header defines it. So I guess that we should better do a configure check
if the field is present when _GNU_SOURCE is defined. Define _GNU_SOURCE
at the start of this file and ifdef around macro that has been defined
by the configure script here. Or we can simply avoid checking the
domainname, since I guess that all the fields are filled with the same
function anyway.
> + 0)) {
> + tst_res(TPASS, "All fields zeroed after string terminator");
> + }
> +#undef CHECK_FIELD
> +}
> +
> +static void run(unsigned int test_nr)
> +{
> + if (!test_nr) {
> + tst_res(TINFO, "Calling uname with default personality");
> + try_leak_bytes();
> + } else {
> + if (personality(PER_LINUX | UNAME26) < 0)
> + tst_brk(TCONF | TERRNO,
> + "Could not change personality to UNAME26");
> + tst_res(TINFO, "Calling uname with UNAME26 personality");
> + try_leak_bytes();
> + }
> +}
> +
> +static struct tst_test test = {
> + .tid = "cve-2012-0957",
> + .test = run,
> + .tcnt = 2,
> +};
> --
> 2.12.2
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2017-05-26 19:20 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-22 12:13 [LTP] [PATCH v2 00/10] CVE Tests Richard Palethorpe
2017-05-22 12:13 ` [LTP] [PATCH v2 01/10] Add fuzzy synchronisation library for triggering races Richard Palethorpe
2017-05-22 12:13 ` [LTP] [PATCH v2 02/10] Test for vulnerability CVE-2016-7117 in recvmmsg error return path Richard Palethorpe
2017-05-26 14:51 ` Cyril Hrubis
2017-05-22 12:13 ` [LTP] [PATCH v2 03/10] Test for CVE-2016-4997 on setsockopt Richard Palethorpe
2017-05-22 12:13 ` [LTP] [PATCH v2 04/10] Test for uname26 exploit CVE-2012-0957 Richard Palethorpe
2017-05-26 19:20 ` Cyril Hrubis [this message]
2017-05-22 12:13 ` [LTP] [PATCH v2 05/10] Add CVE .gitignore, Makefile and runtest files Richard Palethorpe
2017-05-26 19:33 ` Cyril Hrubis
2017-05-29 8:44 ` Richard Palethorpe
2017-05-22 12:13 ` [LTP] [PATCH v2 06/10] Test for CVE-2014-0196 PTY echo race Richard Palethorpe
2017-05-26 19:41 ` Cyril Hrubis
2017-05-22 12:13 ` [LTP] [PATCH v2 07/10] Test for CVE-2017-5669 in shmat Richard Palethorpe
2017-05-26 19:56 ` Cyril Hrubis
2017-05-29 8:56 ` Richard Palethorpe
2017-05-22 12:13 ` [LTP] [PATCH v2 08/10] Test for CVE-2017-6951 in request_key Richard Palethorpe
2017-05-22 12:13 ` [LTP] [PATCH v2 09/10] Test for CVE-2017-7277 SOF_TIMESTAMPING_OPT_STATS Richard Palethorpe
2017-06-20 11:22 ` Richard Palethorpe
2017-05-22 12:13 ` [LTP] [PATCH v2 10/10] Test for CVE-2017-2671 on ping sockets Richard Palethorpe
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=20170526192008.GB16233@rei.lan \
--to=chrubis@suse.cz \
--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