From patchwork Thu Oct 25 08:19:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Stancek X-Patchwork-Id: 988953 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42gg5Q3mg4z9sBN for ; Thu, 25 Oct 2018 19:19:22 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 975A93E60BC for ; Thu, 25 Oct 2018 10:19:19 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [IPv6:2001:4b78:1:20::7]) by picard.linux.it (Postfix) with ESMTP id 8E2D43E6081 for ; Thu, 25 Oct 2018 10:19:18 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-7.smtp.seeweb.it (Postfix) with ESMTPS id BFA252011C8 for ; Thu, 25 Oct 2018 10:19:17 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EFBE7461D0; Thu, 25 Oct 2018 08:19:15 +0000 (UTC) Received: from dustball.brq.redhat.com (unknown [10.43.17.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 06754608F3; Thu, 25 Oct 2018 08:19:14 +0000 (UTC) From: Jan Stancek To: ltp@lists.linux.it Date: Thu, 25 Oct 2018 10:19:08 +0200 Message-Id: <5693d852c76547d1b05f68c3ab9cb8728c5a9958.1540455393.git.jstancek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 25 Oct 2018 08:19:16 +0000 (UTC) X-Virus-Scanned: clamav-milter 0.99.2 at in-7.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-7.smtp.seeweb.it Cc: ebiggers@google.com Subject: [LTP] [PATCH] keyctl05: use data that passes dns_resolver_preparse() check X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" 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. Reported-by: Naresh Kamboju Signed-off-by: Jan Stancek --- testcases/kernel/syscalls/keyctl/keyctl05.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/testcases/kernel/syscalls/keyctl/keyctl05.c b/testcases/kernel/syscalls/keyctl/keyctl05.c index 2384f7f67167..e2ed8ad4841b 100644 --- a/testcases/kernel/syscalls/keyctl/keyctl05.c +++ b/testcases/kernel/syscalls/keyctl/keyctl05.c @@ -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();