Skip to contentSkip to conversation

safe_keyctl: Skip with TCONF on EOPNOTSUPP

PATCH In review Petr Vorel 2 participants 14 messages Dec 8, 2025 – Dec 12, 2025

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

cover safe_keyctl: Skip with TCONF on EOPNOTSUPP

Hi Meng, Mingyu,

this is another approach for your patchset
https://lore.kernel.org/ltp/[email protected]/

Could you please test it?

Kind regards,
Petr

Petr Vorel (2):
safe_keyctl: Skip with TCONF on EOPNOTSUPP
wqueue0*: Use SAFE_KEYCTL()

 include/lapi/keyctl.h                | 3 ++-
 testcases/kernel/watchqueue/common.h | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)
Signature · 5 lines
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#1 lore raw

PATCH 1/2 safe_keyctl: Skip with TCONF on EOPNOTSUPP

errno EOPNOTSUPP is likely a configuration issue, skip testing with TCONF.

---
 include/lapi/keyctl.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/lapi/keyctl.h +2 -1
index e08b8f1322..ab5c8a530f 100644
@@ -209,10 +209,11 @@ static inline long safe_keyctl(const char *file, const int lineno,
 {
 	long rval;
 	int failure = 0;
+	int res = errno == EOPNOTSUPP ? TCONF : TBROK | TERRNO;
 
 	rval = keyctl(cmd, arg2, arg3, arg4, arg5);
 	if (rval == -1) {
-		tst_brk_(file, lineno, TBROK | TERRNO,
+		tst_brk_(file, lineno, res,
 			"keyctl(%d, %lu, %lu, %lu, %lu)",
 			cmd, arg2, arg3, arg4, arg5);
 	}
Signature · 5 lines
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#2 lore raw

...

include/lapi/keyctl.h static inline long safe_keyctl(const char *file, const int lineno, · line 212

Quoted 6 lines

+++ b/include/lapi/keyctl.h

include/lapi/keyctl.h +1 -0
@@ -209,10 +209,11 @@ static inline long safe_keyctl(const char *file, const int lineno,
 {
 	long rval;
 	int failure = 0;
+	int res = errno == EOPNOTSUPP ? TCONF : TBROK | TERRNO;

Obviously set variable before calling keyctl() is wrong, as Mingyu Li reported
https://lore.kernel.org/ltp/[email protected]/

Therefore his patch which does not store value before use should be used:
https://patchwork.ozlabs.org/project/ltp/patch/[email protected]/
https://lore.kernel.org/ltp/[email protected]/

Kind regards,
Petr

Quoted 7 lines
include/lapi/keyctl.h +1 -1
 	rval = keyctl(cmd, arg2, arg3, arg4, arg5);
 	if (rval == -1) {
-		tst_brk_(file, lineno, TBROK | TERRNO,
+		tst_brk_(file, lineno, res,
 			"keyctl(%d, %lu, %lu, %lu, %lu)",
 			cmd, arg2, arg3, arg4, arg5);
 	}
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#3 lore raw

PATCH 2/2 wqueue0*: Use SAFE_KEYCTL()

In reply to Petr Vorel

Using SAFE_KEYCTL() helps to TCONF on EOPNOTSUPP, which is a configuration issue.

---
 testcases/kernel/watchqueue/common.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
testcases/kernel/watchqueue/common.h +2 -2
index 92e8f079cd..0921dce9a6 100644
@@ -85,8 +85,8 @@ static inline key_serial_t wqueue_add_key(int fd)
 	if (key == -1)
 		tst_brk(TBROK, "add_key error: %s", tst_strerrno(errno));
 
-	keyctl(KEYCTL_WATCH_KEY, key, fd, 0x01);
-	keyctl(KEYCTL_WATCH_KEY, KEY_SPEC_SESSION_KEYRING, fd, 0x02);
+	SAFE_KEYCTL(KEYCTL_WATCH_KEY, key, fd, 0x01, 0);
+	SAFE_KEYCTL(KEYCTL_WATCH_KEY, KEY_SPEC_SESSION_KEYRING, fd, 0x02, 0);
 
 	return key;
 }
Signature · 5 lines
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#4 lore raw

Re: [LTP] [PATCH 2/2] wqueue0*: Use SAFE_KEYCTL()

Quoted 2 lines

Using SAFE_KEYCTL() helps to TCONF on EOPNOTSUPP, which is a configuration issue.

FYI merged this patch.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#5 lore raw
In reply to Petr Vorel

Mingyu Li

Quoted 18 lines

Kind regards,
Petr

Petr Vorel (2):
safe_keyctl: Skip with TCONF on EOPNOTSUPP
wqueue0*: Use SAFE_KEYCTL()

include/lapi/keyctl.h | 3 ++-
testcases/kernel/watchqueue/common.h | 4 ++--

2 files changed, 4 insertions(+), 3 deletions(-)

--
2.51.0

--
Mailing list info: https://lists.linux.it/listinfo/ltp

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#6 lore raw

PATCH 1/1 safe_keyctl: Skip with TCONF on EOPNOTSUPP

From: Petr Vorel <[email protected]>

errno EOPNOTSUPP is likely a configuration issue, skip testing with TCONF.

---
 include/lapi/keyctl.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/lapi/keyctl.h +2 -1
index e08b8f132..eac9e2609 100644
@@ -212,7 +212,8 @@ static inline long safe_keyctl(const char *file, const int lineno,
 
 	rval = keyctl(cmd, arg2, arg3, arg4, arg5);
 	if (rval == -1) {
-		tst_brk_(file, lineno, TBROK | TERRNO,
+		tst_brk_(file, lineno,
+			errno == EOPNOTSUPP ? TCONF : TBROK | TERRNO,
 			"keyctl(%d, %lu, %lu, %lu, %lu)",
 			cmd, arg2, arg3, arg4, arg5);
 	}
Signature · 5 lines
2.47.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#7 lore raw
In reply to Petr Vorel
Quoted 7 lines

At 2025-12-08 23:05:40, "Petr Vorel" <[email protected]> wrote:
Hi Meng, Mingyu,

this is another approach for your patchset
https://lore.kernel.org/ltp/[email protected]/

Could you please test it?

Thanks for your suggestion, it's better when we using the SAFE_KEYCTL interface.
I have already tested those two patches. It always return TBRK as res variable is not suitable for our purpose, so I modified the first patch.

Quoted 10 lines

Kind regards,
Petr

Petr Vorel (2):
safe_keyctl: Skip with TCONF on EOPNOTSUPP
wqueue0*: Use SAFE_KEYCTL()

include/lapi/keyctl.h | 3 ++-
testcases/kernel/watchqueue/common.h | 4 ++--

Quoted 8 lines
2 files changed, 4 insertions(+), 3 deletions(-)

--
2.51.0

--
Mailing list info: https://lists.linux.it/listinfo/ltp

And sorry for previous broken mail, I spent sometime to figure out how to reply this mail properly.

Mingyu Li

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#8 lore raw

PATCH 1/1 safe_keyctl: Skip with TCONF on EOPNOTSUPP

From: Petr Vorel <[email protected]>

errno EOPNOTSUPP is likely a configuration issue, skip testing with TCONF.

---
 include/lapi/keyctl.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/lapi/keyctl.h +2 -1
index e08b8f132..eac9e2609 100644
@@ -212,7 +212,8 @@ static inline long safe_keyctl(const char *file, const int lineno,
 
 	rval = keyctl(cmd, arg2, arg3, arg4, arg5);
 	if (rval == -1) {
-		tst_brk_(file, lineno, TBROK | TERRNO,
+		tst_brk_(file, lineno,
+			errno == EOPNOTSUPP ? TCONF : TBROK | TERRNO,
 			"keyctl(%d, %lu, %lu, %lu, %lu)",
 			cmd, arg2, arg3, arg4, arg5);
 	}
Signature · 5 lines
2.47.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#10 lore raw

Thanks for your review.

Mingyu Li

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#11 lore raw

PATCH 1/1 safe_keyctl: Skip with TCONF on EOPNOTSUPP

From: Petr Vorel <[email protected]>

errno EOPNOTSUPP is likely a configuration issue, skip testing with TCONF.

---
 include/lapi/keyctl.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/lapi/keyctl.h +2 -1
index e08b8f132..eac9e2609 100644
@@ -212,7 +212,8 @@ static inline long safe_keyctl(const char *file, const int lineno,
 
 	rval = keyctl(cmd, arg2, arg3, arg4, arg5);
 	if (rval == -1) {
-		tst_brk_(file, lineno, TBROK | TERRNO,
+		tst_brk_(file, lineno,
+			errno == EOPNOTSUPP ? TCONF : TBROK | TERRNO,
 			"keyctl(%d, %lu, %lu, %lu, %lu)",
 			cmd, arg2, arg3, arg4, arg5);
 	}
Signature · 5 lines
2.47.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#12 lore raw
Quoted 17 lines

From: Petr Vorel <[email protected]>

errno EOPNOTSUPP is likely a configuration issue, skip testing with TCONF.

---
 include/lapi/keyctl.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/lapi/keyctl.h +0 -0
index e08b8f132..eac9e2609 100644

include/lapi/keyctl.h static inline long safe_keyctl(const char *file, const int lineno, · line 216

Quoted 6 lines
include/lapi/keyctl.h +2 -1
@@ -212,7 +212,8 @@ static inline long safe_keyctl(const char *file, const int lineno,
 
 	rval = keyctl(cmd, arg2, arg3, arg4, arg5);
 	if (rval == -1) {
-		tst_brk_(file, lineno, TBROK | TERRNO,
+		tst_brk_(file, lineno,
+			errno == EOPNOTSUPP ? TCONF : TBROK | TERRNO,

In the end, thinking about it twice I merged version which always prints TERRNO, because we don't have any special explanation for TCONF, therefore the only explanation is the errno itself:

(errno == EOPNOTSUPP ? TCONF : TBROK) | TERRNO,

Merged, with your Reviewed-by: and Co-developed-by:. Thanks!

Kind regards,
Petr

Quoted 3 lines
include/lapi/keyctl.h +0 -0
 			"keyctl(%d, %lu, %lu, %lu, %lu)",
 			cmd, arg2, arg3, arg4, arg5);
 	}
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#13 lore raw
In reply to [email protected]
Quoted 11 lines
Quoted 7 lines

At 2025-12-08 23:05:40, "Petr Vorel" <[email protected]> wrote:
Hi Meng, Mingyu,

this is another approach for your patchset
https://lore.kernel.org/ltp/[email protected]/

Could you please test it?

Thanks for your suggestion, it's better when we using the SAFE_KEYCTL interface.
I have already tested those two patches. It always return TBRK as res variable is not suitable for our purpose, so I modified the first patch.

Good catch, thanks!

Quoted 15 lines
Quoted 13 lines

Kind regards,
Petr

Petr Vorel (2):
safe_keyctl: Skip with TCONF on EOPNOTSUPP
wqueue0*: Use SAFE_KEYCTL()

include/lapi/keyctl.h | 3 ++-
testcases/kernel/watchqueue/common.h | 4 ++--

2 files changed, 4 insertions(+), 3 deletions(-)

--
2.51.0

Quoted 5 lines
Quoted 2 lines

--
Mailing list info: https://lists.linux.it/listinfo/ltp

And sorry for previous broken mail, I spent sometime to figure out how to reply this mail properly.

Don't worry, I've cleanup the patchwork state by setting the state of the first patch as superseded. The one send later should be used for a discussion / reviews.

https://patchwork.ozlabs.org/project/ltp/patch/[email protected]/

Kind regards,
Petr

Quoted 1 line

Mingyu Li

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp