Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2792514rwb; Fri, 2 Dec 2022 15:23:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf7zvy1avJ85fl6W32/UZFSdLFv50gpbRDpPRP4Ezb/sca1RiwNJjbSFA3KU6faaNSY/gzbz X-Received: by 2002:a17:90a:6382:b0:219:fbc:a088 with SMTP id f2-20020a17090a638200b002190fbca088mr39568370pjj.162.1670023417507; Fri, 02 Dec 2022 15:23:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670023417; cv=none; d=google.com; s=arc-20160816; b=gz1sttTTEBo7nu/tovGSlxW7DQUpT8BNTIJYXGvT96VQ69GDWjDVBfBIJ41FAt7a0m mW/FPkpqRSR5behQWOD8gs5ZPyatY0oS+GxS16wI8FrEleyfb+wAjqOkXPF9LiSm9z5U pl16eQuBK9m2gc86Pp/7zmO0xEXxW+eXsr28vK2A8dzbwrcgB3j4xo79Ox8k3iWjXpe9 b2ZlK7/WUBriFkDqGcrQCXqXQUa5i6cfKMLmKAyBJkF4DOufJHKtZWf9mMfA7cVDn0iL xVtZvL/965v/8tjFDPGa9tYyzDQrUTjF/pj4gK6XuSDw4UBuZ/zvT5noECPl4pLBqIS2 XC+Q== 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:subject:cc:to:from:date; bh=wX7Ig/luwJEbsPbZKdq1M5fGmZMIwY4XT7NXEFlrSVY=; b=StPUzQDb4DaTuYqrH6kY5FwwzVsJzdzpesyMeafCHl7zDxrYPg/J2erN/n8UgIW2UI //cRTHOr9P5q3QCuhUzKe/JonG00vrf313BShZCIpu6EBvxGlEc8TMNrzsdcuktkcpQD AcYcJa3eXqpzwPAwTeKc+KoIHuSpKHAn374gy69tdD+4tUUNSQYDmujylWrPSzPQb4b2 zBJztyPhXRWpmIXV7vaA9dSd3p4+96523wSZoHpo2rZVhPFgQX1TJrBxt7ArTDOyB9PH 3FPtg1ZArM0h+xIkiT7w5657mcrByqXV1N/F9OuWk0MgZvOic48kTjaKwJSFGeFbgF+e yNLg== 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 v185-20020a6389c2000000b004774b5b58cesi8424650pgd.876.2022.12.02.15.23.26; Fri, 02 Dec 2022 15:23:37 -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 S234698AbiLBXRe (ORCPT + 82 others); Fri, 2 Dec 2022 18:17:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233931AbiLBXRc (ORCPT ); Fri, 2 Dec 2022 18:17:32 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75992F7A17 for ; Fri, 2 Dec 2022 15:17:31 -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 ams.source.kernel.org (Postfix) with ESMTPS id EB8F1B8226A for ; Fri, 2 Dec 2022 23:17:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8456CC433D6; Fri, 2 Dec 2022 23:17:26 +0000 (UTC) Date: Fri, 2 Dec 2022 18:17:24 -0500 From: Steven Rostedt To: Alexei Starovoitov Cc: Theodore Ts'o , Linus Torvalds , Andrew Morton , Chris Mason , Borislav Petkov , LKML , Masami Hiramatsu , Peter Zijlstra , Kees Cook , Josh Poimboeuf , KP Singh , Mark Rutland , Florent Revest , Greg Kroah-Hartman , Christoph Hellwig , Benjamin Tissoires Subject: Re: [PATCH] error-injection: Add prompt for function error injection Message-ID: <20221202181724.4ec93cf0@gandalf.local.home> In-Reply-To: <20221202212711.5ot66apmazm4yz6y@macbook-pro-6.dhcp.thefacebook.com> References: <3fa8ec60-dd96-c41f-ea46-8856bf855949@meta.com> <20221122132905.12a8d5ad@gandalf.local.home> <20221130143719.07e36277d1471b83e9a1b627@linux-foundation.org> <20221202014129.n5lmvzsy436ebo4b@macbook-pro-6.dhcp.thefacebook.com> <20221202212711.5ot66apmazm4yz6y@macbook-pro-6.dhcp.thefacebook.com> 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 On Fri, 2 Dec 2022 13:27:11 -0800 Alexei Starovoitov wrote: > --- a/lib/Kconfig.debug > +++ b/lib/Kconfig.debug > @@ -1874,8 +1874,12 @@ config NETDEV_NOTIFIER_ERROR_INJECT > If unsure, say N. > > config FUNCTION_ERROR_INJECTION Why not just call this "ERROR_INJECTION" having this be FUNCTION and the one for functions be FUNC is confusing. > + bool > + > +config FUNC_ERROR_INJECTION > bool "Fault-injections of functions" > depends on HAVE_FUNCTION_ERROR_INJECTION && KPROBES > + select FUNCTION_ERROR_INJECTION > help > Add fault injections into various functions that are annotated with > ALLOW_ERROR_INJECTION() in the kernel. BPF may also modify the return > @@ -1883,6 +1887,17 @@ config FUNCTION_ERROR_INJECTION > > If unsure, say N > > +config SYSCALL_ERROR_INJECTION > + bool "Error injections in syscalls" > + depends on HAVE_FUNCTION_ERROR_INJECTION && KPROBES > + select FUNCTION_ERROR_INJECTION > + default y IIUC, Linus prefers everything to be "default n" unless there's a really good reason for it. Like only making other options available, but not doing anything to the kernel. I do have DYNAMIC_FTRACE as "default y" but that's only because it depends on CONFIG_FUNCTION_TRACER and nobody that enables that should have DYNAMIC_FTRACE off (except for academia). > + help > + Allows error injection framework to return errors from syscalls. > + BPF may modify return values of syscalls as well. And here's the thing. If BPF returns anything *but* an error, then this is a misnomer and incorrect. Name it something else like "HIJACK_SYSCALLS". > + > + If unsure, say Y And I'm curious, why Y if unsure? -- Steve > + > config FAULT_INJECTION > bool "Fault-injection framework" > depends on DEBUG_KERNEL > diff --git a/lib/error-inject.c b/lib/error-inject.c > index 1afca1b1cdea..9ba868eb8c43 100644 > --- a/lib/error-inject.c > +++ b/lib/error-inject.c > @@ -71,6 +71,10 @@ static void populate_error_injection_list(struct error_injection_entry *start, > > mutex_lock(&ei_mutex); > for (iter = start; iter < end; iter++) { > + if (iter->etype != EI_ETYPE_SYSCALL && > + !IS_ENABLED(CONFIG_FUNC_ERROR_INJECTION)) > + continue; > + > entry = (unsigned long)dereference_symbol_descriptor((void *)iter->addr); > > if (!kernel_text_address(entry) || > @@ -189,6 +193,8 @@ static const char *error_type_string(int etype) > return "ERRNO_NULL"; > case EI_ETYPE_TRUE: > return "TRUE"; > + case EI_ETYPE_SYSCALL: > + return "SYSCALL"; > default: > return "(unknown)"; > }