All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3 2/2] syscalls/keyctl: Make use of lapi/keyctl.h && Add existing test to runtest/cve
Date: Mon, 28 Aug 2017 13:04:57 +0200	[thread overview]
Message-ID: <20170828110457.GB21355@rei.lan> (raw)
In-Reply-To: <20170825032423.21004-2-fenggw-fnst@cn.fujitsu.com>

Hi!
> 1.syscalls/keyctl02 and syscalls/keyctl03 make use of lapi/keyctl.h
> 
> 2.syscalls/keyctl0* use keyutils.h fallback definition in lapi/keyctl.h
>   instead of raw syscall, thus we would test the keyutils library if the
>   header is present and these tests will not be disabled otherwise.
> 
> 3.Add syscalls/keyctl02 and commands/keyctl01 to the CVE runtest file as
>   cve-2015-7550 and cve-2016-4470 respectively.

It would be a bit cleaner if the part 3. was send in a separate part.

>  static void do_test(void)
>  {
>  	key_serial_t key;
>  
> -	TEST(tst_syscall(__NR_keyctl, KEYCTL_GET_KEYRING_ID,
> -		KEY_SPEC_USER_SESSION_KEYRING));
> -
> +	TEST(keyctl(KEYCTL_GET_KEYRING_ID, KEY_SPEC_USER_SESSION_KEYRING));
>  	if (TEST_RETURN != -1)
>  		tst_res(TPASS, "KEYCTL_GET_KEYRING_ID succeeded");
>  	else
>  		tst_res(TFAIL | TTERRNO, "KEYCTL_GET_KEYRING_ID failed");
>  
>  	for (key = INT32_MAX; key > INT32_MIN; key--) {
> -		TEST(tst_syscall(__NR_keyctl, KEYCTL_READ, key));
> +		TEST(keyctl(KEYCTL_READ, key));
>  		if (TEST_RETURN == -1 && TEST_ERRNO == ENOKEY)
>  			break;
>  	}
>  
> -	TEST(tst_syscall(__NR_keyctl, KEYCTL_REVOKE, key));
> -
> +	TEST(keyctl(KEYCTL_REVOKE, key));
>  	if (TEST_RETURN != -1) {
>  		tst_res(TFAIL, "KEYCTL_REVOKE succeeded unexpectedly");
>  		return;
> @@ -66,6 +60,14 @@ static void do_test(void)
>  	tst_res(TPASS | TTERRNO, "KEYCTL_REVOKE failed as expected");
>  }
>  
> +static void setup(void)
> +{
> +#ifndef HAVE_KEYUTILS_H
> +	tst_res(TINFO, "keyutils.h does not exist, using fallback definition");
> +#endif /* HAVE_KEYUTILS_H */
> +}

And I do not think that this message is necessary and if it is we should
probably print it from the lapi call rather than adding it into each of
the testcases.


Otherwise it looks fine.

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2017-08-28 11:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-23 11:00 [LTP] [PATCH 1/2] syscalls/keyctl01: Convert to the new library && Cleanup Guangwen Feng
2017-08-23 11:00 ` [LTP] [PATCH 2/2] syscalls/keyctl: Make use of lapi/keyctl.h && Add existing test to runtest/cve Guangwen Feng
2017-08-23 14:18   ` Cyril Hrubis
2017-08-24 13:25     ` Guangwen Feng
2017-08-24 13:28       ` [LTP] [PATCH v2 1/2] lapi/keyctl.h: Add fallback definition of keyutil.h Guangwen Feng
2017-08-24 13:28         ` [LTP] [PATCH v2 2/2] syscalls/keyctl: Make use of lapi/keyctl.h && Add existing test to runtest/cve Guangwen Feng
2017-08-25  3:14           ` Guangwen Feng
2017-08-25  3:24             ` [LTP] [PATCH v3 1/2] lapi/keyctl.h: Add fallback definition of keyutil.h Guangwen Feng
2017-08-25  3:24               ` [LTP] [PATCH v3 2/2] syscalls/keyctl: Make use of lapi/keyctl.h && Add existing test to runtest/cve Guangwen Feng
2017-08-28 11:04                 ` Cyril Hrubis [this message]
2017-08-28 11:02               ` [LTP] [PATCH v3 1/2] lapi/keyctl.h: Add fallback definition of keyutil.h Cyril Hrubis
2017-08-29  3:37                 ` [LTP] [PATCH v4 1/3] " Guangwen Feng
2017-08-29  3:37                   ` [LTP] [PATCH v4 2/3] syscalls/keyctl: Make use of lapi/keyctl.h Guangwen Feng
2017-08-29  3:37                   ` [LTP] [PATCH v4 3/3] CVE: Add some existing tests to runtest/cve Guangwen Feng
2017-08-29 11:47                   ` [LTP] [PATCH v4 1/3] lapi/keyctl.h: Add fallback definition of keyutil.h Cyril Hrubis
2017-08-23 14:13 ` [LTP] [PATCH 1/2] syscalls/keyctl01: Convert to the new library && Cleanup 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=20170828110457.GB21355@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 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.