Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6178838rwr; Mon, 1 May 2023 18:18:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4lwtz4x6g7hcWdq0xDYrbXaDpdQqqPlXBwaxeIniBLRTvNO2ROK4TWQex9b5xPP/KxeyVm X-Received: by 2002:a05:6a00:1706:b0:63b:7bc7:8049 with SMTP id h6-20020a056a00170600b0063b7bc78049mr23603797pfc.2.1682990294379; Mon, 01 May 2023 18:18:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682990294; cv=none; d=google.com; s=arc-20160816; b=RjVnmDkrFf2sFYkr5KfH66WiVF+C7yGNHZAZcXiq9C2t7hDAqCDJjjU7rTI4k4GQXt go+1PKr10G1dcsqyVTsu/gWu/ADj3FHjTwG2JlZghq9YP+mpA4eFPQ5NFQaTgmHV30rG hpJxGXRMSF0Wra9fCVc/TR1DQVSuxSwzHoOV95PYd37PHlfLyB4KxDbKOtEmhzjO35Vr DEcUsFJB1ahZE1UnijlZXv5ODZm+Srscn4R+oVsvc/hMORC8lSJyVYHafUlJNXoyfLYr i0vI+fjLUEOAStk7ipgPDehIDQ+Q3KetJnQBJY6qX247vXrJD/NuPk4FP+i7dSy2TskU HpwA== 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=47MTC43+cqs0cncIRVUMCVwlp631DYCAqlKsiStJTh4=; b=EIJeipiqOSF9FaFCzGtoIJ3wFJARibNbEMNykYGa9GO6s7dAgiTwxW6hwQAWsIaN3r w7wBR9Y8C8YzrXEdamRDRKmRPyAJKlM+UqWRKFDzDo1xc3wutpiOoBexHOXNDZrvqbG7 sXPg+8XMzXxDJQqHk6n5BK/+G2PFb+Ee7GG2JLoOBi+oN4/dBnBpD9DKOcSW5ajY1kgi ha0X1pOpIBTblgA7r94zTQVDnB+G/dtHnQv1VtIfu8W+w9r/tUPiz54bg6rV2ru++Vhm OQa22sKrx5rMQcObNmRuVFaH+mlhrTg6HEJiHImuFfjK203sugJBxhw8djRTW1tSXIGY Zhtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=27wJElmW; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r13-20020aa7988d000000b0063b6379dba6si28923975pfl.24.2023.05.01.18.18.02; Mon, 01 May 2023 18:18:14 -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=@google.com header.s=20221208 header.b=27wJElmW; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230484AbjEBBMv (ORCPT + 99 others); Mon, 1 May 2023 21:12:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232402AbjEBBMt (ORCPT ); Mon, 1 May 2023 21:12:49 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 476703A8B for ; Mon, 1 May 2023 18:12:45 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-24df4ecdb87so1319796a91.0 for ; Mon, 01 May 2023 18:12:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682989965; x=1685581965; 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=47MTC43+cqs0cncIRVUMCVwlp631DYCAqlKsiStJTh4=; b=27wJElmW7Qf2QnbHUpeOj5uvR8x9QZPbhuU4EN//QC4lhvOx9HUVgfX7TnrnLX4a74 QujhUvNJTBK8c9MrL7GvI/8Qk7uug59q0oddpzfP8ekJOuaxhtwjx0mU+0qx7afaf6EX ehQx4NriLqW1Vzz3XLieSX8ZU7EEt+XzvZwZfCxesgtTgw/3tfK672G/EDuE3fcIYoWf pUO1bqyAlJ2wj71hLlMhUSY9SBOv2ymOo8r1m++3CZbQLWdXYaQUK/6UdB34/kdtUZKZ aJq/22k5TzAH/Fq+Z5z+0+x/HyjVzZ991SuKo1R6R4gL6T7f7g2YIKdZsQHSfUdbxLy9 z2KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682989965; x=1685581965; 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=47MTC43+cqs0cncIRVUMCVwlp631DYCAqlKsiStJTh4=; b=IoiVuMFVNeWcY9LNCeYD03G4qhTWs+0zKbM2EJCFK1W/EdsEXaBKNY2J70liy2VSho xYfPxgNdq10JyBqgkkBl+GEgEDx3AfXDi4atPXW140XAbXQPJOsJMMnVxsTSWSM2fxkf YvQoqjer1NKZo+ycz4oi9kSgPQ/xml+Q1JfZ2igRjA8SxTdYuUCpOb+HPPU1cpeooLiL cW3VEOuaab4ljR4z8JuvkqMFVHap2k3JeVqVyqGRrqkaGySpA9uqauuZaFjZGNVPCzx3 K/zDQI4RXUJptLNlQCbbS4JiQplc5tkAk4U7TDQvW7OVG6LuMGqoYIOBfEj2Krq6aHkL nn4g== X-Gm-Message-State: AC+VfDwbedUZCtyEAinwzbI/shj8pqVoDEzUc+Xw7HsQDbcdOdsX+2iW qFbx57HsbG3obDipyaHMg+ETV86+Zc1ZgkeXgN2x6Q== X-Received: by 2002:a17:90b:4acf:b0:22c:59c3:8694 with SMTP id mh15-20020a17090b4acf00b0022c59c38694mr15946312pjb.44.1682989964612; Mon, 01 May 2023 18:12:44 -0700 (PDT) MIME-Version: 1.0 References: <20230406004018.1439952-1-drosen@google.com> <20230406004018.1439952-2-drosen@google.com> In-Reply-To: From: Daniel Rosenberg Date: Mon, 1 May 2023 18:12:33 -0700 Message-ID: Subject: Re: [PATCH 1/3] bpf: verifier: Accept dynptr mem as mem in helpers To: Alexei Starovoitov , Joanne Koong Cc: Andrii Nakryiko , 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=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 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.