Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5904821ybl; Tue, 10 Dec 2019 13:30:15 -0800 (PST) X-Google-Smtp-Source: APXvYqzg6n+adKe4IooWwhz85EPlVrgzS+66xo0yZJaj17+0kAjz9syTQGwmqCG1hkpyI+OVycXf X-Received: by 2002:aca:4f86:: with SMTP id d128mr75062oib.25.1576013415617; Tue, 10 Dec 2019 13:30:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576013415; cv=none; d=google.com; s=arc-20160816; b=rwRAWY8O2wt7hAmKKGefvhRRVQmXrlrFVCxwZIUUkZz+F3M3lV2aG1kr7CVg4I4/wF W72kVTPWpYy79F0lgQcCC11v8EgSrFAeNyNc/UkIQI0IXgWTEakXaGUHzfjS2bp3u5VQ dQa9g2o4hLPQRtGtPBILCTKJ1tO0KuREE88JGs3eqD66gFBrgpRj/w7g8qLjOUYy1tBU wucpZU1CWp9OWudMGcFExWvxM4vaMYGBWkFVWITH+c4Jy1HGoaElzCb8cf5Dp7yUujDe monACyrjEd0DDAyLcyQVFuHz3dL4NjmcHEvjJHp+0/wEBEMP30PCrhkWXUUuFCMnuOoY CmEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=pIRKF4dHpqchckl72/YpmRs/BI55M7i7L1pucxA2z4E=; b=0i2vl3X6QVfflVqbQALhMetuqxJr1eh2hbTnNS6p4hjaJrTCwpUjQPtpELY2bK4aig cLTd9CI8InWge5zThIfzTujzy0OKhckXByqRzcMO5iGL9fFOKFPQcnvsm1wTql1r8jq2 etolZ8dwTFl4tFd28/SxhxaavIvnnUJSX4TVTgdN4wpLnLAnJDgcbJWDE/H4P6bEDTTu xdgMqacbIGg1+u+HRUtYq4wgnbjA3RXIzCHCSZ3UlEs6lwfCwS3v9fjkyyVB4S+opT0P JbYehLICx2pM3VXBYGbRDT9s6E42xT5n/rS6mm5LW4YxhEpigc+he4bNClU/pFNB4KK+ 9IGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=a093tOG7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d17si2825826otp.315.2019.12.10.13.30.03; Tue, 10 Dec 2019 13:30:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=a093tOG7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727084AbfLJV2m (ORCPT + 99 others); Tue, 10 Dec 2019 16:28:42 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:46296 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728645AbfLJV2j (ORCPT ); Tue, 10 Dec 2019 16:28:39 -0500 Received: by mail-pf1-f193.google.com with SMTP id y14so448807pfm.13 for ; Tue, 10 Dec 2019 13:28:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=pIRKF4dHpqchckl72/YpmRs/BI55M7i7L1pucxA2z4E=; b=a093tOG7PusILFWMBFDVZ0S7cjLimPfDS0Zqh5j+gZZf0kucIbzeOm1CZHw/ZFdKMP c5BZhT8yU9LDGIwsJooldnJGpXIUeCdvKvmVTV1/7tGguspn6r67Ymp9MWE3b5ABeEX3 MyMvr8rIAhVm4hFS2bpB0VRnNTI9K2aV6dFJnWzCGJ8HOgVy/DnlT2wfZlwVitnqMf1P Izu35iju3ABwkITiAmB6sjvuy0B4D8pxDxbRtihc+tHVaMVUuZKCDNImkk/IPBFMpKcQ ustlUOQPP84kvEv6q34WV3vdg+12dH5JvZzffPU87O63e/lZhpaNqSMeg8mFJh11e3fs c3jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=pIRKF4dHpqchckl72/YpmRs/BI55M7i7L1pucxA2z4E=; b=GT98UEsyO0J6xZ6VS6lgByhB4mnHTcoGzTD7JsGPEI3Or657xRvO0cFBzcFYPLYcWp N8jQT10eqqmU2hqEDofvsCy3UkM3iCdV/rfgpSVTlHi5jaEz2lcNTIyeMtGICgqkBTxs Zrnl0Q+ANKgy3Jwy71wa6KUccnHo70KlqaahZ0SEf5SGkpOrh7+1IprjZ5TMfPHyw83/ dBcLCvun1tmiMzryGhlUow1s2mD9VjjkOzOPEm4Sj7jBzYaJSwjCYHZX1I9RE+Mvu+Gk BlauKkS5Bf7rqz8XcE2x08xEoSeBjGHem3ZVSIjKO3AcmVCjqeOVva4bORF+xUCJFilN FqnQ== X-Gm-Message-State: APjAAAUjm8jOfg/EnifCENs9VL7k0tzMrpukDX55R9XjeFuQS1f3ORRX iX/OkVwmWT6jMSeK7/N6matI2VbBDOw= X-Received: by 2002:a63:e608:: with SMTP id g8mr190645pgh.448.1576013318350; Tue, 10 Dec 2019 13:28:38 -0800 (PST) Received: from cakuba.netronome.com ([66.60.152.14]) by smtp.gmail.com with ESMTPSA id k4sm4629761pfk.11.2019.12.10.13.28.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2019 13:28:38 -0800 (PST) Date: Tue, 10 Dec 2019 13:28:34 -0800 From: Jakub Kicinski To: Sasha Levin Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Andrii Nakryiko , Daniel Borkmann , Song Liu , netdev@vger.kernel.org, bpf@vger.kernel.org, oss-drivers@netronome.com Subject: Re: [oss-drivers] [PATCH AUTOSEL 5.4 326/350] bpf: Switch bpf_map ref counter to atomic64_t so bpf_map_inc() never fails Message-ID: <20191210132834.157d5fc5@cakuba.netronome.com> In-Reply-To: <20191210210735.9077-287-sashal@kernel.org> References: <20191210210735.9077-1-sashal@kernel.org> <20191210210735.9077-287-sashal@kernel.org> Organization: Netronome Systems, Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 10 Dec 2019 16:07:11 -0500, Sasha Levin wrote: > From: Andrii Nakryiko > > [ Upstream commit 1e0bd5a091e5d9e0f1d5b0e6329b87bb1792f784 ] > > 92117d8443bc ("bpf: fix refcnt overflow") turned refcounting of bpf_map into > potentially failing operation, when refcount reaches BPF_MAX_REFCNT limit > (32k). Due to using 32-bit counter, it's possible in practice to overflow > refcounter and make it wrap around to 0, causing erroneous map free, while > there are still references to it, causing use-after-free problems. I don't think this is a bug fix, the second sentence here is written in a quite confusing way, but there is no bug. Could you drop? I don't think it's worth the backporting pain since it changes bpf_map_inc().