Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp3330278pxb; Tue, 12 Jan 2021 11:48:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJwCNCi3jb+1wspY1Q5ZUKBOEPBq3xb2QJ8CEWrevHSkgyyNR3kAhXuyC7mLkkIGyXmMz4TO X-Received: by 2002:a17:906:9588:: with SMTP id r8mr310716ejx.148.1610480937175; Tue, 12 Jan 2021 11:48:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610480937; cv=none; d=google.com; s=arc-20160816; b=AL6xFtz89J6enBWJ6UjsFvUXv4kPSrlxgErKPLHX/4RViHF3x1PM8aRyY9Is2eCFpc ze7NBChKWn7ANs3AxYNNW4aBxzbJ8rwAMKtSgHqF8Spq2ZAuUoJI/3H0LrxDnQ+D3ROT 9s3TnA5SUMjE/h3CMCJ0NpNXD4z6ElioO7yEFG4hK9c1B8riWTfgLjz8Cq3dxMjXK26B yiouYSJeHjHpF8+gs8/xr0WHwVQfKLb6LDZ535CKb9HLVeFwT0i4vdGtFkqTIUWp144t h/HwnIuqjrPf131SHpnKo9+byY35Decz6U4de5x+6ENyaeImwOqt3U1NnJEp+fDScXc+ Gn3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=45DA4vH/D9c7gYWc+sPX522gNKfwVRgZeQ5tT9hcRQo=; b=OF3gczLPy39fF+9YGrDxoKHP0BjvUbIzbeAN5nqYSLjNiWoBdCesSQJL0lTUEWs/d8 IbWgKR/na2EpzGyzyuWSz9SQYe205OBuN/n02jvFwt03rMBdXxzj9ohGrOWYxDy1IIij /gjdSkgv9SzJoY64X7mIyhBOBCHzUYyiXZ6+1wiAGTFr7/GB7KmMD5odZZMpQ+IhoHWk znBirWZBVlmOMqrV3vW8IjysaDXFvj7LgOrmp0kxvsZBMg8IvJxKJkdcqYMeVEJyIX4d MnmAaRfCDrpZo76b+FeEoYSx2Rld96Ztk6/NYwWyaD2x9o31Hh2iwddxy78DXH75TnJq fRxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iSfEpB6n; 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 n6si1452331ejc.567.2021.01.12.11.48.33; Tue, 12 Jan 2021 11:48:57 -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=iSfEpB6n; 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 S2406170AbhALTrf (ORCPT + 99 others); Tue, 12 Jan 2021 14:47:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406756AbhALTre (ORCPT ); Tue, 12 Jan 2021 14:47:34 -0500 Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com [IPv6:2607:f8b0:4864:20::b35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1E62C061795; Tue, 12 Jan 2021 11:46:53 -0800 (PST) Received: by mail-yb1-xb35.google.com with SMTP id o144so3301635ybc.0; Tue, 12 Jan 2021 11:46:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=45DA4vH/D9c7gYWc+sPX522gNKfwVRgZeQ5tT9hcRQo=; b=iSfEpB6nullBDGHMzkUIL4Mg1xbmNjQ+3ukI2cEAZgRJjEWC2U1lmlzzctiayjmS5I FvSdX/eWz+XH/1k4vE7/wm6LOX08RRxWgLhiyZ3ZdMvvyTjnJAol3p4bYvgWvr3bodaQ 5wFEoMgjHQzdLrgbrTp8BFxMxqnXrdxYRW3K+TbjWKaB8JIk0ca3JiueznIU3kJCJ3GU fwHwXrth5BDAT3Rnbpv8g43efKESLp91jk6BuEd9kWbye/XgsI+2hNTmd4RGzOovquOh HmzFHEfFdewWeSFzz+C8oK6OPjMdLL2940ve6EgZ6F3w8NWMhgMcKYXREJ+cY6q/JT+N xaXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=45DA4vH/D9c7gYWc+sPX522gNKfwVRgZeQ5tT9hcRQo=; b=fH4kcu1TSQKcfsEhzUTMMS5bPTZdag4Xr+MZisuLfprp7Eh8Ig/inR/FfO78sOAwRZ MDRiqK/LWl4WtC6tiEjdYw2WoCsWpG95nJPglnsK09h7M4P0xdK7ymAPg7ZR5V0YEnYw QVvahDBCP4vqjiO6ln2O3tyxAA8ktB5L5CHZ4NwRvLmhnArwJ3OH4vByyJNNjdaDEhMU WIDNb9KAPCxxspdz0qN7CX9VHAu0CfbKaj0+m/QdDhhskbhwzE18bsf7mYsJfC3vW8ZK k5oUVMefjU/g9ZPEr90mu6hvwE9DDM75ZLDOHRZDTqvYEIVMBg3cTX/oYToDudIr63IT LZnA== X-Gm-Message-State: AOAM531utvPWG5cG32FqgtMypeT+usC0b2FJGEGEiRrzhAopifojtViO TEb2pohlqfe1HrZAikzqCw1VlV1ktKaX/wAYU48= X-Received: by 2002:a25:9882:: with SMTP id l2mr1400221ybo.425.1610480812991; Tue, 12 Jan 2021 11:46:52 -0800 (PST) MIME-Version: 1.0 References: <20210112091403.10458-1-gilad.reti@gmail.com> In-Reply-To: <20210112091403.10458-1-gilad.reti@gmail.com> From: Andrii Nakryiko Date: Tue, 12 Jan 2021 11:46:42 -0800 Message-ID: Subject: Re: [PATCH bpf 1/2] bpf: support PTR_TO_MEM{,_OR_NULL} register spilling To: Gilad Reti Cc: bpf , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Networking , open list Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 12, 2021 at 1:14 AM Gilad Reti wrote: > > Add 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. > > The patch was partially contibuted by CyberArk Software, Inc. > > Fixes: 457f44363a88 ("bpf: Implement BPF ring buffer and verifier > support for it") Surprised no one mentioned this yet. Fixes tag should always be on a single unwrapped line, however long it is, please fix. > 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; > -- > 2.27.0 >