From patchwork Sat May 6 01:31:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Rosenberg X-Patchwork-Id: 8985 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp798476vqo; Fri, 5 May 2023 18:40:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ61zjJL1K1SPCICtO3uvOufI1mcL0/oM/SFcnjJs1/RNkWZCHjiVPbq0Tl3LDBcWQpxZ23+ X-Received: by 2002:a17:902:b48d:b0:1ab:18d4:ccfb with SMTP id y13-20020a170902b48d00b001ab18d4ccfbmr3127593plr.9.1683337224911; Fri, 05 May 2023 18:40:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683337224; cv=none; d=google.com; s=arc-20160816; b=NJwBiNJ6J4H9hH9KS8WzASmrH/er+JMaRfjRSq09wElF/RbA/4rCImLkKNQjxtr/ke N5zz6v7wo2bHfUHq/nCtYCCrgdBOIVVTIMj7dK4h7/XB+eIlLEqL85NeSb4uCiyBdZCH JlnDpRjf04pg1Jf7g46bx4K9i9c8rO6mDw9Xm+0CiXDS+UtNcwfvzpU2gEJXXoYcL+Hc +2S8bnqjbII8Dmanf3s82ImV44Rm3Z6BdxNmCYwL4e/FwKIxSxkOQi1CWgRYCSitJ73j VVA6x31ZMwLLRSkkVq5Fu6XLBgXEI23nsN9XU2b8gsKDxbKW+G1YgAEjCC9DcnuO2SRe BbMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=6hp0Ifesb79HPJK/KIKzPfPQWNmnCC9SBcN/OAlybow=; b=ql4N7WkqWNAjlSpFUhHcLCoOxuOUtxOisqS6qoZiYU5QzhJaIiOHM0phbbkYY/MJ54 rEvbH71Ebch4SrDc6A6cF8nr4D8VzyPdtGeiuatdbWHKIrVDGYqqx9qJ3elueXKGAGNk tPCFKQ7+j3tAndAF7G+Rh18eTWyncRkQ0qBhzNEEm73QzJO9N1a7O5vf/Iiiy0am1tv2 grNpfsnY/2145teQsCbeCaL4f1tt3DbUmmOsXuCP83O7haqO+m0pfKskmeKxMHay5PFW B/0yPJKm0WKf8MG58ugYFFpkmrRtypAFeCYBb81Qo5LhzJyA9fvZNjy7/JnOeCmEAWgG PNYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=wn934bIj; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x19-20020a1709027c1300b001ab18d794a5si2720477pll.297.2023.05.05.18.40.12; Fri, 05 May 2023 18:40:24 -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=wn934bIj; 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 S231287AbjEFBbq (ORCPT + 99 others); Fri, 5 May 2023 21:31:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230265AbjEFBbo (ORCPT ); Fri, 5 May 2023 21:31:44 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA0DE72A6 for ; Fri, 5 May 2023 18:31:42 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-b9963a72fd9so4754096276.0 for ; Fri, 05 May 2023 18:31:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1683336702; x=1685928702; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=6hp0Ifesb79HPJK/KIKzPfPQWNmnCC9SBcN/OAlybow=; b=wn934bIjSlyYsjqUN/3i+nRgeyQ79+B1hcBs3GqYpWaJGFZXQA53NXLvputweRHFGw LMfhnju5v1AaMaoz9f4P0qQIYb5kkxJLnRgq6S2mToWYINn6YFZSntYoHigHqeEq6SRH 41UinaAMctI7sBvB3z8E9//uz0Rbp52e9gIrDjgSBr6yw4JTzlIHjeObPY/CjBcsKX6O 3i3syYMHoqqPrAapT7KfPo6h+KYOWD/FKhXk0yctt6mi/6o53LfT6gF6XfKNQuYTu6Cy wvc+4/7hWx1xbkRJOTC+2uMbg8jSKXBsY2oQ/eH/QSsFZs2JHRcIbHx9VIAXj/LEoAcy Oy1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683336702; x=1685928702; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=6hp0Ifesb79HPJK/KIKzPfPQWNmnCC9SBcN/OAlybow=; b=Ngu0j13kyjOOW9+T8KWXhr74N5fKrNlJuVbjXH3RR/3THaqxlDqvyHPxBbMsnxV2Je iRb4BU8lDx5ZzYm9UsOlbIak+Ab8mKJq9ecSDD0e7ZfUe69QNg7Q2qSW1vi+X1FF0bCg pI1MKaknxoAMItRmL7zauyPZ7Ak3boIukZK3VJheus7WSaW8G9NupvjjZiTVDP68VL7H FJO9fe1m4I2rO7zgCzqHb1DN7Lw3nF+k8Nc4QfOQqXC3iuKYj7JyVpD1CEsOoSu50Xi+ H7eIs0KElWpLg2/BrZesy+UF9oap6FVTIvn81AVWm+KG645OP+HYBhhvN33X4OUOTrfR TUyA== X-Gm-Message-State: AC+VfDwu55/KTXXvH/CSmi7yBDdW3ayuS7Fl+ph7E3zg6Xm50AI760mG Ea7Fl6AiXDDvSm1u61WieyeR8Sc2TOE= X-Received: from drosen.mtv.corp.google.com ([2620:15c:211:201:6826:a1a:a426:bb4a]) (user=drosen job=sendgmr) by 2002:a05:6902:1021:b0:ba1:b908:364c with SMTP id x1-20020a056902102100b00ba1b908364cmr2063343ybt.12.1683336702159; Fri, 05 May 2023 18:31:42 -0700 (PDT) Date: Fri, 5 May 2023 18:31:29 -0700 Mime-Version: 1.0 X-Mailer: git-send-email 2.40.1.521.gf1e218fcd8-goog Message-ID: <20230506013134.2492210-1-drosen@google.com> Subject: [PATCH bpf-next v3 0/5] Dynptr Verifier Adjustments From: Daniel Rosenberg To: bpf@vger.kernel.org Cc: 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, Daniel Rosenberg X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765107014082087354?= X-GMAIL-MSGID: =?utf-8?q?1765107014082087354?= These patches relax a few verifier requirements around dynptrs. Patches 1-3 are unchanged from v2, apart from rebasing Patch 4 is the same as in v1, see https://lore.kernel.org/bpf/CA+PiJmST4WUH061KaxJ4kRL=fqy3X6+Wgb2E2rrLT5OYjUzxfQ@mail.gmail.com/ Patch 5 adds a test for the change in Patch 4 Daniel Rosenberg (5): bpf: Allow NULL buffers in bpf_dynptr_slice(_rw) selftests/bpf: Test allowing NULL buffer in dynptr slice selftests/bpf: Check overflow in optional buffer bpf: verifier: Accept dynptr mem as mem in helpers selftests/bpf: Accept mem from dynptr in helper funcs Documentation/bpf/kfuncs.rst | 23 ++++++++++- include/linux/skbuff.h | 2 +- kernel/bpf/helpers.c | 30 +++++++++------ kernel/bpf/verifier.c | 21 ++++++++-- .../testing/selftests/bpf/prog_tests/dynptr.c | 2 + .../testing/selftests/bpf/progs/dynptr_fail.c | 20 ++++++++++ .../selftests/bpf/progs/dynptr_success.c | 38 +++++++++++++++++++ 7 files changed, 118 insertions(+), 18 deletions(-) base-commit: f4dea9689c5fea3d07170c2cb0703e216f1a0922