Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3758706pxk; Tue, 29 Sep 2020 05:41:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9Y5znB2nmipM5HdwLcd6vT6ClWYzF2GmY1rh/r8C/bBuEXVsb1EoMxka8CHs66OrE16Xr X-Received: by 2002:a17:906:95d1:: with SMTP id n17mr3875733ejy.324.1601383288691; Tue, 29 Sep 2020 05:41:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601383288; cv=none; d=google.com; s=arc-20160816; b=AcDn9+BAYXW4tkHSKJZu8LhOnT5ZBxZNi1lmA30+Ba+jSTD2AvxVE63CscULCW48OS 45Y5q2LSqEeV562gsCQj4Mny4ko9RAlfVOr/r6oQFfwoy6NP9isnc89enJ/aowjGey+N yBMhynj1upPhfMz1dbgD95d3AYkRSHzlrKjb3Gd3P7GRy+l5Ysu5njwnR8ioXkVn0s+9 QSYt/lisIvBGxQfEEETC7OUDcFUOrGuE3O6ZFrn5FR8Tc7k78Hmj3/iZIn9JYLQlZ2R3 fxBaDqjSdt8e0oEDj5Qg+u3jQXEoa6OYhVsSfaPZEnbxHM2HPw3SRl7A+/PKOcE4PSCm dXmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mgOq3bOBs5Db4ZygidlFKQA/6iWwqIo3pGSYeCauu+Q=; b=iI0rN3dYvLzpmEF8Nig6GMldH8oxJnLSPewF6lHdgZpTptq6hUre+f0UIiJxpWbmYX m/qjM64DUOpI+/q6oi1h+flxv+sZfzMgD25KTsARQkc5VOiME/sPUfN2MXq5I185KIA/ GigA/9EUxn+L+a+U/7wXkM8mZxrGa5Iw4SuZwxk3IEWTR2F5cifMAscv0BWtqd1CippR 7aSi2bHOrJLzS3A2XccdwNvkWJCpMYEt0vEPmIKhrzsExtl53vneI3hiTZPuFvoh3052 I3EY0yvrxEEkBGttd3RLI/FyzDbAjA+xj/ousm/16uStJMymCK6sIepUrifgJhZrZPp9 hRLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="YOoCjsn/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u5si2808168edy.385.2020.09.29.05.41.05; Tue, 29 Sep 2020 05:41:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="YOoCjsn/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732392AbgI2MkM (ORCPT + 99 others); Tue, 29 Sep 2020 08:40:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:59706 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729175AbgI2LPX (ORCPT ); Tue, 29 Sep 2020 07:15:23 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7338C21D41; Tue, 29 Sep 2020 11:15:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601378123; bh=ZcY01G8CNGtt+E8vou5hC/ttOyMXMLrRERQUhf5GrdE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YOoCjsn/oN2Gdfryi351spNB1zRuO/c7C8//uA6q+fVnt1FeNrydg29MdfOSw0UJf wjwRgZqZE8WCma5TU7RbFEiLihrjkN+OPZbOVun95YK2TC4Id3/Qa5f3UNr5w2mcog Vxm0/KAx1Zex0+cGojLcvCvXVw5Khxo6he2LqiTE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Alexei Starovoitov , Sasha Levin Subject: [PATCH 4.14 070/166] bpf: Remove recursion prevention from rcu free callback Date: Tue, 29 Sep 2020 12:59:42 +0200 Message-Id: <20200929105938.718190953@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105935.184737111@linuxfoundation.org> References: <20200929105935.184737111@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Gleixner [ Upstream commit 8a37963c7ac9ecb7f86f8ebda020e3f8d6d7b8a0 ] If an element is freed via RCU then recursion into BPF instrumentation functions is not a concern. The element is already detached from the map and the RCU callback does not hold any locks on which a kprobe, perf event or tracepoint attached BPF program could deadlock. Signed-off-by: Thomas Gleixner Signed-off-by: Alexei Starovoitov Link: https://lore.kernel.org/bpf/20200224145643.259118710@linutronix.de Signed-off-by: Sasha Levin --- kernel/bpf/hashtab.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c index 6cc090d015f66..ecc58137525bc 100644 --- a/kernel/bpf/hashtab.c +++ b/kernel/bpf/hashtab.c @@ -645,15 +645,7 @@ static void htab_elem_free_rcu(struct rcu_head *head) struct htab_elem *l = container_of(head, struct htab_elem, rcu); struct bpf_htab *htab = l->htab; - /* must increment bpf_prog_active to avoid kprobe+bpf triggering while - * we're calling kfree, otherwise deadlock is possible if kprobes - * are placed somewhere inside of slub - */ - preempt_disable(); - __this_cpu_inc(bpf_prog_active); htab_elem_free(htab, l); - __this_cpu_dec(bpf_prog_active); - preempt_enable(); } static void htab_put_fd_value(struct bpf_htab *htab, struct htab_elem *l) -- 2.25.1