Skip to contentSkip to conversation

keyctl05: use data that passes dns_resolver_preparse() check

PATCH New Jan Stancek 2 participants 3 messages Oct 25, 2018 – Oct 26, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 keyctl05: use data that passes dns_resolver_preparse() check

commit bbb4c4323a4d ("dns: Allow the dns resolver to retrieve a server set") introduced extra checks in dns_resolver_preparse(), which led to failure when creating a key:
keyctl05.c:119: BROK: unexpected error adding 'dns_resolver' key: EINVAL tst_test.c:884: BROK: Test 1 haven't reported results!

This patches replaces 2 zero-es with payload that passes checks introduced by bbb4c4323a4d. Since these checks didn't exist before, this change is backwards-compatible with earlier kernels without this patch.

---
 testcases/kernel/syscalls/keyctl/keyctl05.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
testcases/kernel/syscalls/keyctl/keyctl05.c +7 -4
index 2384f7f67167..e2ed8ad4841b 100644
@@ -194,8 +194,11 @@ static void test_update_setperm_race(void)
 
 static void do_test(unsigned int i)
 {
-	/* two 0 bytes is accepted as a dns_resolver key payload */
-	static char zeroes[2];
+	/*
+	 * We need to pass check in dns_resolver_preparse(),
+	 * give it dummy server list request.
+	 */
+	static char dns_res_payload[] = { 0x00, 0x00, 0x01, 0xff, 0x00 };
 
 	switch (i) {
 	case 0:
@@ -203,8 +206,8 @@ static void do_test(unsigned int i)
 					 x509_cert, sizeof(x509_cert));
 		break;
 	case 1:
-		test_update_nonupdatable("dns_resolver",
-					 zeroes, sizeof(zeroes));
+		test_update_nonupdatable("dns_resolver", dns_res_payload,
+			sizeof(dns_res_payload));
 		break;
 	case 2:
 		test_update_setperm_race();
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 1/1 keyctl05: use data that passes dns_resolver_preparse() check

----- Original Message -----

Quoted 2 lines

Hi!
Looks good, acked.

Pushed.

Quoted 5 lines

--
Cyril Hrubis
[email protected]