From patchwork Mon Jan 11 15:31:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Reti X-Patchwork-Id: 12011005 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0896FC4332E for ; Mon, 11 Jan 2021 15:32:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CBC9322AAD for ; Mon, 11 Jan 2021 15:32:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732254AbhAKPcJ (ORCPT ); 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-Google-Smtp-Source: ABdhPJyqoE4ADfB0vSxGuNGJ/iRaxXz+w3WROj3M2s1CkONuqGu97pJymdlM13p6hVyD+Tb5gcppZQ== 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-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net 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. Signed-off-by: Gilad Reti --- 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;