From patchwork Tue Aug 1 09:43:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ricardo_Ca=C3=B1uelo?= X-Patchwork-Id: 13336101 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 231B4C0015E for ; Tue, 1 Aug 2023 09:46:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233639AbjHAJqR (ORCPT ); Tue, 1 Aug 2023 05:46:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233631AbjHAJqD (ORCPT ); Tue, 1 Aug 2023 05:46:03 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39DA05243 for ; Tue, 1 Aug 2023 02:44:31 -0700 (PDT) Received: from localhost.localdomain (unknown [IPv6:2a0c:5a83:9100:a000:2ba:2ec4:c400:5d53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: rcn) by madras.collabora.co.uk (Postfix) with ESMTPSA id 600536607187; Tue, 1 Aug 2023 10:44:29 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1690883069; bh=qughrfaA+YuFiONlh2NrtbbhsF03cea1dOObdrTdUPI=; h=From:To:Cc:Subject:Date:From; b=kY+yQlDpYvQgbSjGnHKhvD+SxLvypqOMuBT2RvkYI8EQ1x+jUcgYMhXWa6Yr8raFs DzjUhy5T6/s7DHtdBUzElfRZpHC0pAoz8pMA6Ag8y44sZ7t9C5dTz09eM3p64yl3lg Idk5K9KMkZM3wACEqRj18eIb7qvF1+O0o3q4beZufTOLtipO9xxFdTlvymTuWkbjQ/ lWLO/fqbSrI/7NNbsyf2c3ngRQZUzZbSaLlwDIStHzW7FR60knm2LPqKAa1oHKAriW s0VGMfx2WaukJKI9sV9OTefb9mnxxDvzO5kKWycl4nyMqFQM1G1bSrvJVNwxpS3Af/ n4o1gPH0LzMrA== From: =?utf-8?q?Ricardo_Ca=C3=B1uelo?= To: keescook@chromium.org Cc: kernel@collabora.com, shuah@kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH] selftests/lkdtm: Disable CONFIG_UBSAN_TRAP in test config Date: Tue, 1 Aug 2023 11:43:29 +0200 Message-Id: <20230801094329.1878928-1-ricardo.canuelo@collabora.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The lkdtm selftest config fragment enables CONFIG_UBSAN_TRAP to make the ARRAY_BOUNDS test kill the calling process when an out-of-bound access is detected by UBSAN. However, after this [1] commit, UBSAN is triggered under many new scenarios that weren't detected before, such as in struct definitions with fixed-size trailing arrays used as flexible arrays. As a result, CONFIG_UBSAN_TRAP=y has become a very aggressive option to enable except for specific situations. `make kselftest-merge` applies CONFIG_UBSAN_TRAP=y to the kernel config for all selftests, which makes many of them fail because of system hangs during boot. This change removes the config option from the lkdtm kselftest and also the ARRAY_BOUNDS test to skip it rather than have it failing. If out-of-bound array accesses need to be checked, there's CONFIG_TEST_UBSAN for that. [1] commit 2d47c6956ab3 ("ubsan: Tighten UBSAN_BOUNDS on GCC")' Signed-off-by: Ricardo CaƱuelo --- tools/testing/selftests/lkdtm/config | 1 - tools/testing/selftests/lkdtm/tests.txt | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/testing/selftests/lkdtm/config b/tools/testing/selftests/lkdtm/config index 5d52f64dfb43..7afe05e8c4d7 100644 --- a/tools/testing/selftests/lkdtm/config +++ b/tools/testing/selftests/lkdtm/config @@ -9,7 +9,6 @@ CONFIG_INIT_ON_FREE_DEFAULT_ON=y CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y CONFIG_UBSAN=y CONFIG_UBSAN_BOUNDS=y -CONFIG_UBSAN_TRAP=y CONFIG_STACKPROTECTOR_STRONG=y CONFIG_SLUB_DEBUG=y CONFIG_SLUB_DEBUG_ON=y diff --git a/tools/testing/selftests/lkdtm/tests.txt b/tools/testing/selftests/lkdtm/tests.txt index 607b8d7e3ea3..6a49f2abbda8 100644 --- a/tools/testing/selftests/lkdtm/tests.txt +++ b/tools/testing/selftests/lkdtm/tests.txt @@ -7,7 +7,7 @@ EXCEPTION #EXHAUST_STACK Corrupts memory on failure #CORRUPT_STACK Crashes entire system on success #CORRUPT_STACK_STRONG Crashes entire system on success -ARRAY_BOUNDS +#ARRAY_BOUNDS Needs CONFIG_UBSAN_TRAP=y, might cause unrelated system hangs CORRUPT_LIST_ADD list_add corruption CORRUPT_LIST_DEL list_del corruption STACK_GUARD_PAGE_LEADING