Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp852554pxk; Thu, 17 Sep 2020 19:06:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhlnIS9rTDQvOZdZLpjTOzTurF3zX2LmRIQVhlt2wmYrxMiFxaI0sDl7qLa310XoUh2vbo X-Received: by 2002:aa7:c896:: with SMTP id p22mr35683920eds.382.1600394786130; Thu, 17 Sep 2020 19:06:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600394786; cv=none; d=google.com; s=arc-20160816; b=NITKgpxUNU8P1DVszEJLSBNLCmQkcwcAjOEyuuc0Ta2wLeY3ZyfhGqfbjG7qRxnu5s NswdkZ7LiBXxYKNTWO8QZ9MIjm4v2RpbNh5S6BQcI7KaCWDJxn/xzSkokaLDQvwxVvfe dvgZAbeYKZZWZisZ254euxEO5i1sbmSL6B2BlJECGfZ4Pl8Lm7YdXAaj1XU9LV6OvcC2 NPz3W5KBzeuvbyJTml0ut9S9kX3tAXokvOUDt0pbtb1RUa2/OgxUkGELlTfn8Qu2WM6R Yqke1cPKMzRUAT+Sgo0OPWBF4hTi9yode7L8UBCTP476VbpQi8lPBiStc7tvTJdS3/vd ooUA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5SlkzfHX7CaFqK6Pur8StoRQ4h5p+y96Y3EHxL0A3yE=; b=h280da0RMZZIRCSArjBVrjKsGgNvi8F9hRkZPztHK/Ka4ns2SM0S986AmHt3oI8pHG gDaEFvJdRvSZ+0Kw5fVa5XlHVqBIHhyWgLHukhMVRN/eNG//evhrUjEp0HD7pP784vDO Tz3HAlanQRTIaCYJlbKtmdALLu322DNbFyXm4ybpf+TwOhY6c/K6JJZhK2B7Jrlfezdr hFaKFkDt8LPa5c2h3STXDzdp96GMdn/4rTmPxVIxRU0B/BS++kNvtVuVdIf3EpFnQS2O Sd/ibb+XpGRz56kfha/nxioq3uY5H4My/gL5Czgnp+YUWDUxPU3n20i60ICbOu9MoKyf es7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hELPF3eH; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cx6si1048876edb.437.2020.09.17.19.06.02; Thu, 17 Sep 2020 19:06:26 -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=hELPF3eH; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727231AbgIRCEF (ORCPT + 99 others); Thu, 17 Sep 2020 22:04:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:50882 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727200AbgIRCEB (ORCPT ); Thu, 17 Sep 2020 22:04:01 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 148882388B; Fri, 18 Sep 2020 02:03:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394640; bh=z7GkIRBfIpqHZ8dIEWx/p44xdirXNH0oyPkAC+8qQJg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hELPF3eHOwgMbPLMhDkjlvNB01TTvHoFcXlzEWx5U25a0b17aNa/U0r7AnT5q5pml aYJwxEgcmAcgG3PDjPXWjXjkJ0VI/a0s+hMJqMcFQYEZf+BkjfidIWxBsFMRQ2kZjG wEyyRsQ2all9I8xonizcPlpls6beeLis42wndbfM= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Thomas Gleixner , Alexei Starovoitov , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 139/330] bpf: Remove recursion prevention from rcu free callback Date: Thu, 17 Sep 2020 21:57:59 -0400 Message-Id: <20200918020110.2063155-139-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 039d64b1bfb7d..728ffec52cf36 100644 --- a/kernel/bpf/hashtab.c +++ b/kernel/bpf/hashtab.c @@ -664,15 +664,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