Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6264265rwb; Mon, 5 Dec 2022 09:52:52 -0800 (PST) X-Google-Smtp-Source: AA0mqf5OqmRrfaI4rNWCHwu89bE7iLXpZvxncwUe4thod3mrn2NYi3A9UaXUG0kZVYyHXfxBd3MZ X-Received: by 2002:a63:e612:0:b0:478:6e95:1b1c with SMTP id g18-20020a63e612000000b004786e951b1cmr20184113pgh.8.1670262771992; Mon, 05 Dec 2022 09:52:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670262771; cv=none; d=google.com; s=arc-20160816; b=KWUJSlIoThEeb+xs8nwDOq6cVAyWxl/7c0z2xMQJVhDpz5H7L4DQXRj8wF7GMVVs1o hWhjOOjl1q67MPfNAr+pQTmq1K8kv+FZDBI713VcxAcrk+v52bRl7cwfAvuUn5XMMPfd RsE3fMpSv1ECFEK8ouVYcuOid/32FiGmcOeVlzw3yt4eiuq3aWIbzesY1n+5Ft2tc46G FokUhp691IHudNMx8nkA27ZyLqo3yXxMS8cqYFMhdbjd9ERAYRcdmwytd2q17bVaV1eP TEew4dx2ErWrKXNUXMlzfbG8m6/FXUA95L5YTFSVCflSkOjixDnpmperWZXdpLiMK9/O pCYQ== 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=8lLV7QRgk8RIPtXoZq0XZGuH6npXHy5x8jTIGXYeX1g=; b=cS3B4gAByKlK4UAFhZk3ys2D0XuOeavjUmjori+wwk+e8QTM7rrn7dze59tTF4CvhH zl7GXxLQ6HdvZlQUpNCzdjj+X4pgS2zLTj+M7qmRqxFlGl0JLPwmfAQAen/ugIjNVYqp T2kl9/mTj7Tin6KDFWbSbc4P4XVlmWtWfg3ikEZelFXxxTvofiLvfZfHFH0Urs97jUaA wF4cppfEv60WNS5HghWoZiViVjR3fVPK60jqpenkyOfFJfr5ILMV1pqPtr4SDvuGxQVj Al49Ve/uG3Ih2Yp09sgSktn5e+wRiWuhEXAYmpJgZJH8xsIFaLzcM/r7GVZt1J8fkU4d VyTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VUxQzQ9O; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lx7-20020a17090b4b0700b002193ad201a8si16506276pjb.138.2022.12.05.09.52.41; Mon, 05 Dec 2022 09:52:51 -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=@redhat.com header.s=mimecast20190719 header.b=VUxQzQ9O; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230108AbiLERDH (ORCPT + 81 others); Mon, 5 Dec 2022 12:03:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230090AbiLERDF (ORCPT ); Mon, 5 Dec 2022 12:03:05 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3307BDED5 for ; Mon, 5 Dec 2022 09:02:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670259719; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8lLV7QRgk8RIPtXoZq0XZGuH6npXHy5x8jTIGXYeX1g=; b=VUxQzQ9O21ywJWCswjCwGL4OagFFHWyUd7gE+p0XlLa6zy0Bz+U2rY4WwqnLCMPt/GvEmC lqZHbfBLCBSxUBNh98dkkOySxWClqhwzK7f0VusjtOHF4IyaOVfGQiqbIq7bCwlXpvL7xn yU52WIknMfhA0+HZ59T2PKqLIvexkVU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-5-2bncyKoiNjyj81TIxkiCkA-1; Mon, 05 Dec 2022 12:01:56 -0500 X-MC-Unique: 2bncyKoiNjyj81TIxkiCkA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3C42886C053; Mon, 5 Dec 2022 17:01:42 +0000 (UTC) Received: from mail.corp.redhat.com (unknown [10.39.194.203]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 94E62112131E; Mon, 5 Dec 2022 17:01:39 +0000 (UTC) Date: Mon, 5 Dec 2022 18:01:34 +0100 From: Benjamin Tissoires To: Alexei Starovoitov Cc: Linus Torvalds , Andrew Morton , Chris Mason , Steven Rostedt , Borislav Petkov , LKML , Masami Hiramatsu , Peter Zijlstra , Kees Cook , Josh Poimboeuf , KP Singh , Mark Rutland , Florent Revest , Greg Kroah-Hartman , Christoph Hellwig , Jiri Kosina Subject: Re: [PATCH] error-injection: Add prompt for function error injection Message-ID: <20221205170134.tbq3c3bhxvdx6pgp@mail.corp.redhat.com> References: <3fa8ec60-dd96-c41f-ea46-8856bf855949@meta.com> <20221122132905.12a8d5ad@gandalf.local.home> <20221130143719.07e36277d1471b83e9a1b627@linux-foundation.org> <20221202193039.jle5fek5t5tff2lp@macbook-pro-6.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221202193039.jle5fek5t5tff2lp@macbook-pro-6.dhcp.thefacebook.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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 Dec 02 2022, Alexei Starovoitov wrote: > On Fri, Dec 02, 2022 at 03:55:38PM +0100, Benjamin Tissoires wrote: > > > > > > On 12/1/22 22:13, Linus Torvalds wrote: > > > On Thu, Dec 1, 2022 at 8:59 AM Alexei Starovoitov > > > wrote: > > > > > > > > The hid-bpf framework depends on it. > > > > > > Ok, this is completely unacceptably disgusting hack. > > > > [foreword: I have read the other replies, just replying to this one > > because it is the explicit ask for a fix] > > > > > > > > That needs fixing. > > > > > > > Either hid-bpf or bpf core can add > > > > "depends on FUNCTION_ERROR_INJECTION" > > > > > > No, it needs to be narrowed down a lot. Nobody sane wants error > > > injection just because they want some random HID thing. > > > > > > And no, BPF shouldn't need it either. > > > > > > This needs to be narrowed down to the point where HID can say "I want > > > *this* particular call to be able to be a bpf call. > > > > So, would the following be OK? I still have a few concerns I'll explain > > after the patch. > > [...] > > > > While this patch removes the need for ALLOW_ERROR_INJECTION it has a > > couple of drawbacks: > > - suddenly we lose the nice separation of concerns between bpf core and > > its users (HID in my case) > > - it would need to be changed in 6.3 simply because of the previous > > point, so it is just a temporary fix. And third, it was bogus because the check_attach_modify_return() test was inverted. > > Agree, but it works short term. > A silver lining is BTF_SET approach consumes 4 bytes per mark > while ALLOW_ERROR_INJECTION consumes 16 bytes for struct error_injection_entry > and then another 48 bytes per mark for struct ei_entry. > > An alternative would be to define a known prefix like "bpf_modret_" > or "bpf_hook_" and rename these three functions. Not a big fan of that idea, sorry. It would work, for sure, but I don't want to prefix my subsystem API by "bpf_modret_" which would make it look like it is not part of my subsystem. > > Then there will be no need for #include in bpf core. So I took your other advice to look into register_btf_kfunc_id_set(). And given that the internals of kfuncs are no more than a binary list of ids, we can easily adapt it to have a better API to declare which functions are fmodret. See [1] for the new series. The net benefit are that now we can declare those functions outside of any ALLOW_ERROR_INJECTION, outside of bpf-core, and also we can tag sleepable ones which was not the case previously. So I am rather happy with that v2. I'm sure there will be bikeshedding, but this one looks better than my previous patch here. > > > So I am not sure if this would qualify HID-BPF for 6.2. Please speak up. > > Since that was the only thing I think it's fine to stay in the queue. My plan is to see if we can get this validated in the next 2 days and if not, drop it from 6.2 and reintroduce it in 6.3. After the weekend I realized that delaying HID_BPF for one more release was not too much of an issue in the end. Cheers, Benjamin [1] https://lore.kernel.org/all/20221205164856.705656-2-benjamin.tissoires@redhat.com/