Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2939565rwb; Fri, 2 Dec 2022 18:20:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf6dNcwc01XajHNjfwyjAZHNeHdhp95EPPU8JjkaO+sZLdJmxMG+WXfM9TOkCVntlSFwFrYv X-Received: by 2002:a17:906:f0da:b0:7c0:d609:4120 with SMTP id dk26-20020a170906f0da00b007c0d6094120mr1037505ejb.320.1670034033219; Fri, 02 Dec 2022 18:20:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670034033; cv=none; d=google.com; s=arc-20160816; b=qyCALMmlDkStVCZ8ZfA99S96C1UC5vxdjM+CUNBJk0afuD9oTUJtLFD4f/Wu1aUf3j eHvqbJMNXSO7XvpOoZgQ0A+w5nznctPvaPyC9nfMfoQIs0bm21Cee0Ey025X67tMmE2s SsT62fwFI24fQEEJEG5RzQ9SavjV/BiXDU++KXZFg2QBbMFANPqYFE8E0UQm/fyHXDjN DWIg/S31PG6WvYQHlN+TCRn1QZFti/jCfTsNQtP5FxiIlcdzgZEZyZ4k2idP2/hV2CJO 6oPCiui8ADdZa3oEqGt6MGBN7Kfq8ygGGfjrfwGDOHBIE9FYQOQc1oi1/1pYWoZJPZHr pxDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=MYhOSAAecw5hMoG44eS+mB/LIIFEkB0A8/BXG3TWxmw=; b=oWgJrgS0Cxy+6E5OuHWb3qDLCh5ilbyyX0HZNvueZyUsJtnIgmcJsJgPydw+C8POhb 13r8CuzXeOd2Q5Bzck98q7d77sM8ENYzXXyXhn/mPGgb91pgkAPB+5BnQC8BdLKn8eti W1sD1+QxlX70OeKTn1//cOea41Ikz7+1hEcZPPdjTjmPAS+kBfZiX9zVJNnmVWxRaPGH lMdbZekIf09euUvVvo+uQZkRw6f0nB9p/4ntOTu1+HMxeTWOpsLh2b50A6NHcG99x4aE Otf0FvSrsmMLlowhGE9Tb/X20Jooy+b+rvXxGT91V0L1HBmsXXPNbIixzL1dhPgmPSdN +DZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="gWZT/4OZ"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xg12-20020a170907320c00b007ae5b41855fsi5340028ejb.895.2022.12.02.18.20.13; Fri, 02 Dec 2022 18:20:33 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b="gWZT/4OZ"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234962AbiLCAzh (ORCPT + 82 others); Fri, 2 Dec 2022 19:55:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235054AbiLCAzT (ORCPT ); Fri, 2 Dec 2022 19:55:19 -0500 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AF56101D3 for ; Fri, 2 Dec 2022 16:55:12 -0800 (PST) Received: by mail-pf1-x436.google.com with SMTP id 21so6411016pfw.4 for ; Fri, 02 Dec 2022 16:55:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=MYhOSAAecw5hMoG44eS+mB/LIIFEkB0A8/BXG3TWxmw=; b=gWZT/4OZ9cDZ4JFrR8F90PCn8KydHDcemskto7lMnUujpX0OnOktV2KWL360pPMsUs WqiVpJcCNBK47h5SBYeOeZIMiUSgDLQrOC0nIxHlXFtAqh2dgQY3vITG0Mg2hGvigiSF p8iF4r2Kebkar9gzUA5lWix+HvENA6dBoXtMQcgx8SDCBbekZrDRu0X6IL5PNv9ad0wX UDApnGl0qtrq/MBxiUFoTStXBSRmMXF3lRqVrhqV0cMTb2EOZCtwDkZwxAMyj+xexgmw FQ+mRzRej8wFWx/hVfzlNxqi2fCAn6eJtR0Eoepm0CxQIdeFae7SpLk5ouxGbOzTO4dn wTKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MYhOSAAecw5hMoG44eS+mB/LIIFEkB0A8/BXG3TWxmw=; b=az5iRYG38YBZUchRIoU9fGc1eVI8gaNDUHZG5E2NYb2GqaiqfOkbehXj9cpOBQhiHK Bh3BAC70YgpfUY927Pxi2Llsy/lmR7GzyaOjiXd20D/tLqO6j3ng3lgwsW+Npgy+SjeR xPKHKZhyja/DCLL+rLS4RGe9wOTLVla3LP6IW62CTz3w5YVRUYZhv2BjadLfsG7H0/o7 pR60NAX8ONl+REvefJyOnOdl20t6p2DSo6SdZZYYc+xxHAteXSjdtqsx/TlPw+wTrHo2 efQvo3FUvquq0RpHbaWyNn3JLnOFzFRjsDTKPufZyyT+FQ95UPlVk21ESXH6Qpu35uPy riUg== X-Gm-Message-State: ANoB5pmCXJrpNK8LkjkQIj9SSQeWu+1A4f/ao9nZIS0LhhoLcPuVO9+I WbVRnoahhlnQwZGw3CCOsrte2htRfyA= X-Received: by 2002:a63:5802:0:b0:46f:59af:c1f4 with SMTP id m2-20020a635802000000b0046f59afc1f4mr47473044pgb.344.1670028911589; Fri, 02 Dec 2022 16:55:11 -0800 (PST) Received: from macbook-pro-6.dhcp.thefacebook.com ([2620:10d:c090:400::5:c181]) by smtp.gmail.com with ESMTPSA id ik25-20020a170902ab1900b001869b988d93sm6081148plb.187.2022.12.02.16.55.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 16:55:10 -0800 (PST) Date: Fri, 2 Dec 2022 16:55:07 -0800 From: Alexei Starovoitov To: Steven Rostedt 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: <20221203005507.szqy2o7sogqmfjsz@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> <20221202181724.4ec93cf0@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221202181724.4ec93cf0@gandalf.local.home> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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, Dec 02, 2022 at 06:17:24PM -0500, Steven Rostedt wrote: > 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. That's what I had initially, but it causes plenty of churn to arch/*/Makefile and a bunch of .h-s. Keeping it as FUNCTION_ERROR_INJECTION removes all that noise from the diff. > > + 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). The FUNCTION_ERROR_INJECTION used to be "def_bool y" for ~5 years. BTW the macro was called BPF_ALLOW_ERROR_INJECTION() when Josef initially implemented it. Massami later renamed it ALLOW_ERROR_INJECTION() and allowed kprobes to use it. Today there is a user expectation that this feature is available in the kernel. We can do "default n" here, let distros decide and potentially upset users. I don't feel strongly about that. > > > + 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". The bpf prog must return errno. No doubt about that. Today the verifier validates return values whenever is necessary. When original bpf_override_return was added the verifier wasn't that smart. Since then we added return value checks pretty much everywhere. Looks like the check is still missing bpf_override_return. We will fix it asap. > > + > > + If unsure, say Y > > And I'm curious, why Y if unsure? Copy-paste. I can remove that line.