Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4781058ioa; Wed, 27 Apr 2022 10:58:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztxv525QqILdbqv9HqEUjzdUsMYeU+T5xTFAQngxzLnOAXFUaNtZwiZ6stO9I/xLLhtXKl X-Received: by 2002:a17:902:8504:b0:15d:2c7c:ceac with SMTP id bj4-20020a170902850400b0015d2c7cceacmr12615736plb.130.1651082335030; Wed, 27 Apr 2022 10:58:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651082335; cv=none; d=google.com; s=arc-20160816; b=hIC7Z2hhz5HZaVjU0xlyKeFjvNg8XnBVdbnK4rwXVP4wiZHNZs8IH3yvVoRuQJslUJ IP2sg27q+LLseHzVOmj9NGkepWZMBC0rpUq/2UWQTt/Sgmvz4WjmdD16zsXhv2y6tXaw +IoBGSj0hfbMRBS4L6ve8j80agJ6b0ulxzbGq74OBzNibFEERZ7up7LyCTGCUysvgemp 2H+l4+O9ogHQbSK/wW+hdX5N5T0NfBX8DyAweDN+5RC4yrO5pi93OREBXL0OwlepRsKC SXSzga95J+ipGg+jvG6Sv385zOYnxdeIdECoo5MInZKGQH4MynXyFGIzaSIp1YF5mvEq AmLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=42RgAf50owg0+jlVsid17fOyYF/dT4MNKSCPHhE7Jms=; b=zMSTEWdSl64iKso7CqSBdRErpbJOoSvev8ABJIsgnH9Pv/Y9+oMtSqqmDIcyfFekad 44rUjMKKG8UUI8SSZh52ccZQda9GhPbtfarUldDL/4C721OgaIuAjEqS0eP7jkUEk8ZY i/Er1adrbnWBTy2CVDS42E5FIuo9t8uVp1qWFDB82ykf+XO0FE7ZUSwToAP89WzCSk0Q fJVEcELB2puIDVtKp0whFRqanmCqOW+1x4Ur04zOTjOZuFZVtt7mJw74R8Bp7JURCyxi l6V044g4/4ANqGd0lZV1ZhIsxb9l6P3T+nEp1eT0bSBxO/dXIqSy+K23tedXxsb7APFD bxZA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d76-20020a621d4f000000b00505b033e35fsi1978295pfd.71.2022.04.27.10.58.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 10:58:55 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 652D528DA09; Wed, 27 Apr 2022 10:32:38 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244278AbiD0Rfd (ORCPT + 99 others); Wed, 27 Apr 2022 13:35:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244331AbiD0RfM (ORCPT ); Wed, 27 Apr 2022 13:35:12 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5F7B1218AFB for ; Wed, 27 Apr 2022 10:31:50 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3145DED1; Wed, 27 Apr 2022 10:31:50 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id F0BBE3F73B; Wed, 27 Apr 2022 10:31:48 -0700 (PDT) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Cc: akpm@linux-foundation.org, alex.popov@linux.com, catalin.marinas@arm.com, keescook@chromium.org, linux-kernel@vger.kernel.org, luto@kernel.org, mark.rutland@arm.com, will@kernel.org Subject: [PATCH v2 08/13] lkdtm/stackleak: avoid spurious failure Date: Wed, 27 Apr 2022 18:31:23 +0100 Message-Id: <20220427173128.2603085-9-mark.rutland@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220427173128.2603085-1-mark.rutland@arm.com> References: <20220427173128.2603085-1-mark.rutland@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The lkdtm_STACKLEAK_ERASING() test scans for a contiguous block of poison values between the low stack bound and the stack pointer, and fails if it does not find a sufficiently large block. This can happen legitimately if the scan the low stack bound, which could occur if functions called prior to lkdtm_STACKLEAK_ERASING() used a large amount of stack. If this were to occur, it means that the erased portion of the stack is smaller than the size used by the scan, but does not cause a functional problem In practice this is unlikely to happen, but as this is legitimate and would not result in a functional problem, the test should not fail in this case. Remove the spurious failure case. Signed-off-by: Mark Rutland Cc: Alexander Popov Cc: Andrew Morton Cc: Andy Lutomirski Cc: Kees Cook --- drivers/misc/lkdtm/stackleak.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/misc/lkdtm/stackleak.c b/drivers/misc/lkdtm/stackleak.c index 00db21ff115e4..707d530d509b7 100644 --- a/drivers/misc/lkdtm/stackleak.c +++ b/drivers/misc/lkdtm/stackleak.c @@ -53,13 +53,6 @@ void lkdtm_STACKLEAK_ERASING(void) found = 0; } - if (found <= check_depth) { - pr_err("FAIL: the erased part is not found (checked %lu bytes)\n", - i * sizeof(unsigned long)); - test_failed = true; - goto end; - } - pr_info("the erased part begins after %lu not poisoned bytes\n", (i - found) * sizeof(unsigned long)); -- 2.30.2