Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2354336pxb; Mon, 11 Jan 2021 07:35:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJzLYgM4jUQQpZDz99UUm160C4nMYTcLSl36GMD6MUipdr0ER0Gmuc7ECfwuqAlQsB3zUo0R X-Received: by 2002:a17:906:7689:: with SMTP id o9mr42397ejm.324.1610379308347; Mon, 11 Jan 2021 07:35:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610379308; cv=none; d=google.com; s=arc-20160816; b=cr+MnpB1I5zAmmCktecBTF2eFgMSqW2aqUDGkkz1eDc9AVZHavjpNfAJHDZ1hrvJly aqB7PfMksnUuhAJ55MV7LjYsb4dOVTDfJej1DG17j8F8dQF7t7rh9EJoTvEEgdWvDadO mzZNGaiu8YOP0Ha8Ye4WWuLOMgC3dED/agVohgfHzEj6LTLFQCNN6q1/KsoKu/gxiJfX JFLMY+y1H2pATKMaDuf+8TpefOhkqrSbG45xIpBXLIQ/7qxtrm0AnqtkuT+ZtoZKmxBc p5uAFJ1CQ4pb6NCSudo+8jD5XeroiGIiT4otm4Uc+wEV14E8xM2gVT8HBttyjG3ZFSv1 9aRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=ainL+gf/mI7XGV06pxoex50mFeblVQiOmvn0PY1hDZ8=; b=F/ixuk6DDFhl67zobbM2kAAjdQIM0XuQT+IF1kN/YTSKz6QubcxrdgyI0OKoXARxCm lCeFnyGlC4aS41CRFq4tyAQZdXo1UvlsLPfKme6nncTtGtF/hqFayimyHao8e+Oyn7yV t3rmcp3kmm8HwWmMZx6bG9QBTL+/kxmPk7p7RzqZoGHh1Upzc19sq7Qsm7RDdeKQLECJ a/PUMZ4E5SU2eq5PX2FKnqhaGeowW3vhuJ0k2b8EPEYrlDRAlX/vUpbMSk3arBZHTBQ/ xA7uuFYz25iRuVkT2zweETTylAXhYckjDzWdTKTMmOPZ3mcyx1hH6w2pELv6pIHUjhLP Z0VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=agB7ehSa; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kt2si6529038ejb.124.2021.01.11.07.34.44; Mon, 11 Jan 2021 07:35:08 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=agB7ehSa; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732075AbhAKPcJ (ORCPT + 99 others); Mon, 11 Jan 2021 10:32:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726375AbhAKPcI (ORCPT ); Mon, 11 Jan 2021 10:32:08 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51715C0617A2; Mon, 11 Jan 2021 07:31:28 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id 190so210849wmz.0; Mon, 11 Jan 2021 07:31:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=ainL+gf/mI7XGV06pxoex50mFeblVQiOmvn0PY1hDZ8=; b=agB7ehSa0PIlEPE4KyHhmZZmMUqzg1u04v0in/yEL5tuvYA93oKwunMSeJ8phX0p35 OuHS3qwle3aaF8WRyDmkZYNpnhfkVGxmwBvUxQxN1jX/suBeB82Lq5L5Wp15sIoB5KrZ cNCWLY2Mejz4LeREQ2gGltGcA5CD+65tbreoSuGSK3q+Toq17pA1d4Nx1UhOS+CNbMjS CnDbxXCFzge0PJupCVdV1IlmYEz1aR1NzXdwAzHi2rYQ1Vm770GkWis8iMkNubDIYKmk qdQxytEMGz/0IDiRUDHWLI0vKtqJXQg0IoOhVr9ehDyQjaLAW5BV62MIGY2xpxvW/xsZ +TOQ== 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:mime-version :content-disposition; bh=ainL+gf/mI7XGV06pxoex50mFeblVQiOmvn0PY1hDZ8=; b=lFSJNW6FglPyLPWV95UAgqbXePAR1q0Ic+G2wNwu7Y0qtKlzCVV/0RsGxcOCByiGaa 4PKTFmIT/oCdacjBmb+QjCT9iHvIKIQOjc9ki+Td5pm+W0Ujpem8tMf0HPwKcLjvL+Re 0oCB6QAPCsz3C2ZpeiqmKPRCUQtylrDQN+M+R6dUmYz1zDEeAjLGXY3fEdZvK79ZYSqy S5H2Y7DgbmyR63ktr0eUfcQtXNWDCj43Zky21UYQ8kS+uM7A252ILTixBoYMD+mC6oqG TyDiWY/SEy3QC21zBNph5M5eCR7qxIyp4pEP8W67cuXDhXyRhKVAv+1uTlVl2yyjdSRD 0gWg== X-Gm-Message-State: AOAM530pIPH1MAV2EDJ0SgMUjyJHhY3YEHIG411TELLNXbm/yLF6S6CR pOVxSs0Pew7pr5nU3Jr2b2y1hDu7egfjAkiL X-Received: by 2002:a05:600c:258:: with SMTP id 24mr272127wmj.16.1610379086816; Mon, 11 Jan 2021 07:31:26 -0800 (PST) Received: from ubuntu (bzq-233-168-31-62.red.bezeqint.net. [31.168.233.62]) by smtp.gmail.com with ESMTPSA id b10sm184835wmj.5.2021.01.11.07.31.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jan 2021 07:31:26 -0800 (PST) Date: Mon, 11 Jan 2021 17:31:23 +0200 From: giladreti To: bpf@vger.kernel.org, Yonghong Song Cc: Alexei Starovoitov , Daniel Borkmann , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] Signed-off-by: giladreti Message-ID: <20210111153123.GA423936@ubuntu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Added support for pointer to mem register spilling, to allow the verifier to track pointer to valid memory addresses. Such pointers are returned for example by a successful call of the bpf_ringbuf_reserve helper. This patch was suggested as a solution by Yonghong Song. --- kernel/bpf/verifier.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 17270b8404f1..36af69fac591 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -2217,6 +2217,8 @@ static bool is_spillable_regtype(enum bpf_reg_type type) case PTR_TO_RDWR_BUF: case PTR_TO_RDWR_BUF_OR_NULL: case PTR_TO_PERCPU_BTF_ID: + case PTR_TO_MEM: + case PTR_TO_MEM_OR_NULL: return true; default: return false; -- 2.27.0