Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2895081rwr; Fri, 28 Apr 2023 19:00:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ61xvyx+sXGff/bSH+RIgIJ3WOpAqeW2uOXmXqdRv1z0+YtFzLhi1MH8D24wwma0A028gx3 X-Received: by 2002:a05:6a21:32a2:b0:f5:7e36:485b with SMTP id yt34-20020a056a2132a200b000f57e36485bmr5828731pzb.6.1682733623906; Fri, 28 Apr 2023 19:00:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682733623; cv=none; d=google.com; s=arc-20160816; b=U2DqLhZlwbSQe9I/2VmtB9sw+D7CCu3E9wUbJLR2/CUgAQ0JkbdrhzfZz5/0pVmiHZ JDLqGgWslJKQHKjW1+2LyffUP8LWUhLHnXRggRovO33EljID77vnXzS84RrTn69MA6N0 6ku/SY1oSjGfYkc64BTFZ7x9vPlO807JL4AQnlLkdDd5U55DHZct+8Ti6GuPYdzvI75f fkiyPtCYa0AC905zavicjjmwnvU4af7Po4HDD8qvwe5UeD0QBnBkMPlNS4IYq3C8Zrqv 9BRcUuqKyPZqvxlBANXG11F5DEb24+CLY5FCuOFLRIOvHBXK8Fs4P4GAHSdkerypkJPf bI+w== 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=JwYEXU7Lp9XroufPN43xvmiTz9v2gxPHNeujBe94GAs=; b=wpE3PLTFWKiK365ND9lr/Zf1GUS+N9YXv4GJ296mDJRvRXf5o4ArM1NniWc244t9Qx Rz50pA/VLEPcJt2Vf8cRfAw0qdhwjjDusbdT7ebdx7pZo4bf6o7RUGyQptE/A8Q7vR+P QpSDc441kr5GTYkSliWdhF4rPo8DQnZEiGu/tb0Zr24h/kwniTDWuUQww4AOPlRxv8lQ GuNTYnEAieKfG0GhIxHE2p39IfLa2j5Ba4WF8QLAgJUaxliP2Jcn9qUxkUkojl1USOrE bdiGbGjk/gQNJqN/J52VB/EHzZFwsgURENiaf9v0P7GLKCYPaFH6SLuK++TbnvG2vl/j LkcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=RXfyW4VF; 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 19-20020a630213000000b00528c2ca6de3si2018425pgc.822.2023.04.28.19.00.09; Fri, 28 Apr 2023 19:00:23 -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=RXfyW4VF; 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 S1347332AbjD2B6H (ORCPT + 99 others); Fri, 28 Apr 2023 21:58:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347317AbjD2B6C (ORCPT ); Fri, 28 Apr 2023 21:58:02 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9E9D3ABC for ; Fri, 28 Apr 2023 18:57:59 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1a6bc48aec8so4703175ad.2 for ; Fri, 28 Apr 2023 18:57:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682733479; x=1685325479; 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=JwYEXU7Lp9XroufPN43xvmiTz9v2gxPHNeujBe94GAs=; b=RXfyW4VFENC5ciM0BkQroL4aTdKXdDxKRQP+lXVasRmQpe5AI9ZHyvuHYeeGYk3Qb3 5eGB9m1chP/gFDsK+Kq3oCrQGusaWdv4ohH1vJ1AauBiusk9QlXKDJxIcIXL/ysUJiuo TJ8ryIERQ67DdKzkaBWura/eB3J3OP4gWII1O8nQCqHtILnjZkE20TC7iYsmfyoi2YcD NVYLjMQk/hAcc+H6PB0dtfjya3cxCRCqtERmwcSfhVVfyFnWklGRnJI6OQH/9Y6bZpbv 0B8iJM+g4s5BoqriWl9kxk+QO331R/fFPpG6dylVLVil6y68Q6dXek410s1b5hZSql8w pDgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682733479; x=1685325479; 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=JwYEXU7Lp9XroufPN43xvmiTz9v2gxPHNeujBe94GAs=; b=cBYTLdASzQvkYnqdB+2Z3R5znC7Wipk0SeDHBC9SK6Ec33RC4pii0sx7fDtXj7C3P8 OuK0pC34Mz2wLi/U4qag3pjiUUSDUMR6jLspnktS2Q2hdGij6Vym0Sn+nuy5X52MvOyO oRQs6E/1j1SbZrrYWHU4B/FmhV59G6Elp9+3ynzAgNYJKk56LOOP+1zB1xPjsLbLrg5u XwCWKSSMO+k+p0r/3cFlyOMn0uxN00cZu5KMs5gAwNe45osXKKi/a6I9b8gB1QcPouSX Cw0B9rngSTaofv7TRA/5yH4YjLYJSWMKPRE2c7/4rUZ0nDeMBW5chIraUqoKcW3VuLEL NjlQ== X-Gm-Message-State: AC+VfDyJUkktKtexUr32DZnv7rKSyecvnrza7QTdyO3iEonev0Nl2ozc 5kNW+dcuhEX+D7QgQsxU0+YFOBkN2ktDR6ODGDktEg== X-Received: by 2002:a17:902:f78a:b0:1a9:b62f:9338 with SMTP id q10-20020a170902f78a00b001a9b62f9338mr6290325pln.45.1682733479236; Fri, 28 Apr 2023 18:57:59 -0700 (PDT) MIME-Version: 1.0 References: <20230406004018.1439952-1-drosen@google.com> <20230406004018.1439952-3-drosen@google.com> In-Reply-To: From: Daniel Rosenberg Date: Fri, 28 Apr 2023 18:57:48 -0700 Message-ID: Subject: Re: [PATCH 2/3] bpf: Allow NULL buffers in bpf_dynptr_slice(_rw) To: Andrii Nakryiko Cc: bpf@vger.kernel.org, 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 , Joanne Koong , Mykola Lysenko , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kernel-team@android.com 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 2:09=E2=80=AFPM Andrii Nakryiko wrote: > > would this work correctly if someone passes a non-null buffer with too > small size? Can you please add a test for this use case. > Working on a test case for this, but the test case I wrote fails without my patches. I'm just declaring a buffer of size 9 on the stack, and then passing in bpf_dynptr_slice that buffer, and size 10. That's passing the verifier just fine. In fact, it loads successfully up to size 16. I'm guessing that's adjusting for alignment? Still feels very strange. Is that expected behavior?