Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp6209092rwb; Tue, 9 Aug 2022 10:57:17 -0700 (PDT) X-Google-Smtp-Source: AA6agR4SU3GlN92On5iyvpiyM4WMrQ5ozVupe4Elu8MXBDvPGqVc9cFDK7FMMY6M7a2ZxVVHyVBV X-Received: by 2002:a05:6402:331d:b0:43d:9e2e:6966 with SMTP id e29-20020a056402331d00b0043d9e2e6966mr23349374eda.214.1660067837209; Tue, 09 Aug 2022 10:57:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660067837; cv=none; d=google.com; s=arc-20160816; b=li1+VqjQOrUITvUV039RkH6Iff1RdlAcBQWJfkVUj+sN4Jju9sL6Isk500pch7oR2k 5kAw4fs35+gR507esXOBNRprxEEa2Vuhyx87Mf43ZBXmWXYk5uiuMKMn6gEg3P9hmRcD +0QBd7iwPhdIw5qLgY4uLNOkshLKGzE5Tw071i6K/oHt3LZaZ+CZmzIQO9N2Tu2yrroW q2vKAZjcCLTBeGM8OT7DSYvc7ljiD0LWHp3THIBG5Z7W3PeEn20J+XUtoOWZsOBdvxaK IKE0bqpIMPf+iE/0ecsh4QLUjADZEemb/6KZ8cYSp6J8Xoz7k513eUiZWjsbVCnw0Jlu xxKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=FrHzlixcS1FrSu9iA6VWLEjUzH4K4SCNdB82J7P9I/I=; b=XlqU9K+/01E9GMMWVsbmrlur3cLlI4d5Ekd26FMoBl6psYq+OmQiyGwWN+Z1zcuo+H B6XMTb7CBsgZwxiSRUuMkPFNc38TNwIUTyvEOINfethcqUlceRFw0gHvtZafhXMDSXIZ EAMB4euyAD0eORdOP4Nn26aPzOonpNb6siRXIiYvmAr8brAGmY6hGc8PwYffkDwgUALW ZbShhlmv285VXEH+suItd1Z63aHyWFl+7KyE6roilkHVOFvKPhjeMPff/ULzf+RToZ2i DUDIp3aCtWvRQyLXekQ1UW/yJsYPzY92xPt7UuVqo60xT2ggNchnCrxKHgD+KJOfItHz Phtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=OSubONaK; 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 r23-20020a056402035700b0043dd69d310fsi8442036edw.622.2022.08.09.10.56.52; Tue, 09 Aug 2022 10:57:17 -0700 (PDT) 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=OSubONaK; 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 S244838AbiHIRtD (ORCPT + 99 others); Tue, 9 Aug 2022 13:49:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233963AbiHIRtC (ORCPT ); Tue, 9 Aug 2022 13:49:02 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B3F3237D2; Tue, 9 Aug 2022 10:49:01 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id a7so23547319ejp.2; Tue, 09 Aug 2022 10:49:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FrHzlixcS1FrSu9iA6VWLEjUzH4K4SCNdB82J7P9I/I=; b=OSubONaK/J343gxVF4lFuOplXjLk5hLPnbz1r0dnlzwS0KIHNtaTcs/DhUzBCip1GC cDq6EciZP0ICzJSoSQ+pJBkd2AB+pPu7V+n5FSXm2gWA19KAvkGNytIPUzfl/Ny6vxyh QYt8UDX1zBmxqJl6SAV/1AsE6jFFHSwy7quxRGKkAFEvc3NGJIk15W/uB4cu69X6beWG x/PRTBPNC1udHeBhJ7a+4rC+JlxLiJYjJm48QV2S5qz3gyZffjMdBRY8yZbmTCpFB0D5 1dJjfvFMY3IpsCm00oOkkc4eny6//rNj7GjVm732f750sxr18hIOVFF8F5JlMo3ydMz1 aWQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FrHzlixcS1FrSu9iA6VWLEjUzH4K4SCNdB82J7P9I/I=; b=MtcAzIrsgIr46Z/0t5IVKlof+pSBTfJdcQLybhLctHWieIE/wTrMpji11ZDtNWqzVY os1DMbrDMN9LfrkPeeC/96urnfQEGwzdsC88TGGvyN7KxNbYc9ek7h4+323rvLfrNjB+ GGvnHLmnsAZ9PQLNBNz63TYAbZT+nQnpXtteCWDlhJengIBf3dZG7okqP1Njkdg3l7x0 T1ICPBbvZEAuJvogtI1t8yy/qrMuMbouwi4il+vxEqNX0EO756BXfLJIDzqBxUChUJQg hXXiDf8tIQ6CWK7SDXxcW1AgRU5fMAvifderzbfZCYromfyB4huRBIJG3xeINTxP6cHU orLQ== X-Gm-Message-State: ACgBeo0D8kA+iju7aC3mcVpMUVtYjRsagNwL8I1YWvWrD6UlQYHI9l+R nJtfi0WAuP2MoYhpqcMidT9i7+WCntiXbHW19ZI= X-Received: by 2002:a17:907:7b94:b0:731:1b11:c241 with SMTP id ne20-20020a1709077b9400b007311b11c241mr12654037ejc.676.1660067339882; Tue, 09 Aug 2022 10:48:59 -0700 (PDT) MIME-Version: 1.0 References: <20220809105317.436682-1-asavkov@redhat.com> <20220809105317.436682-3-asavkov@redhat.com> In-Reply-To: <20220809105317.436682-3-asavkov@redhat.com> From: Alexei Starovoitov Date: Tue, 9 Aug 2022 10:48:48 -0700 Message-ID: Subject: Re: [PATCH bpf-next v4 2/3] bpf: export crash_kexec() as destructive kfunc To: Artem Savkov Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , bpf , Network Development , LKML , Andrea Arcangeli , Daniel Vacek , Jiri Olsa , Song Liu , Daniel Xu , Kumar Kartikeya Dwivedi Content-Type: text/plain; charset="UTF-8" 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,T_SCC_BODY_TEXT_LINE 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 Tue, Aug 9, 2022 at 3:53 AM Artem Savkov wrote: > > Allow properly marked bpf programs to call crash_kexec(). > > Signed-off-by: Artem Savkov > --- > kernel/bpf/helpers.c | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c > index 1f961f9982d2..103dbddff41f 100644 > --- a/kernel/bpf/helpers.c > +++ b/kernel/bpf/helpers.c > @@ -1711,3 +1711,24 @@ bpf_base_func_proto(enum bpf_func_id func_id) > return NULL; > } > } > + > +BTF_SET8_START(tracing_btf_ids) > +#ifdef CONFIG_KEXEC_CORE > +BTF_ID_FLAGS(func, crash_kexec, KF_DESTRUCTIVE) > +#endif > +BTF_SET8_END(tracing_btf_ids) > + > +static const struct btf_kfunc_id_set tracing_kfunc_set = { > + .owner = THIS_MODULE, > + .set = &tracing_btf_ids, > +}; > + > +static int __init kfunc_init(void) > +{ > + if (register_btf_kfunc_id_set(BPF_PROG_TYPE_TRACING, &tracing_kfunc_set)) > + pr_warn("failed to register kfunc id set for BPF_PROG_TYPE_TRACING\n"); Please drop pr_warn. We don't have it in all other places where we do registration.