Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2463326imn; Tue, 2 Aug 2022 03:55:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sBh7Zu4NqnjgA7aRBNWwixhkzE4vZu0DokqRvrYRZaf8Mh3pAkIeotjT143e1B+g/CeVNO X-Received: by 2002:a05:6402:1e8a:b0:43c:570d:760f with SMTP id f10-20020a0564021e8a00b0043c570d760fmr20667239edf.109.1659437759353; Tue, 02 Aug 2022 03:55:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659437759; cv=none; d=google.com; s=arc-20160816; b=ael+weOt5/cPwJkRLkPhqV2mCxwu+UTaQ8qBJ2y8QgRxhxdLVAu8GgkKZYZZVu2vsZ umZKwRNReM0JQOKhHFLoWo2n3DfFEMwpD4/duh8jM1p4ti72c1yA+gBeNQAF0PO3E0rG A7BHRMP/tVcqdqoZDXZ6uhKZNvfUQfV59DqTE94SCdU7fzNbNYqtjZgnbgwZQ4Op0RZ7 NhMa1ITZAOClKkIHkx7/s3+Ao/yeC+QVRLBHoXMZF7Xq+iaUAsvSg9z86N5+ahfNsFVX Kecob6ajflLZlLMmJnGeeLJ9K5F31HzE9vVv8eAufZycJoxeoA7nzF3+TMYFQr0PMXzD 9u/A== 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:date:from:dkim-signature; bh=wNgs28xMH7P4/J+xTsAzXIZ/DZk8ZXnVD1xPtOOGx20=; b=wNLbs7N/H1X+fN+7Dc/W70MVqbJRga2SH4iB8KL9d/KWKKRxi7CrhP0H+ePQdLTwn4 d2hWxFZTPwuYpSxJLOj3HKMJVhJUVBlPYMp21rStBDr8GXDvaHdOWGL53ZejSW0xCq95 b+9Rtys4pa06cnEcyiImuiT4y8AkA8dJ+bAgKvqh3xTi/F3GmXwUOnzPWawO19Reldl4 CG2YNLqoV27prNmPaPE0MwJvLDhkdot4Z9wRPCGVU+jbytW+Dht+BqmKH52e8T0VxAFX GYlB9prXbGdzgd4VJaOOAiz6GHaedsWFmw9o+2XjfDoo/lyZ81de6kCuw9aP8JeopwjD J5NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gMb9guQn; 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 b14-20020a056402278e00b0043dcd35db2dsi3811846ede.80.2022.08.02.03.55.34; Tue, 02 Aug 2022 03:55:59 -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=gMb9guQn; 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 S236581AbiHBKq6 (ORCPT + 99 others); Tue, 2 Aug 2022 06:46:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236615AbiHBKqv (ORCPT ); Tue, 2 Aug 2022 06:46:51 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEDBD1C90C; Tue, 2 Aug 2022 03:46:45 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id s11so5661506edd.13; Tue, 02 Aug 2022 03:46:45 -0700 (PDT) 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:date:from:from:to:cc; bh=wNgs28xMH7P4/J+xTsAzXIZ/DZk8ZXnVD1xPtOOGx20=; b=gMb9guQnlNxv2nBW81Awg+qz7xg4fC2pZ4hXvsUIRLA3UpnujXG5CWujpTmNRW8NG2 nUl2D97j92jf5UJsM1HPCNyiJyQuQ32j9XPAaQ2x5iqP1DmWaXxPBX4B4JSyoFZMz8TW iBaxTR2Pzm8bCbZQx0XJcaH9i5MqjxuPqd0bduqhwZI+8sHnv8XDFeYx9oLX+SDJAYVA czbDRa7rpv5qDDx2Ri6LiKTiQmw5HOuUmcUaznGuPmYeylBvUNWfQIparhcxPwzrVgrh HvTT9WfDx8kh27R5EoOK6zOC/anVurAwBY3OAv7P87XRQ4dEiEkZR4cQzoCceEg7pEq1 bPGQ== 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:date:from:x-gm-message-state:from:to:cc; bh=wNgs28xMH7P4/J+xTsAzXIZ/DZk8ZXnVD1xPtOOGx20=; b=nNFX/A0giZH6o39v5NcCH5vfs5+twoA6Bmd+SjKHiMSQdW2ru3CPYNFxs5I8SU5hhO y7984sTFi0uXHkkMRtJ5AzMfetXijy9L7i+3JKu/7zyvlH7e1eMalN1cZCqjWtzm/aFC jXC+MykVBl5gIR5BzaTlX3dIr9Sh7IzdgpIzz+8kNNIZ5EkRmSUNQmjskzgaVD5GhAiZ CoRTP4U3nt6twuos4OqMKt43jUui0kNPJygnOxXAoeuCgFBR3G6P5J8JOk31W05N1Q1x vPZzlfD58YqtjT0mDPjbSgK+y/8epKnixJ6h5vxY7UFji606y7g1PNyrjfCOIeAI4Ymv gZUA== X-Gm-Message-State: AJIora/1zuNC+PzbA1yqTXFgFTem0AgIpBN1QDYz9bdqly0DECH/ji/A flByE/oGIo5xYvpFukEPhBI= X-Received: by 2002:a50:fc89:0:b0:43c:bf1e:165d with SMTP id f9-20020a50fc89000000b0043cbf1e165dmr19509348edq.161.1659437204127; Tue, 02 Aug 2022 03:46:44 -0700 (PDT) Received: from krava ([83.240.61.12]) by smtp.gmail.com with ESMTPSA id j8-20020aa7ca48000000b0043bbbaa323dsm8159064edt.0.2022.08.02.03.46.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Aug 2022 03:46:43 -0700 (PDT) From: Jiri Olsa X-Google-Original-From: Jiri Olsa Date: Tue, 2 Aug 2022 12:46:42 +0200 To: Artem Savkov Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , bpf@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andrea Arcangeli , Daniel Vacek , Jiri Olsa , Song Liu , Daniel Xu Subject: Re: [PATCH bpf-next v2 2/3] bpf: export crash_kexec() as destructive kfunc Message-ID: References: <20220802091030.3742334-1-asavkov@redhat.com> <20220802091030.3742334-3-asavkov@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220802091030.3742334-3-asavkov@redhat.com> 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 Tue, Aug 02, 2022 at 11:10:29AM +0200, Artem Savkov wrote: > Allow properly marked bpf programs to call crash_kexec(). > > Signed-off-by: Artem Savkov > --- > kernel/kexec_core.c | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c > index 4d34c78334ce..9259ea3bd693 100644 > --- a/kernel/kexec_core.c > +++ b/kernel/kexec_core.c > @@ -39,6 +39,8 @@ > #include > #include > #include > +#include > +#include > > #include > #include > @@ -1238,3 +1240,22 @@ void __weak arch_kexec_protect_crashkres(void) > > void __weak arch_kexec_unprotect_crashkres(void) > {} > + > +#ifdef CONFIG_DEBUG_INFO_BTF_MODULES > +BTF_SET8_START(kexec_btf_ids) > +BTF_ID_FLAGS(func, crash_kexec, KF_DESTRUCTIVE) > +BTF_SET8_END(kexec_btf_ids) > + > +static const struct btf_kfunc_id_set kexec_kfunc_set = { > + .owner = THIS_MODULE, > + .set = &kexec_btf_ids, > +}; > + > +static int __init crash_kfunc_init(void) > +{ > + register_btf_kfunc_id_set(BPF_PROG_TYPE_TRACING, &kexec_kfunc_set); > + return 0; should we do 'return register_btf_kfunc_id_set(...' in here? jirka > +} > + > +subsys_initcall(crash_kfunc_init); > +#endif > -- > 2.35.3 >