Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1215871rwr; Wed, 3 May 2023 11:41:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4CwTQ6ILTTt68wMEy8oTa1W8VxW/lt/BXOaT3+B2/VEjgLXU7vqLu9tHwn9amsoNT0B/V9 X-Received: by 2002:a17:903:1cf:b0:1a2:7d:8a8d with SMTP id e15-20020a17090301cf00b001a2007d8a8dmr934104plh.57.1683139317977; Wed, 03 May 2023 11:41:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683139317; cv=none; d=google.com; s=arc-20160816; b=vR9t75eawdhwgM+drNtwcSXv6KwjisAe07tWRBlqALAUwVIfznD28P6BsgBgajV4+7 vBK4eFZFuTtpOMNC7lKNWVn/HRgmQ+RNMithCDuoaPwuL25tsDZUvv/wUSmVt/Kmmwnm 5Cxu356a+GEUd9NwyVYWsq7Tx/jdQtVNzyF3lC3EAAhMFf52+48XtZrRk0OpsOw+hwyz CDLj0I8H7INmY+5e5NnhXt4bXOR3aHvyaDoEt+aGmxQCaPyhp7OlBiWFHAa0HAcgHCCa IAP33xahLgY+MoaNS/RCdVr/s4RQgvnNCQlt6bo6o/e4PHOMsH656NB4Ycc/OV6W2wbB hY2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=hXawo9kiP+Vmzoz/c2lQQeKzlye9OM2UYu1dHvknnKI=; b=OhGXZfY6WP8g74T50o30zdysS/N+vwyiS4n7lj4lssa9P//pC+MlTq4k5hmIw+1opr kJoVdVDMU/b/oIBp0K+NzMGdeJRYnPz2J222Nai5j8GeQYbFC2FQjcZjFRKH6weDv72G +05KM/jqZ3p/7CIQNp272L9zsa2fH1acMn4USIQmZgsaHM327Y28kgI0z0CnvZ21LOX8 O2Dy6Z7y66dpOP9RfDJ9PTbndFADyDng3iyrmUenai8yJKGgtvoYInGQnI2TFrdoleCn 6ake5HHfbeaH49lEJ+8X9R0dmoYqprQicXANqgLoKFc/tXKgSj5u41sJCMgrECatIjnr MdFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="P5g/bc4C"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x64-20020a638643000000b005038290f44csi24202954pgd.527.2023.05.03.11.41.43; Wed, 03 May 2023 11:41:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="P5g/bc4C"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229610AbjECSjs (ORCPT + 99 others); Wed, 3 May 2023 14:39:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbjECSjq (ORCPT ); Wed, 3 May 2023 14:39:46 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6F1D4EDD; Wed, 3 May 2023 11:39:45 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-94f7a0818aeso908176166b.2; Wed, 03 May 2023 11:39:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683139184; x=1685731184; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=hXawo9kiP+Vmzoz/c2lQQeKzlye9OM2UYu1dHvknnKI=; b=P5g/bc4CJxpECNiGqxkyLXl2+x+qXT/PsfKky592bnfOuaqHgctz1pzcGnk7c7DLnZ Gzc0Hpanaeq/vQIbd13QXdC59a3FWr6QSzLyePt81dZE6WZ+5vh4Sv80Mx16dm6IOjrR d+ZMEk7AvVPLGPFJ1k+0BD7CwwGzlQECTbpvZyIOhzTzmmoKObZlQlax8OvfOCYJDiNW +U5pwJ7ao1sl+qOm1RX3j+4U2sQmXbjfP2himr8IuoMYgYp8OzdKeHnHoFPrhX1rsf5m Bdj6V2AWvEAxoTb2IeiIo1Cbx69kfo7zi/80chUqTmKT8tdSP02tNURGpoaZ5cTyzva9 393g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683139184; x=1685731184; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hXawo9kiP+Vmzoz/c2lQQeKzlye9OM2UYu1dHvknnKI=; b=L7HxfH+wr0+eHqIXwRz4gsJuxCKBQQ4cCwKgbaoX8TK1eSoe8tHb/DjW+uGOfXH2Ho Hl5GK6q5NuoWkeoUHH9tFuQp97f0yAY72fvFc9Wp+ygYzhJRVaATWZ53hFXCMdseHQwg ONXIlLPnkeUBe9whipeUFjk0Ma1cv1rGtWNqs3agl9uy/ARJ8wuUSwCdgenWfJggMbVP WbBpMf0mEcfMuQx8uBK+Z1MuvNZD2AipuF7wSM5Bz0+vfQLTsfmFSA9iC2WSBDYn4m2z 1A+Ki3YQb+MriQqN6RcqFfDuGnyZ1JCXxoFLURKQeKf7OO2KHcwRdQd3I6xSWyJooDEb Lyow== X-Gm-Message-State: AC+VfDy44OizYVxzVF6suH/S91CnqdpXzuzypMhN+nBSW4ELz3h2fDDT FgZA2aikp5KRbdhF2C5KVE8uEk+f6hC658bnhIU= X-Received: by 2002:a17:907:1b08:b0:957:1df0:9cbf with SMTP id mp8-20020a1709071b0800b009571df09cbfmr4694843ejc.19.1683139184132; Wed, 03 May 2023 11:39:44 -0700 (PDT) MIME-Version: 1.0 References: <20230406004018.1439952-1-drosen@google.com> <20230406004018.1439952-2-drosen@google.com> In-Reply-To: From: Andrii Nakryiko Date: Wed, 3 May 2023 11:39:32 -0700 Message-ID: Subject: Re: [PATCH 1/3] bpf: verifier: Accept dynptr mem as mem in helpers To: Daniel Rosenberg Cc: Alexei Starovoitov , Joanne Koong , bpf , Alexei Starovoitov , Daniel Borkmann , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shuah Khan , Jonathan Corbet , Mykola Lysenko , LKML , "open list:KERNEL SELFTEST FRAMEWORK" , Android Kernel Team Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 1, 2023 at 6:12=E2=80=AFPM Daniel Rosenberg = wrote: > > On Thu, Apr 6, 2023 at 3:13=E2=80=AFPM Alexei Starovoitov > wrote: > > > > +1 > > All of the DYNPTR_TYPE_FLAG_MASK flags cannot appear in type =3D=3D reg= ->type > > here. > > They are either dynamic flags inside bpf_dynptr_kern->size > > or in arg_type. > > Like in bpf_dynptr_from_mem_proto. > > Looking at this a bit more, I believe this is to enforce packet > restrictions for DYNPTR_TYPE_SKB and DYNPTR_TYPE_XDP. When a helper > function alters a packet, dynptr slices of it are invalidated. If I > remove that annotation entirely, then the invalid_data_slice family of > tests fail. bpf_dynptr_from_mem_proto is fine since that's just local > dynptrs, which don't have any extra limitations. Ah, ok, thanks for investigating!