Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp241956pxb; Thu, 2 Sep 2021 03:11:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIyH/6YbIKz3ubInxQPafSrtorXwgH8FQaQtgZ127Odh4flrhENnnmOB+Ohe0lPv9C5W/Q X-Received: by 2002:a6b:f714:: with SMTP id k20mr2067567iog.148.1630577469903; Thu, 02 Sep 2021 03:11:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630577469; cv=none; d=google.com; s=arc-20160816; b=kF0OQzaQzEBIzpF5iKZo+/M2MZC/JIDC9liYHUpzISV1H5iXn4xJaMg5HZjyyzZ7Yv ZH72Br4zSZJFu1Z3NvfzIZ1USL8JbufNKqS3ws6ByMxwR8RYR48BlKvJxMZCAnzpkljX rRy/8EOVL5qgDhfvaya2XEhsscBl+Pj483gFAAgCO0g8ZFueQN3/A+YZqKXSYIMe2BIE Ozw3xdhCQO6YxRIDYANLe/Ybpt9W64+By7pt2n79KQXLQhDjJsA/1uRZe5SFlaNfhOJH k/0foetZ8uqIR3hy7SqhF/kFLB4V1PJ+6H0yFo/PKyngZqxP+UdsKOD41O8i5+8eOmHT B8oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=jtBVRNaJwUB7BF1D71uaETrSrxPN/g2RUrYaKIiFy5s=; b=vArEH6mpDv3PgqbcWN15+9TLOH15e6DyOYRn/LCgUyp5BAWXCrgIvnsKjK5tQ6A1x4 EiMeAFVQ3pw7sw9JiKtOJpGf+cEkTyhRir9MlO9P6FHcS9Ph4TSfB7emO6eZE5FjJoox /mwvoF9xjkiCsnokP7MoJ4dTxm6p34aHvbSs0r5kMC9H9/hw9RptlDTTx8ul8wSGsIx6 PKniqhitAM8ypgRpEalPMTgqRnYHXEVsqpm8h+6dQKDFZlUqWnODawQWlNOO4Sr5QZwV Iq47eVislk4TBDOfToyhTOqoAlKE9tAMhbTIhg6SF1Uzvsla1/EZQAsdyiZmxq/oLJkS Y3xg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g34si1305483jaa.104.2021.09.02.03.10.50; Thu, 02 Sep 2021 03:11:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232389AbhIBKG2 (ORCPT + 99 others); Thu, 2 Sep 2021 06:06:28 -0400 Received: from smtp23.cstnet.cn ([159.226.251.23]:43004 "EHLO cstnet.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231770AbhIBKG1 (ORCPT ); Thu, 2 Sep 2021 06:06:27 -0400 Received: from localhost.localdomain (unknown [124.16.138.128]) by APP-03 (Coremail) with SMTP id rQCowADX+BDLoTBh7RYDAA--.10653S2; Thu, 02 Sep 2021 18:04:59 +0800 (CST) From: Jiang Jiasheng To: bp@alien8.de, tglx@linutronix.de, mingo@redhat.com, x86@kernel.org, hpa@zytor.com Cc: linux-kernel@vger.kernel.org, jiasheng Subject: [PATCH 1/3] bpf: Add env_type_is_resolved() in front of env_stack_push() in btf_resolve() Date: Thu, 2 Sep 2021 10:04:57 +0000 Message-Id: <1630577097-644528-1-git-send-email-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.7.4 X-CM-TRANSID: rQCowADX+BDLoTBh7RYDAA--.10653S2 X-Coremail-Antispam: 1UD129KBjvdXoWruw1ruF4DXr1kWFWUAw4rAFb_yoWkuFX_K3 W8uF1rGwsxKFsava1jvw4fury2k3yYqFn3Za1YqFs8G3s8WFy5Gr98Xas3Jr4DGrWkKrZF vr98C3sIgF1avjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbcxFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr0_ Cr1l84ACjcxK6I8E87Iv67AKxVWxJr0_GcWl84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s 0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xII jxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr 1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7MxkIecxEwVAFwVW8twCF 04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r 18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vI r41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr 1lIxAIcVCF04k26cxKx2IYs7xG6rW3Jr0E3s1lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAI cVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7VUb8hL5UUUUU== X-Originating-IP: [124.16.138.128] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: jiasheng We have found that in the complied files env_stack_push() appear more than 10 times, and under at least 90% circumstances that env_type_is_resolved() and env_stack_push() appear in pairs. For example, they appear together in the btf_modifier_resolve() of the file complie from 'kernel/bpf/btf.c'. But we have found that in the btf_resolve(), there is only env_stack_push() instead of the pair. Therefore, we consider that the env_type_is_resolved() might be forgotten. Signed-off-by: jiasheng --- kernel/bpf/btf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index f982a9f0..454c249 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -4002,7 +4002,8 @@ static int btf_resolve(struct btf_verifier_env *env, int err = 0; env->resolve_mode = RESOLVE_TBD; - env_stack_push(env, t, type_id); + if (env_type_is_resolved(env, type_id)) + env_stack_push(env, t, type_id); while (!err && (v = env_stack_peak(env))) { env->log_type_id = v->type_id; err = btf_type_ops(v->t)->resolve(env, v); -- 2.7.4