From patchwork Wed Jun 23 20:39:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 466326 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 623D2C48BC2 for ; Wed, 23 Jun 2021 20:39:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 47A80611AD for ; Wed, 23 Jun 2021 20:39:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229523AbhFWUmG (ORCPT ); Wed, 23 Jun 2021 16:42:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229831AbhFWUmF (ORCPT ); Wed, 23 Jun 2021 16:42:05 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A5F5C061767 for ; Wed, 23 Jun 2021 13:39:47 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id pf4-20020a17090b1d84b029016f6699c3f2so4562889pjb.0 for ; Wed, 23 Jun 2021 13:39:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=a/NHLnzJB2ygZFZV6tY0zJmtOu+fbM3j2iEZapLwC/A=; b=I/banPaTpbTehL6OdlALe/IibBFT5OlgTdWS6XNKoIoXm+GiZtXArwzsPg+rtwRkgg NmrSVIMu+8EuZ9CYJ01zzWl4kbE+LLteCDRjIKB9SxVkzoI6SWm+GokpeXxJUhilXbxr V3BTbXTDX4uqb6Jl4nP19anmnYosCw2t8IZxM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=a/NHLnzJB2ygZFZV6tY0zJmtOu+fbM3j2iEZapLwC/A=; b=jOPPhPlbbGtDP4ah8iwMFcvLW/75MEKkDQlJXRzBZsI7sLNgT5AABw4bGx9zX7S04E 3niRfTelWKHFeN1hCdfBbBniGoJH0e9IfIq9ZeogqlnwsBckut0k6sFYiRHR6pjn/gYH x1AiFcobvsJRTAH9EDaPQMvgcx17bwwdNhVLdXD7iZj0FHbbDH9Bv3JQRGkE4kS6vdVs /RFOAE5POH1+SfOcIRwxcwp6q/ydzNq2anfU1m6zc+NUC5vkjw6P2+DerFjUyQpgcqiP akL5T5m0N4jhDLLY+JTxQ2kqh8aP2iKPUfFDoeTZtyWUARzxzHiZiCwaW2DI2oDa6gFM HP2w== X-Gm-Message-State: AOAM530ASVgbvyeysZjkywHIqZQgu9cIc+gNhBnLb6VkI5b51kdGWY3A Pi+JbntswFeNOEA+WknmbmXKPQ== X-Google-Smtp-Source: ABdhPJyIVBrXhKOZzCBKXG3oK3wjH6BAd9s13vXvBJ+PpxlX5LInY9Q6iJqJZX6Jh5pq81lEvn0kug== X-Received: by 2002:a17:90a:5a08:: with SMTP id b8mr11356642pjd.228.1624480786915; Wed, 23 Jun 2021 13:39:46 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id u23sm9942pgk.38.2021.06.23.13.39.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 13:39:45 -0700 (PDT) From: Kees Cook To: Greg Kroah-Hartman Cc: Kees Cook , Guillaume Tucker , David Laight , stable@vger.kernel.org, Arnd Bergmann , linux-kernel@vger.kernel.org, kernelci@groups.io, linux-kselftest@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH 1/9] selftests/lkdtm: Avoid needing explicit sub-shell Date: Wed, 23 Jun 2021 13:39:28 -0700 Message-Id: <20210623203936.3151093-2-keescook@chromium.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210623203936.3151093-1-keescook@chromium.org> References: <20210623203936.3151093-1-keescook@chromium.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1841; h=from:subject; bh=AmOgu4HWdRZorYqBFRSjQNwNv37L2JYo/PWnXeJW7vY=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBg05wFY5oavND7smh3PFgLH+LKjB2fUh5OHY6bWTIk eYMshS6JAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCYNOcBQAKCRCJcvTf3G3AJvtJD/ 9G+j8CKarzbS3nY6L6aaVmdftLkiLrU13NYZGNHPstjHi6Lx9CpHpJ+QwK8wc78agXMWUB/r+L8qLk s5gPPethiYZV3QumjnWFZ+gj2T/Xoz+EbjLOWntVMv9mjstH5+5/e/VcX9vi3N56IBFqOT/OAyrw6V piyzsjxVP6elfNaUtfASxPcXo5H7zZVums4Lnz/S7qok5qi+zmFuE9cxdfPi1g5YHAdw8uxX76SDgD hoV+UheZw8Vf76IBrTdkW9Jp46PrE+jfJrWT6bx2II9gX/ukVqaMFNd4OMh/CyptWTqAdlnB165u2o dy3BZ1goom8Vqgcw5HC4Xyvj6RHMejdsHAwvZi1eykN7tOV2Ad3VciAb5zpVW0aw6N6KFim54cJhF+ 6ZEq4G2peIhgqpOiJQeN3nNjM19grUPTa4eG/YYfxZxPmhW9BgnimjjelWxx2V2bEUMsU5WvOOOhKl 3av97w61teJaEc5UTni4zXrsFfROtUVxxWtGT6W++WLxeHaIFjxiNKPOUNqIF8xNIDbfy5mnHt7dp6 qzq+WOtPvEmqbCZQ/qsVUVxIbAaVUSoNjmrIU5nCypQyLphJMqKBzn/qDVtewgDbXOT8Np07K7fFns ceDGvDFjboNdC3WG7S0yN+Pj+kveweqXC8AKB5TUR06NIKYA8nA74XD1efAg== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org Some environments do not set $SHELL when running tests. There's no need to use $SHELL here anyway, since "cat" can be used to receive any delivered signals from the kernel. Additionally avoid using bash-isms in the command, and record stderr for posterity. Suggested-by: Guillaume Tucker Suggested-by: David Laight Fixes: 46d1a0f03d66 ("selftests/lkdtm: Add tests for LKDTM targets") Cc: stable@vger.kernel.org Signed-off-by: Kees Cook --- tools/testing/selftests/lkdtm/run.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/lkdtm/run.sh b/tools/testing/selftests/lkdtm/run.sh index bb7a1775307b..e95e79bd3126 100755 --- a/tools/testing/selftests/lkdtm/run.sh +++ b/tools/testing/selftests/lkdtm/run.sh @@ -76,10 +76,14 @@ fi # Save existing dmesg so we can detect new content below dmesg > "$DMESG" -# Most shells yell about signals and we're expecting the "cat" process -# to usually be killed by the kernel. So we have to run it in a sub-shell -# and silence errors. -($SHELL -c 'cat <(echo '"$test"') >'"$TRIGGER" 2>/dev/null) || true +# Since the kernel is likely killing the process writing to the trigger +# file, it must not be the script's shell itself. i.e. we cannot do: +# echo "$test" >"$TRIGGER" +# Instead, use "cat" to take the signal. Since the shell will yell about +# the signal that killed the subprocess, we must ignore the failure and +# continue. However we don't silence stderr since there might be other +# useful details reported there in the case of other unexpected conditions. +echo "$test" | cat >"$TRIGGER" || true # Record and dump the results dmesg | comm --nocheck-order -13 "$DMESG" - > "$LOG" || true From patchwork Wed Jun 23 20:39:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 466810 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BF32C49EA6 for ; Wed, 23 Jun 2021 20:39:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 83426610C7 for ; Wed, 23 Jun 2021 20:39:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229938AbhFWUmG (ORCPT ); Wed, 23 Jun 2021 16:42:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229915AbhFWUmF (ORCPT ); Wed, 23 Jun 2021 16:42:05 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7734C06175F for ; Wed, 23 Jun 2021 13:39:47 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id 13-20020a17090a08cdb029016eed209ca4so2116535pjn.1 for ; Wed, 23 Jun 2021 13:39:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9GYkjjOQZ6Rz1pEOIf9K4RSl8mgGGEOKk2i3NOWLjLA=; b=oEmyBdL/O6vMQ+qVWEiW1NRHGzhz4sEKTZMQ6lOUKhPz+NU9pA0qtKyPEmtPkPcJ/T GFg4CLQSRyolenFblesTc/xamKo1azEcNE2e7G52IG9ckEWLkNoNPIZH+lwGdOv+zkLs E2Gz8zf4zFisvYsNtwUM+ePjJm2AW2kZbXzeM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9GYkjjOQZ6Rz1pEOIf9K4RSl8mgGGEOKk2i3NOWLjLA=; b=fIAjN4TN08l19ON9N39Kuz8GCeY/s0S+ZFlm6X2wxdUeQ8Bot0DfXwO2g7iod+5pWq mKU/EPxWksClVcQtCC9gL7uFvaGoaFbNegYt9YkYDSSTZl0lfDhseSDanz4K9XAoJt2p XJG7esf2yoYCyVGjxfGM7XOLjEGxvTM20MR+N5V4nDbL1vVXXvt1skEwqFOLIhmeqaJR 7nahJU+YxFKxKftyWrgTQuXOskkdSlM78UtjDKAlkfj836TWKGXb4DJeTZ7gmVGt8Gfu MtosSGs+x13NBBGCPmWkq1TVRwM8Q7bx8rYN10zHb4fXNa43aCj06i3rYk4SrEU3kpft pVoQ== X-Gm-Message-State: AOAM530ZFYl32FRVldiKnrTZmnpLCY/JfXlImF1iNql/zdULj+Xu5yuC dZ4URuRxr1WIQQ6Yo737f1Wlow== X-Google-Smtp-Source: ABdhPJyiQ1Dq5u49OR3fXAfm+2eccv3ffMdE+z4V+DWcE7R4TT5inmbnDGnEzFjPHHMnRccPE95hkw== X-Received: by 2002:a17:90a:a107:: with SMTP id s7mr11289459pjp.1.1624480787198; Wed, 23 Jun 2021 13:39:47 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id y15sm408790pjy.38.2021.06.23.13.39.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 13:39:45 -0700 (PDT) From: Kees Cook To: Greg Kroah-Hartman Cc: Kees Cook , stable@vger.kernel.org, Guillaume Tucker , David Laight , Arnd Bergmann , linux-kernel@vger.kernel.org, kernelci@groups.io, linux-kselftest@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH 2/9] selftests/lkdtm: Fix expected text for CR4 pinning Date: Wed, 23 Jun 2021 13:39:29 -0700 Message-Id: <20210623203936.3151093-3-keescook@chromium.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210623203936.3151093-1-keescook@chromium.org> References: <20210623203936.3151093-1-keescook@chromium.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=856; h=from:subject; bh=BtO+LH6joKjiA1jPQ0OLj8i4wDaw/FKwTM5xGU6TBl4=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBg05wFD1/rNKnVPI48nDGJ/4Gf4RKsbn3ohaIJBJ1z W+hDT3uJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCYNOcBQAKCRCJcvTf3G3AJgPRD/ 9554BXu8baUchD9pqZuBakcbDtoPvR4mAfpwlKhZmDIAG1GjldVg2qs85A5/51LQ1mPCqv8HQUw/5y JucMju9+zN9hyC0j4+K+mz7kiWWsbTgpvRshpU9z89xohKpQO4RgwEhcJ80nVl+g6G7xtTBM9sZjDr ZsXxJE2vxcrsPc/Jk/ucVWI36iZw/JOrEwliKBaaoVEybyEbNPM9RoOGYTOaBJFPhencB0xSczI1YK ZoykQ09IfaXPfJG1cbYhdwyAU4Yo+oLY3VaWi47ELXLhwp9H4HbI0XpZBqNRlbK0Qd/YFnW614FjI/ f+piK+8e7mlAet+zuWdo9LrPQ84Q6toQSV2Y7YsksdVBY6ZVOfatpEDU3W4eKObM0234oE10xnAzJL nPeO610vI0wZ/OhmzHfwb/ybuomHS+e8L6MH0dYsOTU+5ON6bt8TgnX4clULypm89ihL9BrSEypG5c K+QqcbauDvH3EaLB0tP891W0aQ2f5He2M9QpqlvjIQiPWFHAHRmN5nHQTkWTxrY6sqW11nZll/OS1V +cHUbHbJWW5oiXsToLDOt9JBGoCUyqlqqde6vUoGyZZMU7kB1Cm98asIvoVCgcTFGXFaf3y48e4PrX MjdV0E8cknxC9Dr8pewPuwrhjptu/C8x3lPZeduzmOqHLbqxmVuUGORZ9rIA== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The error text for CR4 pinning changed. Update the test to match. Fixes: a13b9d0b9721 ("x86/cpu: Use pinning mask for CR4 bits needing to be 0") Cc: stable@vger.kernel.org Signed-off-by: Kees Cook --- tools/testing/selftests/lkdtm/tests.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/lkdtm/tests.txt b/tools/testing/selftests/lkdtm/tests.txt index 11ef159be0fd..a5fce7fd4520 100644 --- a/tools/testing/selftests/lkdtm/tests.txt +++ b/tools/testing/selftests/lkdtm/tests.txt @@ -11,7 +11,7 @@ CORRUPT_LIST_ADD list_add corruption CORRUPT_LIST_DEL list_del corruption STACK_GUARD_PAGE_LEADING STACK_GUARD_PAGE_TRAILING -UNSET_SMEP CR4 bits went missing +UNSET_SMEP pinned CR4 bits changed: DOUBLE_FAULT CORRUPT_PAC UNALIGNED_LOAD_STORE_WRITE From patchwork Wed Jun 23 20:39:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 466325 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24809C49EBA for ; Wed, 23 Jun 2021 20:39:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1061A610C7 for ; Wed, 23 Jun 2021 20:39:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230006AbhFWUmK (ORCPT ); Wed, 23 Jun 2021 16:42:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229831AbhFWUmG (ORCPT ); Wed, 23 Jun 2021 16:42:06 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E87E9C061574 for ; Wed, 23 Jun 2021 13:39:48 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id s17-20020a17090a8811b029016e89654f93so4547890pjn.1 for ; Wed, 23 Jun 2021 13:39:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=weOFYHnAt9XHzyijtFN46zZa/bge4PQn7pFxvS+uscM=; b=PINKBfWpr3gvTyJ0eFnAv65n6MifZbR/apDoNhNeYQq+pb7Y+nHfI6/29jpyhKRsrA kSmtPGNKM36+xWmlgXqHNtUo2kVWovxkLqFL92N+B8M0nbpRfCD32Nat5OMJ3EJp3QwV KrPvrHdngyt40imWa1hgx+IPHVy1nFGR4oZAI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=weOFYHnAt9XHzyijtFN46zZa/bge4PQn7pFxvS+uscM=; b=NWqyvIu0Q24OZklcduxA1j86GaVJD8kG9bXWttqZCsH1cCPVRSzy8DVZOI+RHviRZw gmkvt/QQHQ5ZOG/NMgDkB/+iUsVFuufxtOGm/57hTFHtWyA41NxLpIaICVDrB5+XnBSZ lxJ0hkNuFDlsWePRAjEKOamVx9O0L2JcmWEOE3XVSVRsF+j3xk+GzavVH5W+vL1Ibzna ncaLfdgRt29FD0cJgQdJ6JHUMT6UdWQY06/1yyH2WLa7tWEu2S4o4Y2tShlqUUKagYoG dvjbV0+Xyf7UnFEZU8LqudqA9CUZ7XMfQS6hdb66o0UsXWbspuCy83IG0ccUiSXckhMK a7ZQ== X-Gm-Message-State: AOAM532W0NhpIlSyBdmp7mapZf23hcVOV7s+/E2KhiU2DrXPXDTM7iwG 6Nc9rS/qn4S1h29fE/sZZApJQg== X-Google-Smtp-Source: ABdhPJx1ypcWLUnUHJBbnBIjhX9m3ZNAxwtdnMUAu2WOpDwAvnSgoGuRx7tr0mmBARqaMdXFPQlhRQ== X-Received: by 2002:a17:902:c789:b029:110:4933:71ce with SMTP id w9-20020a170902c789b0290110493371cemr1194211pla.56.1624480788561; Wed, 23 Jun 2021 13:39:48 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id f5sm640523pfe.79.2021.06.23.13.39.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 13:39:45 -0700 (PDT) From: Kees Cook To: Greg Kroah-Hartman Cc: Kees Cook , stable@vger.kernel.org, Guillaume Tucker , David Laight , Arnd Bergmann , linux-kernel@vger.kernel.org, kernelci@groups.io, linux-kselftest@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH 4/9] lkdtm/bugs: XFAIL UNALIGNED_LOAD_STORE_WRITE Date: Wed, 23 Jun 2021 13:39:31 -0700 Message-Id: <20210623203936.3151093-5-keescook@chromium.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210623203936.3151093-1-keescook@chromium.org> References: <20210623203936.3151093-1-keescook@chromium.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=821; h=from:subject; bh=Ug1zxBYqfqGVjk6HZPE+S2IQ++k8iErOOapO5olSeEg=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBg05wGnJvmDSLi1MPOx05nkNSD/27SmvDUPYKaSZ+b ABK1bYKJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCYNOcBgAKCRCJcvTf3G3AJhiJEA Ciux3+IGOay7Jw49WbIkgIv0TxSZgcO90q+vD3qxYri5Kve5Gl362F2aW0FCOlOtxfzOnGmC53o+vL mnCazUpoqn0dW/Y15W4dfOo+HoN5/Afr2nMEj2cwPYh7e2v3kQ2/JK4gaqP9mMDegUGCvWynQbQq54 md3YCttGo14SuaAMF9Wgo60xgxde5gIvQadm2WfvXU0BLyeZBBQb/iHJb8A06PBRzIBP06Nu+NmVVS 4gjNsMrbg6ltVcNDZ67UJ4sjzuFEP2hO+bd3d6/D/d7os59xJd11AHlpBYfk1gCBMC4wl/ZHgbOsaY ew49zKobbo1qt1K8F7Yct3U3IZZ9e2Ny/XCdM/rQMR0KlGYK/LXREO8mEubV2DBQzQidihoy2cFwBk 5gEjXn+w2QmsY5GXkuCXxsRXVw90q9IyT0Qt6kyJ44vqmTKpUFpcarqthBP1/2nXx243B73YaVCB12 6nd+koQb1m5NQNvzwZ8i/jObt5py/ucSDlpCVQ/PCl3NUt9sRB0S8MRNKXxgEJuNMGGs/BUSoYK5AE 51LAiLpudvJPuDuLgHUfzx1Ig+tAVem+P/7WoryLM/rDXtXqsXoyyHzBPcZGczV6nPm7xCwdkviySP adfzxjhgaQrqToXPyTkus9c6NYZDhVyUcK6oihTYUAjfRzEQc+F7f3grbaNA== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org When built under CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS, this test is expected to fail (i.e. not trip an exception). Fixes: 46d1a0f03d66 ("selftests/lkdtm: Add tests for LKDTM targets") Cc: stable@vger.kernel.org Signed-off-by: Kees Cook --- drivers/misc/lkdtm/bugs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/misc/lkdtm/bugs.c b/drivers/misc/lkdtm/bugs.c index 0e8254d0cf0b..9ff02bdf3153 100644 --- a/drivers/misc/lkdtm/bugs.c +++ b/drivers/misc/lkdtm/bugs.c @@ -161,6 +161,9 @@ void lkdtm_UNALIGNED_LOAD_STORE_WRITE(void) if (*p == 0) val = 0x87654321; *p = val; + + if (IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)) + pr_err("XFAIL: arch has CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS\n"); } void lkdtm_SOFTLOCKUP(void) From patchwork Wed Jun 23 20:39:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 466809 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CE6EC49EBC for ; Wed, 23 Jun 2021 20:39:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0EE52611CB for ; Wed, 23 Jun 2021 20:39:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229945AbhFWUmL (ORCPT ); Wed, 23 Jun 2021 16:42:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229958AbhFWUmI (ORCPT ); Wed, 23 Jun 2021 16:42:08 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FC16C0613A2 for ; Wed, 23 Jun 2021 13:39:50 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id g4so2207731pjk.0 for ; Wed, 23 Jun 2021 13:39:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=u4Wq1GvZOIjkJl+9Sb3C5gljEm3KHr7dyOq9Nh1kENs=; b=XFDgiA11BlqOZ/s5qZFq8MJlNVnoxfK5CVNFc1wQ+SamMB7fnUnMUUgxxrmEowQujn tChT4z4jt7Dod0HMLYvUcQ5smxaJewfSB0bx0ip0qzErWVrXCz873TRrhXNwq1WgYPh2 J+XbSmnSUcAJVg4aI04DD6Q+X3GDjnShhd/c0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=u4Wq1GvZOIjkJl+9Sb3C5gljEm3KHr7dyOq9Nh1kENs=; b=gKmbhsX9FxUI77SxZ51opbpCviFbtIHsjhl0BKXq/S9flLiaUVLGUQ6ph5Ai3qbt58 cxYUszMK06orzCqD0k93pdnNklK6jUxBKEU3f8FRgBD1+5rlitLziWrpEiIwWPwf3OxS 7Ws2lRUFMGSTCZ532ZmtfIHOLexmQShTu9TDhezCeXRuEGFhANMvzYoixqxCMYcSWeN+ aXO3RfRKbiPVwPN+btg0JiEcXUafMaBS8HTYAdvpEI6u7C5HLc0emtV/noXP33RdbUEf QijqN3NlKSCc3YXJFULq4qc7zmIaC1GubdkZaNC17OpSzAaZ/zHbpVSQtoqlCLsnNhWx XyEw== X-Gm-Message-State: AOAM531qMnQpxQHag6VELnoZIprD7NGPAu/KAKPAarXwJ4cLGyrSYeqo rNpjtCl0I9y2cUbG1l82xT+3Hg== X-Google-Smtp-Source: ABdhPJwaRWpJV0oWeW72e7h8k40qI2L5xwkI1YI4az/SGTiOAfGJgoe0c1chphXJsHy1G3dgvqSphQ== X-Received: by 2002:a17:90b:33c6:: with SMTP id lk6mr11521139pjb.6.1624480790156; Wed, 23 Jun 2021 13:39:50 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id y39sm644828pfa.119.2021.06.23.13.39.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 13:39:48 -0700 (PDT) From: Kees Cook To: Greg Kroah-Hartman Cc: Kees Cook , stable@vger.kernel.org, Guillaume Tucker , David Laight , Arnd Bergmann , linux-kernel@vger.kernel.org, kernelci@groups.io, linux-kselftest@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH 6/9] lkdtm: Enable DOUBLE_FAULT on all architectures Date: Wed, 23 Jun 2021 13:39:33 -0700 Message-Id: <20210623203936.3151093-7-keescook@chromium.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210623203936.3151093-1-keescook@chromium.org> References: <20210623203936.3151093-1-keescook@chromium.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=910; h=from:subject; bh=QfRkdXxwpbuwCkU2UJjVNaH2YmtWo4KLL9a8FrnsAOg=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBg05wGyZpmYK4bGS71//ZU4B8K/PYzebIRU4wL+IO5 4o7WiviJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCYNOcBgAKCRCJcvTf3G3AJirXD/ 9ZdemyXHPgslPcJgT1bRYzqMUwNSL97PXErHRLjYgDkmORiRviHSACWq7BdCf9JHLl+jBeflXOPLZQ AbximpuX/FoB9FKsrHW7PAqWDi25hrM8UFNh/Qru8hNicn5W1byfOBVo36lG7+/+4QKrrpMorYPEsA om3e7YlG5GsVrovAHUHMNWJ5WMcPZAvZJb0D7ESVcVjxhzmYoqccFGJIJpbNQU+MnoaLTs9Iu3PRuV 3q3nzAZIENHOUMQTihH7jEog+oudsw6O4yKRlYsP1+dKYm8HI2+1PBjkUcEx4gmBuvcCOfyaYseu0j 1bdozFFNR+T/Ji8v5ry2S6p/fsoMQTItw57w7xCT/tqZHcpMgddcxy+/QcdE5VnE0oW4Zc3ySiZWZB xfyGeUzLdRHPzcKdIYqflNCMw1VQSUoQNoV/Z6ImPROiSRYk+w0173YAlUNgSjTsP2CV96lhqelPSi RtjbNSRaB0FmDCi5+P0jaXa3lKOxnR4XAOyunOMRds0qwSeGiPWU+a8MWj1dWlDzZWoAgiqHO32CQK 62fMew6TMBnOwvUSFXRq7J8zdEMNoiTO+jF+UhnChwpGrid6O+oLnFe/cjuzWYp5rICy/d03T4yBKD mSq+hoWr7vvnEQpgPh92VHycKploZOSBWMAcAaolOJlskbK4P3hc9IVdTRog== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org Where feasible, I prefer to have all tests visible on all architectures, but to have them wired to XFAIL. DOUBLE_FAIL was set up to XFAIL, but wasn't actually being added to the test list. Fixes: cea23efb4de2 ("lkdtm/bugs: Make double-fault test always available") Cc: stable@vger.kernel.org Signed-off-by: Kees Cook --- drivers/misc/lkdtm/core.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/misc/lkdtm/core.c b/drivers/misc/lkdtm/core.c index 645b31e98c77..2c89fc18669f 100644 --- a/drivers/misc/lkdtm/core.c +++ b/drivers/misc/lkdtm/core.c @@ -178,9 +178,7 @@ static const struct crashtype crashtypes[] = { CRASHTYPE(STACKLEAK_ERASING), CRASHTYPE(CFI_FORWARD_PROTO), CRASHTYPE(FORTIFIED_STRSCPY), -#ifdef CONFIG_X86_32 CRASHTYPE(DOUBLE_FAULT), -#endif #ifdef CONFIG_PPC_BOOK3S_64 CRASHTYPE(PPC_SLB_MULTIHIT), #endif