Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp3836074pxb; Mon, 21 Feb 2022 06:41:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJzUjINpGlqe0BiNltsi9KhLD2I3rxmcAT3IRACcOg+9H7OAYsPpLoEmhhG7SDYfm/83NONj X-Received: by 2002:aa7:9522:0:b0:4e1:d277:ce8 with SMTP id c2-20020aa79522000000b004e1d2770ce8mr18630473pfp.16.1645454505050; Mon, 21 Feb 2022 06:41:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645454505; cv=none; d=google.com; s=arc-20160816; b=RjlKNbN+m+mKdLOLLvHm52PzKrQNmYBmk8NyMbFiBARIUOgnGNRmUz5moHTq7cYQMG Tp6rgvIKctaiNrj8lBq2KwqXyzimFGlPnBSGKg9MgOqu9AUaZgZ+2JJ+3wrh4YY2D9w6 5VCIVNOJ7aSV6VciP5AtVcejkYRBacqZnGaq8Cv70KV+/0oPI1zuCb0RKu0evqX8OvPx XGnzvgmcgD5TkIleQTmNcbW6I5MFLqzh4ypuueRwSjkuZu7xJIgKH86gZ1OpN4u4fKiZ n7zyxK92bkFvYEDzXDzFWrnO+eTyRuA9TAvrGZ/HhZaxaeRIaQgUBgQdKbSTGw82F3KV omKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZLBW/052vSEd7deupEIUzgajEysqsXbvv/03aEcp6t4=; b=ITbePUIxHEyc3BmmB+DSkEcHoSshz75tUUzncuJDEV8kj/DasntVt+3+29z9klWW3K ug2tuVsl5LWj7pNG12aAjwaJ6ZoMzVQZ8aXd2cg6vciQiL/VeIn2YpILpADGPvr6Dw6k u7eOLemCQrwCYm3ErYHZtof/YdZgX8fIeXzAygVDVj4UV5g4FK3BmAhdOO4mibT2Ujv0 Ly88Norv12kl3PKG8MYjigyv3YgzAPbTw+BmmiXMNqZjLVBH2hMyAeZn5hPGqAIFOtBr 8+dqbNJmIJKVqSrbWnBGAFL+DwnNrloRxAX2k+ncVZcXEXO5HK8moOv+2CTNWaGGqfNb uZpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ki0VWzG3; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c16si15197992pgw.875.2022.02.21.06.41.29; Mon, 21 Feb 2022 06:41:45 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=ki0VWzG3; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352851AbiBUJr7 (ORCPT + 99 others); Mon, 21 Feb 2022 04:47:59 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:60516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350849AbiBUJlh (ORCPT ); Mon, 21 Feb 2022 04:41:37 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2F993D489; Mon, 21 Feb 2022 01:17:33 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id CF88BCE0E8B; Mon, 21 Feb 2022 09:17:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF7B3C340E9; Mon, 21 Feb 2022 09:17:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1645435044; bh=VWGfAshiuYdLKS4NFlADuZCK20g14roqriy9aABhR0Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ki0VWzG3IeyQy3WhigoGqw6d7Q/BVK/6SpzvxIHyi1I2t2WF46qO2byie7vqIlXH8 lHttUhbdErGQBaDjxrrxBCUY9flJkXBE6V7BNKw1mp5z2MKZRQgzkQmkhmwttPUELD RlVJNXcSpbmaLSMiULdCISlPXHx45EnPyw5Hacow= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hao Luo , Alexei Starovoitov Subject: [PATCH 5.16 007/227] bpf: Convert PTR_TO_MEM_OR_NULL to composable types. Date: Mon, 21 Feb 2022 09:47:06 +0100 Message-Id: <20220221084935.087780011@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220221084934.836145070@linuxfoundation.org> References: <20220221084934.836145070@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 From: Hao Luo commit cf9f2f8d62eca810afbd1ee6cc0800202b000e57 upstream. Remove PTR_TO_MEM_OR_NULL and replace it with PTR_TO_MEM combined with flag PTR_MAYBE_NULL. Signed-off-by: Hao Luo Signed-off-by: Alexei Starovoitov Link: https://lore.kernel.org/bpf/20211217003152.48334-7-haoluo@google.com Cc: stable@vger.kernel.org # 5.16.x Signed-off-by: Greg Kroah-Hartman --- include/linux/bpf.h | 1 - kernel/bpf/btf.c | 2 +- kernel/bpf/verifier.c | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -506,7 +506,6 @@ enum bpf_reg_type { PTR_TO_SOCK_COMMON_OR_NULL = PTR_MAYBE_NULL | PTR_TO_SOCK_COMMON, PTR_TO_TCP_SOCK_OR_NULL = PTR_MAYBE_NULL | PTR_TO_TCP_SOCK, PTR_TO_BTF_ID_OR_NULL = PTR_MAYBE_NULL | PTR_TO_BTF_ID, - PTR_TO_MEM_OR_NULL = PTR_MAYBE_NULL | PTR_TO_MEM, /* This must be the last entry. Its purpose is to ensure the enum is * wide enough to hold the higher bits reserved for bpf_type_flag. --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -5847,7 +5847,7 @@ int btf_prepare_func_args(struct bpf_ver return -EINVAL; } - reg->type = PTR_TO_MEM_OR_NULL; + reg->type = PTR_TO_MEM | PTR_MAYBE_NULL; reg->id = ++env->id_gen; continue; --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -13336,7 +13336,7 @@ static int do_check_common(struct bpf_ve mark_reg_known_zero(env, regs, i); else if (regs[i].type == SCALAR_VALUE) mark_reg_unknown(env, regs, i); - else if (regs[i].type == PTR_TO_MEM_OR_NULL) { + else if (base_type(regs[i].type) == PTR_TO_MEM) { const u32 mem_size = regs[i].mem_size; mark_reg_known_zero(env, regs, i);