* [LTP] [PATCH] syscalls/keyctl02: Fix insufficiency of default key count quota
@ 2017-03-09 10:22 Guangwen Feng
2017-03-29 7:12 ` [LTP] [PATCH v2] " Guangwen Feng
0 siblings, 1 reply; 5+ messages in thread
From: Guangwen Feng @ 2017-03-09 10:22 UTC (permalink / raw)
To: ltp
Adding and revoking keys rapidly in loops will take a significant
number of key count quota, because it takes time to release the
instantiated key, so temporarily raise the quota when testing.
Signed-off-by: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
---
testcases/kernel/syscalls/keyctl/keyctl02.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/testcases/kernel/syscalls/keyctl/keyctl02.c b/testcases/kernel/syscalls/keyctl/keyctl02.c
index 7145a5a..fc743d2 100644
--- a/testcases/kernel/syscalls/keyctl/keyctl02.c
+++ b/testcases/kernel/syscalls/keyctl/keyctl02.c
@@ -48,6 +48,9 @@
#ifdef HAVE_KEYUTILS_H
#define LOOPS 20000
+#define PATH_KEY_COUNT_QUOTA "/proc/sys/kernel/keys/root_maxkeys"
+
+static int orig_maxkeys;
static void *do_read(void *arg)
{
@@ -98,8 +101,22 @@ static void do_test(void)
tst_res(TPASS, "Bug not reproduced");
}
+static void setup(void)
+{
+ SAFE_FILE_SCANF(PATH_KEY_COUNT_QUOTA, "%d", &orig_maxkeys);
+ SAFE_FILE_PRINTF(PATH_KEY_COUNT_QUOTA, "%d", orig_maxkeys + LOOPS);
+}
+
+static void cleanup(void)
+{
+ SAFE_FILE_PRINTF(PATH_KEY_COUNT_QUOTA, "%d", orig_maxkeys);
+}
+
static struct tst_test test = {
.tid = "keyctl02",
+ .needs_root = 1,
+ .setup = setup,
+ .cleanup = cleanup,
.test_all = do_test,
};
--
1.8.4.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* [LTP] [PATCH v2] syscalls/keyctl02: Fix insufficiency of default key count quota
2017-03-09 10:22 [LTP] [PATCH] syscalls/keyctl02: Fix insufficiency of default key count quota Guangwen Feng
@ 2017-03-29 7:12 ` Guangwen Feng
2017-03-29 7:21 ` Guangwen Feng
0 siblings, 1 reply; 5+ messages in thread
From: Guangwen Feng @ 2017-03-29 7:12 UTC (permalink / raw)
To: ltp
Adding and revoking keys rapidly in loops will take a significant
number of key count quota, because it takes time to free the
instantiated keys, so temporarily raise the quota when testing.
Signed-off-by: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
---
testcases/kernel/syscalls/keyctl/keyctl02.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/testcases/kernel/syscalls/keyctl/keyctl02.c b/testcases/kernel/syscalls/keyctl/keyctl02.c
index 11d3af9..1fdea79 100644
--- a/testcases/kernel/syscalls/keyctl/keyctl02.c
+++ b/testcases/kernel/syscalls/keyctl/keyctl02.c
@@ -48,6 +48,9 @@
#ifdef HAVE_KEYUTILS_H
#define LOOPS 20000
+#define PATH_KEY_COUNT_QUOTA "/proc/sys/kernel/keys/root_maxkeys"
+
+static int orig_maxkeys;
static void *do_read(void *arg)
{
@@ -98,9 +101,22 @@ static void do_test(void)
tst_res(TPASS, "Bug not reproduced");
}
+static void setup(void)
+{
+ SAFE_FILE_SCANF(PATH_KEY_COUNT_QUOTA, "%d", &orig_maxkeys);
+ SAFE_FILE_PRINTF(PATH_KEY_COUNT_QUOTA, "%d", orig_maxkeys + LOOPS);
+}
+
+static void cleanup(void)
+{
+ SAFE_FILE_PRINTF(PATH_KEY_COUNT_QUOTA, "%d", orig_maxkeys);
+}
+
static struct tst_test test = {
.tid = "keyctl02",
.needs_root = 1,
+ .setup = setup,
+ .cleanup = cleanup,
.test_all = do_test,
};
--
1.8.4.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* [LTP] [PATCH v2] syscalls/keyctl02: Fix insufficiency of default key count quota
2017-03-29 7:12 ` [LTP] [PATCH v2] " Guangwen Feng
@ 2017-03-29 7:21 ` Guangwen Feng
2017-03-29 7:23 ` [LTP] [PATCH v3] " Guangwen Feng
0 siblings, 1 reply; 5+ messages in thread
From: Guangwen Feng @ 2017-03-29 7:21 UTC (permalink / raw)
To: ltp
Hi!
Please ignore this one, I will send a V3, sorry.
Best Regards,
Guangwen Feng
On 03/29/2017 03:12 PM, Guangwen Feng wrote:
> Adding and revoking keys rapidly in loops will take a significant
> number of key count quota, because it takes time to free the
> instantiated keys, so temporarily raise the quota when testing.
>
> Signed-off-by: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
> ---
> testcases/kernel/syscalls/keyctl/keyctl02.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/testcases/kernel/syscalls/keyctl/keyctl02.c b/testcases/kernel/syscalls/keyctl/keyctl02.c
> index 11d3af9..1fdea79 100644
> --- a/testcases/kernel/syscalls/keyctl/keyctl02.c
> +++ b/testcases/kernel/syscalls/keyctl/keyctl02.c
> @@ -48,6 +48,9 @@
> #ifdef HAVE_KEYUTILS_H
>
> #define LOOPS 20000
> +#define PATH_KEY_COUNT_QUOTA "/proc/sys/kernel/keys/root_maxkeys"
> +
> +static int orig_maxkeys;
>
> static void *do_read(void *arg)
> {
> @@ -98,9 +101,22 @@ static void do_test(void)
> tst_res(TPASS, "Bug not reproduced");
> }
>
> +static void setup(void)
> +{
> + SAFE_FILE_SCANF(PATH_KEY_COUNT_QUOTA, "%d", &orig_maxkeys);
> + SAFE_FILE_PRINTF(PATH_KEY_COUNT_QUOTA, "%d", orig_maxkeys + LOOPS);
> +}
> +
> +static void cleanup(void)
> +{
> + SAFE_FILE_PRINTF(PATH_KEY_COUNT_QUOTA, "%d", orig_maxkeys);
> +}
> +
> static struct tst_test test = {
> .tid = "keyctl02",
> .needs_root = 1,
> + .setup = setup,
> + .cleanup = cleanup,
> .test_all = do_test,
> };
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread* [LTP] [PATCH v3] syscalls/keyctl02: Fix insufficiency of default key count quota
2017-03-29 7:21 ` Guangwen Feng
@ 2017-03-29 7:23 ` Guangwen Feng
2017-03-30 14:30 ` Cyril Hrubis
0 siblings, 1 reply; 5+ messages in thread
From: Guangwen Feng @ 2017-03-29 7:23 UTC (permalink / raw)
To: ltp
Adding and revoking keys rapidly in loops will take a significant
number of key count quota, because it takes time to free the
instantiated keys, so temporarily raise the quota when testing.
Signed-off-by: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
---
testcases/kernel/syscalls/keyctl/keyctl02.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/testcases/kernel/syscalls/keyctl/keyctl02.c b/testcases/kernel/syscalls/keyctl/keyctl02.c
index 11d3af9..aa98822 100644
--- a/testcases/kernel/syscalls/keyctl/keyctl02.c
+++ b/testcases/kernel/syscalls/keyctl/keyctl02.c
@@ -48,6 +48,9 @@
#ifdef HAVE_KEYUTILS_H
#define LOOPS 20000
+#define PATH_KEY_COUNT_QUOTA "/proc/sys/kernel/keys/root_maxkeys"
+
+static int orig_maxkeys;
static void *do_read(void *arg)
{
@@ -98,9 +101,23 @@ static void do_test(void)
tst_res(TPASS, "Bug not reproduced");
}
+static void setup(void)
+{
+ SAFE_FILE_SCANF(PATH_KEY_COUNT_QUOTA, "%d", &orig_maxkeys);
+ SAFE_FILE_PRINTF(PATH_KEY_COUNT_QUOTA, "%d", orig_maxkeys + LOOPS);
+}
+
+static void cleanup(void)
+{
+ if (orig_maxkeys > 0)
+ SAFE_FILE_PRINTF(PATH_KEY_COUNT_QUOTA, "%d", orig_maxkeys);
+}
+
static struct tst_test test = {
.tid = "keyctl02",
.needs_root = 1,
+ .setup = setup,
+ .cleanup = cleanup,
.test_all = do_test,
};
--
1.8.4.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-03-30 14:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-09 10:22 [LTP] [PATCH] syscalls/keyctl02: Fix insufficiency of default key count quota Guangwen Feng
2017-03-29 7:12 ` [LTP] [PATCH v2] " Guangwen Feng
2017-03-29 7:21 ` Guangwen Feng
2017-03-29 7:23 ` [LTP] [PATCH v3] " Guangwen Feng
2017-03-30 14:30 ` Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox