From patchwork Tue Mar 14 20:34:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Kuohai X-Patchwork-Id: 6586 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1618682wrd; Tue, 14 Mar 2023 00:47:57 -0700 (PDT) X-Google-Smtp-Source: AK7set8wc8D6aia8est/fqvLHnEzMClGBWeVhUTlRAVfATw+i+Kd0nY5IwcbZ7hpH9z5ul0xAO+5 X-Received: by 2002:a05:6a20:54a1:b0:d5:10ca:5264 with SMTP id i33-20020a056a2054a100b000d510ca5264mr3854313pzk.59.1678780077706; Tue, 14 Mar 2023 00:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678780077; cv=none; d=google.com; s=arc-20160816; b=XnRRRoRACrRu8e5jM6urkiaKC86pMZnYD+n0A924MZ+pKm5ZZ4ZcWKMGFt4KtU9C17 mzRUqDzI2FwfDZFapgsN8PwLG4aHbxFmx49zPxyetZC9YBdzTswV/sHfvkx+CjP1So/s 6CYKu4MLzVUMJeyIUTy7ww9FVneB6s6+bdYeJ7GRs735kR9UJHeNInUN3stg22ysrRsv Q5PRph2FZ0SvrthA3wpf1ZSQDOMtJmKFo4gIh8/B1F+FoOONfoezs0HHSsfN8iw5FS11 ABNqCvrUV3eFByZ07ILe9xWKK70ba1YMH13hznBRG1H8k3Yfuo1qy9dCZ43/nLu6Wt3p nruQ== 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 :message-id:date:subject:cc:to:from; bh=6VOcF0EC11QhRhTs8k7thjAx/hwXfVFv6dyhkJ7rMuo=; b=mTg/V0mA38GdSRM8sdTMMdKZyYEIYO3KU+OToi52teVr0Rueibde++C4SP/QFcbHvT Y07QAyeZ/KPBRgWtM9nhy/na7OayzJISRF6nDhbOjL7oxvLCyJtApnpIdx1/ChpYbinF JLWJyaGGgOSYuNHxSTlKaAr4CZZT02tONmTJr9Nk24ih6gHgKrdsPzquFC0wy2u/UVsa /arJiVtdh5wX+d5z/rjX7dVYpJryKCT6yQpceGL69RBzV71BsnaSSAUYjaU8csDjHSxU OkC3B9v4jpuyNWuAGWgVkhAizk8EuW2XjgDTXIWaXJTZvjVNtEF505ras4weE6APAN9d 1RSQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t9-20020a634609000000b00502e3fb90b3si1636088pga.713.2023.03.14.00.47.45; Tue, 14 Mar 2023 00:47:57 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229897AbjCNHfS (ORCPT + 99 others); Tue, 14 Mar 2023 03:35:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229624AbjCNHfQ (ORCPT ); Tue, 14 Mar 2023 03:35:16 -0400 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 173F87E7A6; Tue, 14 Mar 2023 00:35:15 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4PbQKV0nZqz4f3l80; Tue, 14 Mar 2023 15:35:10 +0800 (CST) Received: from k01.huawei.com (unknown [10.67.174.197]) by APP4 (Coremail) with SMTP id gCh0CgBnF6utIxBk_rhhFQ--.63403S2; Tue, 14 Mar 2023 15:35:10 +0800 (CST) From: Xu Kuohai To: bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@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 , Mykola Lysenko , Shuah Khan Subject: [PATCH bpf-next v2 0/2] bpf: Fix a umin > umax reg bound error Date: Tue, 14 Mar 2023 16:34:22 -0400 Message-Id: <20230314203424.4015351-1-xukuohai@huaweicloud.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-CM-TRANSID: gCh0CgBnF6utIxBk_rhhFQ--.63403S2 X-Coremail-Antispam: 1UD129KBjvdXoWrXr1kCFyxGFWrZF1Dtw4DCFg_yoWxGFXEya y8tas8JFnrXFy5Ja97KF17XrZrGrs09ryfAF1DtrWUJr1UZr18GFs5GF4Fqa4DXa18JrZ7 Jr90ya97Ar4agjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbsxYFVCjjxCrM7AC8VAFwI0_Gr0_Xr1l1xkIjI8I6I8E6xAIw20E Y4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l87I20VAvwVAaII0Ic2I_Grv_XF1l8c AvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq 3wA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_Gc CE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxI r21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87 Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lFIxGxcIE c7CjxVA2Y2ka0xkIwI1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2 IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v2 6r4a6rW5MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2 IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWrZr1j6s0DMIIF0xvEx4A2 jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0x ZFpf9x07joksgUUUUU= X-CM-SenderInfo: 50xn30hkdlqx5xdzvxpfor3voofrz/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=1.3 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_12_24, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * 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?1760327830051555284?= X-GMAIL-MSGID: =?utf-8?q?1760328498662930375?= From: Xu Kuohai This patchset fixes a umin > umax reg bound error and adds cases for it. v2: 1. add bound check to avoid min > max 2. update 32-bit reg min/max when 64-bit reg value is a constant 3. add Fixes tag v1: https://lore.kernel.org/bpf/20230307220449.2933650-1-xukuohai@huaweicloud.com/ Xu Kuohai (2): bpf: Fix a umin > umax reg bound error selftests/bpf: check bounds not in the 32-bit range kernel/bpf/verifier.c | 143 ++++++++++++------ tools/testing/selftests/bpf/verifier/bounds.c | 121 +++++++++++++++ 2 files changed, 214 insertions(+), 50 deletions(-)