Received: by 2002:a05:7412:d024:b0:f9:90c9:de9f with SMTP id bd36csp51907rdb; Wed, 20 Dec 2023 06:10:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFmIkzYlfBKnIMfea/QNJHzgCCUlZk5LuKNDhRuOy4WHJFxyUpcI7Aqce/tOMsUtq1KFlah X-Received: by 2002:a50:8e5b:0:b0:552:e95a:f758 with SMTP id 27-20020a508e5b000000b00552e95af758mr4674872edx.79.1703081416819; Wed, 20 Dec 2023 06:10:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703081416; cv=none; d=google.com; s=arc-20160816; b=DyMqNLXfPOQeUaKvpo9KeVdTuqC95NLPTQaBI0FipWszXLfGD2zEIvq7i2oI5FULSo czsMylpK+Xu7hMZ7t2HPkV3eZawTT6ndvqtBFsJ0Yz/tveKrEO14lr/yv2soGGlEzVHt 07COwATDQH2EVyDav1XL9OmFTeugwso74uGQqiuQ0Y3TT1h1UFtNbOmB6C/H7ORLDBYB X9/bFseCuCZUyFMsKdgW6ysRNSBBuHMT/qcpdEKvSXlTQ4zXDYBlfVj7u55X3x/ObD6J +zlltwFdwx/wEP9St3R+qiJmtqfh76NmHk//E8dZbbUzXQ8EKUZHPt1hJiPgnWc1VcZ5 pv7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:cc:to:from; bh=dlktQI2x1iuHqEi9mxQbJvpBMkTLYa33rfJzRbMT61U=; fh=0j9hEtKEGSulx/lgeQcpDl+4ujiVFr5DCPGOZLIRfAc=; b=dh0v/K0QGeX5tbXNr4LEsbnzpHkxkxlB6wJxVOnJD+HR2ICvY+hDx0pNgmT6bu+H7d X0wTyzIK+3NQdmX0YVTjB4EYzdoV4L4ygRx1sIlnCJAo+51izHvDoUhNgThRlqtzAdaK +0IQSKxepylvkGBLGCCKhY7EAIXgUItTP+lHbzldbhyXuU85VAVUYn+jnSkP6Q1lCx19 D2sNQKWfHYnE5RepZDUdjM9nUFYtLzr/UvA0GCa9Z0ngh69ESpP1MYijaOcuyio6V350 Gh1hw5MrlQgFUnZ+qPkqXVIFKO0QJlhQ25A3Shto5JJ5iOErSiC7TbMpyzLJjmgebjDu qnRw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-7036-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7036-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id df3-20020a05640230a300b00553e65efa0esi500411edb.551.2023.12.20.06.10.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 06:10:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7036-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-7036-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7036-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8E3211F2A507 for ; Wed, 20 Dec 2023 14:10:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EE6A13B184; Wed, 20 Dec 2023 14:09:32 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from out30-118.freemail.mail.aliyun.com (out30-118.freemail.mail.aliyun.com [115.124.30.118]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 07BCA39862; Wed, 20 Dec 2023 14:09:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R211e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046056;MF=alibuda@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0VyumN1T_1703081351; Received: from j66a10360.sqa.eu95.tbsite.net(mailfrom:alibuda@linux.alibaba.com fp:SMTPD_---0VyumN1T_1703081351) by smtp.aliyun-inc.com; Wed, 20 Dec 2023 22:09:20 +0800 From: "D. Wythe" To: pablo@netfilter.org, kadlec@netfilter.org, fw@strlen.de Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, coreteam@netfilter.org, netfilter-devel@vger.kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, ast@kernel.org Subject: [RFC nf-next v3 0/2] netfilter: bpf: support prog update Date: Wed, 20 Dec 2023 22:09:09 +0800 Message-Id: <1703081351-85579-1-git-send-email-alibuda@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: "D. Wythe" This patches attempt to implements updating of progs within bpf netfilter link, allowing user update their ebpf netfilter prog in hot update manner. Besides, a corresponding test case has been added to verify whether the update works. -- v1: 1. remove unnecessary context, access the prog directly via rcu. 2. remove synchronize_rcu(), dealloc the nf_link via kfree_rcu. 3. check the dead flag during the update. -- v1->v2: 1. remove unnecessary nf_prog, accessing nf_link->link.prog in direct. -- v2->v3: 1. access nf_link->link.prog via rcu_dereference_raw to avoid warning. D. Wythe (2): netfilter: bpf: support prog update selftests/bpf: Add netfilter link prog update test net/netfilter/nf_bpf_link.c | 63 ++++++++++++---- .../bpf/prog_tests/netfilter_link_update_prog.c | 83 ++++++++++++++++++++++ .../bpf/progs/test_netfilter_link_update_prog.c | 24 +++++++ 3 files changed, 155 insertions(+), 15 deletions(-) create mode 100644 tools/testing/selftests/bpf/prog_tests/netfilter_link_update_prog.c create mode 100644 tools/testing/selftests/bpf/progs/test_netfilter_link_update_prog.c -- 1.8.3.1