From patchwork Fri Jul 13 13:46:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Myl=C3=A8ne_Josserand?= X-Patchwork-Id: 943594 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=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41RvHC13L5z9s2x for ; Fri, 13 Jul 2018 23:46:47 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 44CC63E6DC3 for ; Fri, 13 Jul 2018 15:46:44 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) by picard.linux.it (Postfix) with ESMTP id E73013E6B1E for ; Fri, 13 Jul 2018 15:46:41 +0200 (CEST) Received: from mail.bootlin.com (mail.bootlin.com [62.4.15.54]) by in-5.smtp.seeweb.it (Postfix) with ESMTP id 2FE0660097D for ; Fri, 13 Jul 2018 15:46:41 +0200 (CEST) Received: by mail.bootlin.com (Postfix, from userid 110) id 83F752072B; Fri, 13 Jul 2018 15:46:40 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-5.smtp.seeweb.it X-Spam-Level: X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_PASS autolearn=disabled version=3.4.0 Received: from dell-desktop.home (176-137-37-244.abo.bbox.fr [176.137.37.244]) by mail.bootlin.com (Postfix) with ESMTPSA id 29953207AB; Fri, 13 Jul 2018 15:46:30 +0200 (CEST) From: =?utf-8?q?Myl=C3=A8ne_Josserand?= To: ltp@lists.linux.it Date: Fri, 13 Jul 2018 15:46:18 +0200 Message-Id: <20180713134618.29552-1-mylene.josserand@bootlin.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-5.smtp.seeweb.it X-Virus-Status: Clean Cc: thomas.petazzoni@bootlin.com Subject: [LTP] [PATCH] testcases: cve-2017-2671: Set attempts according to cpus 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: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" This test tries to run commands with 0x8000 attempts. In a slow system platform, it leads to a failure because of a timeout even when it is configured with LTP_TIMEOUT_MUL=10. This commit adds a way to configure the number of attempts according to the number of CPUs. In case of 1 CPU and a slow platform, using 0x2000 attempts with a LTP_TIMEOUT_MUL=3 make the test pass. Signed-off-by: Mylène Josserand --- testcases/cve/cve-2017-2671.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/testcases/cve/cve-2017-2671.c b/testcases/cve/cve-2017-2671.c index b0471bfff..a56bb45a8 100644 --- a/testcases/cve/cve-2017-2671.c +++ b/testcases/cve/cve-2017-2671.c @@ -49,7 +49,7 @@ #include "tst_fuzzy_sync.h" -#define ATTEMPTS 0x80000 +#define ATTEMPTS 0x2000 #define PING_SYSCTL_PATH "/proc/sys/net/ipv4/ping_group_range" static int sockfd; @@ -109,9 +109,13 @@ static void *connect_b(void * param LTP_ATTRIBUTE_UNUSED) static void run(void) { - int i; + int i, total_cpus; - for (i = 0; i < ATTEMPTS; i++) { + total_cpus = tst_ncpus(); + if (total_cpus > 4) + total_cpus = 4; + + for (i = 0; i < ATTEMPTS * total_cpus; i++) { SAFE_CONNECT(sockfd, (struct sockaddr *)&iaddr, sizeof(iaddr));