Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4463586rwb; Mon, 21 Nov 2022 07:55:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf6RrzZxFH23YRFjABH/vbmjs9swSMolqE1udMb+xjGGibVo8a+Dkdt+jIXqZN0mskIvM5Rx X-Received: by 2002:a17:906:4997:b0:7ae:ec5c:a99e with SMTP id p23-20020a170906499700b007aeec5ca99emr15602843eju.219.1669046103449; Mon, 21 Nov 2022 07:55:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669046103; cv=none; d=google.com; s=arc-20160816; b=Zmp2LczPdyjERg7BVHzi+Fe76w9eXvV3qv6v2UkLQJstLyk/dUaPv/CpwoMCTsJUXO tAu4MBxJoDQVeBkeWpYWjhsa07/vDidzYtBE3C++iL1UQUywN1nnD9/vnocgEdEfFF8j Dkpc8HcqfWQNWn8yPyrJdyV6s1I7Cw3ZT61ifO3MRpmVV0m8b7HL4OxY/ARnx8Fom/tf DKhnldxYNWK558MYnhknCpC2Nb5oyb0bQue0OBzKwYES+7CYbwmPKw2VwPSoWcGiImjz bEHgIX5N1NkZ3rS4N8jTFibLFUYEUxsJD6expHko/1ofHvwZa6UnUJpiloV6SIGq+l8P UqpA== 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 :message-id:subject:cc:to:from:date; bh=t/VbDmj2MOTi4wdMzZGg5B8szOYvx6l5tiyGnvKZCW8=; b=rcX7jN2bMtkV3v1/y33IEmkvPFCEpnYgUc2e0pnLCf3Xk/ZyRqaAqRtcnzTmd9w46e ZgeBFOh/IQegI8pkrCZGzmysSzSGWQRFAqA9UDt5iurt0976AkbCppG4ED2uOP4LlkhZ jwzXkPwemiq50P4nqMr+twtU94L8us04hsQziCxjxZWuFME30Xr4fkg6Lhy4KLDRju7n 2kX4+omeNP3cqTeT0ra7qkuOcOQOrmbr90By6KCMq/Hq8cOdXgBV6MXxg5gF2q9yKJfL mGTwEAZq2lYFAZLnprHMERZ7/gpE3Xb8qMVvTb5U2TyMmgQtom0QCfnJaor9JIshDj9c uIbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w13-20020a170906130d00b007ae664aa7dbsi8429229ejb.877.2022.11.21.07.54.40; Mon, 21 Nov 2022 07:55:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231755AbiKUPpD (ORCPT + 91 others); Mon, 21 Nov 2022 10:45:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232255AbiKUPo3 (ORCPT ); Mon, 21 Nov 2022 10:44:29 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D43DCD97D for ; Mon, 21 Nov 2022 07:44:07 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0490C612CB for ; Mon, 21 Nov 2022 15:44:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAACDC433D6; Mon, 21 Nov 2022 15:44:04 +0000 (UTC) Date: Mon, 21 Nov 2022 10:44:03 -0500 From: Steven Rostedt To: LKML Cc: Linus Torvalds , Masami Hiramatsu , Andrew Morton , Peter Zijlstra , Kees Cook , Josh Poimboeuf , KP Singh , Chris Mason , Mark Rutland , Alexei Starovoitov , Florent Revest , Greg Kroah-Hartman , Christoph Hellwig Subject: [PATCH] error-injection: Add prompt for function error injection Message-ID: <20221121104403.1545f9b5@gandalf.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 From: "Steven Rostedt (Google)" The config to be able to inject error codes into any function annotated with ALLOW_ERROR_INJECTION() is enabled when CONFIG_FUNCTION_ERROR_INJECTION is enabled. But unfortunately, this is always enabled on x86 when KPROBES is enabled, and there's no way to turn it off. As kprobes is useful for observability of the kernel, it is useful to have it enabled in production environments. But error injection should be avoided. Add a prompt to the config to allow it to be disabled even when kprobes is enabled, and get rid of the "def_bool y". This is a kernel debug feature (it's in Kconfig.debug), and should have never been something enabled by default. Cc: stable@vger.kernel.org Fixes: 540adea3809f6 ("error-injection: Separate error-injection from kprobe") Signed-off-by: Steven Rostedt (Google) --- lib/Kconfig.debug | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index c3c0b077ade3..9ee72d8860c3 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -1874,8 +1874,14 @@ config NETDEV_NOTIFIER_ERROR_INJECT If unsure, say N. config FUNCTION_ERROR_INJECTION - def_bool y + bool "Fault-injections of functions" depends on HAVE_FUNCTION_ERROR_INJECTION && KPROBES + help + Add fault injections into various functions that are annotated with + ALLOW_ERROR_INJECTION() in the kernel. BPF may also modify the return + value of theses functions. This is useful to test error paths of code. + + If unsure, say N config FAULT_INJECTION bool "Fault-injection framework" -- 2.35.1