Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp740352rdh; Thu, 26 Oct 2023 14:34:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE63oc2LIgYjtK6RSKdCkJ4uiIflkhRwbKlsd29jIsB9Mjg+QRsbBqOR4cNTnRTTh0sZz5A X-Received: by 2002:a67:c399:0:b0:452:c581:5a07 with SMTP id s25-20020a67c399000000b00452c5815a07mr995586vsj.11.1698356044234; Thu, 26 Oct 2023 14:34:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698356044; cv=none; d=google.com; s=arc-20160816; b=Wwv6Wqq0ICxJoESqLTAz6blFjm2hrfky1jvZ1gxyAjP+OVl51NI2bI1v0Fc+3A1ly8 7LS1rdN9dpQs15GD7x927YYt0nECSwqAIcCm0C5xHBUdlwoZm+aPcrKc2dBWTx9oUheD uNCwm3V164Fh77jJ7pZ5IT3VLwl07XO/q/tJQcAcrO8kdK52w4wBZpH2or57oWRWAilf 0AWCP9JCNvvhoHVGy3XKw9rShUezWtjJH2h6RclGJNmccQWTmDBhtrBd1cSRQqWiG2Hr FUrNOkZvSw5/EqoQTpkyXr7Z3nWPDS9evSy5UUnOGsTjOqKXSazHlM7gPtIMAoRjXO7X 7tNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:autocrypt:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature; bh=ASkx/seKw1YtjFjKsIGUgBV6CKjEmc7iU1IIiSP7eYk=; fh=+SdA9oJ0eK/JIKPBpAy75arv83S79KqZBwHd/uCqAbQ=; b=p+qAuvzR7RwTNAaywPMoA5fdi79QBcY2YZFCuqYzTX86UZU0GcVMu5jwCBmMFrprNh S1KyJAv+n5bVCRifgAU1uvFKmpTSOfKo6jf97UoYpH5pQONunEP3Dl4C2zRuyqdjQsOh DLooK76waE0Qe0KB/jFeZ9aGH5dJirtW8kXk57+gY4uTu/tryEfEI6CkdRXX1jvgm9XU AwX0M8HOxDVyfYu4mDnS6CB7SCJ2CoWBhFKhO+3hBgK/9dEkYy0hkPcQt1qWshGQp3RI iz5wtdayvoLDwEyVL91zopbAskeb6sLmIKTLL2QMUnT5MEpUKXklCluFf8w72jTQiuY2 kCkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=nYndZGk7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id t6-20020a254606000000b00da0cabd2c50si410716yba.693.2023.10.26.14.33.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 14:34:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=nYndZGk7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id D4BA1836E568; Thu, 26 Oct 2023 14:33:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344732AbjJZVdi (ORCPT + 99 others); Thu, 26 Oct 2023 17:33:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230271AbjJZVdh (ORCPT ); Thu, 26 Oct 2023 17:33:37 -0400 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D53BB1AC; Thu, 26 Oct 2023 14:33:33 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-99c3c8adb27so205081766b.1; Thu, 26 Oct 2023 14:33:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698356012; x=1698960812; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:autocrypt :references:in-reply-to:date:cc:to:from:subject:message-id:from:to :cc:subject:date:message-id:reply-to; bh=ASkx/seKw1YtjFjKsIGUgBV6CKjEmc7iU1IIiSP7eYk=; b=nYndZGk768C+pcpPfY+PNAM0e8jacZEaQzw+lBQGeQaq/C7fmPRe9zAO/NxJ7jm1Ho 1ol36e2mSezoYFd89bqvhg8F/15fYRxsa3h2C9oSAU6AsHfEZNxFXrnaEmucNWSh9FrP ZpiriqICGfBzIiQq0wj7JL7tehg+TCBHCYU0iFo1j5WD9wvxru8e8hOkRHE5gAkHZqqo zLKtHuJ5uBj7rbwLvMQLXMapzZqV/ys7tT/xKd2LRIWSWJ2VUDpRZbUbRKuNkFjmqu2B 2iMgrx1HtrWdqn0AYarb57ynZTe96o88MfSa7ybBW1IMMDSN6h7yvj2+zChtZ/XLmJOM kxRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698356012; x=1698960812; h=mime-version:user-agent:content-transfer-encoding:autocrypt :references:in-reply-to:date:cc:to:from:subject:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ASkx/seKw1YtjFjKsIGUgBV6CKjEmc7iU1IIiSP7eYk=; b=lpPs1VCBp1O22KzSXl2H6CqTA5lwqBzwj0DcONDSJxRI+xBs3pzoImTF3RplY7Itj1 X7St28Q/m91GS0X1yszR6v36hMy4rPrd6MgzqklhxQtJx1SC1Kmr/gV7K3VBLPluvNf5 J4Y6ewJMzte27yFMxEJzyiG5l/Qxamu/sF4YIxc8sPPtNWoRuAt/DmK6Xd1Cx/A+hiBf QDAxRuwMRWBuqiVuthFw+X66cz6i8944venhB2kTGQe9EHsYhisZDbqaszQ66xEbdqoE dFzdKuDKtqvUFokUyk6fHJqMNuK1Tlf154b7mYxySLUvmU6VB1cH62cteNVu0RzovmFB cpPA== X-Gm-Message-State: AOJu0YyQ2M0Ac0aG1wzJtS4Nd+YJuqv5TlDd33ggfnFUEUzcGrYhrmUT 1qL4J7UfFFycL2kXYN6if90= X-Received: by 2002:a17:907:3202:b0:9c6:3c94:69de with SMTP id xg2-20020a170907320200b009c63c9469demr803220ejb.53.1698356012084; Thu, 26 Oct 2023 14:33:32 -0700 (PDT) Received: from [192.168.1.95] (host-176-36-0-241.b024.la.net.ua. [176.36.0.241]) by smtp.gmail.com with ESMTPSA id k15-20020a170906680f00b0099b8234a9fesm186613ejr.1.2023.10.26.14.33.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 14:33:31 -0700 (PDT) Message-ID: <707a9c4c001ca5efe8bf7db36e7341f308651451.camel@gmail.com> Subject: Re: [PATCH bpf-next 0/2] bpf: Fix incorrect immediate spill From: Eduard Zingerman To: Hao Sun , 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 Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Date: Fri, 27 Oct 2023 00:33:30 +0300 In-Reply-To: <20231026-fix-check-stack-write-v1-0-6b325ef3ce7e@gmail.com> References: <20231026-fix-check-stack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iV/ecAOfB3HsqgTzAn555h0rkFgay0hAvMU/mAW/CFNSIxV397zm749ZNLA0L2dMy1AKuOqH+/B+/ImBfJMDjmdyJQ8WU/OFRuGLdqOd2oZrA1iuPIa+yUYyZkaZfz/emQwpIL1+Q4p1R/OplA4yc301AqruXXUcVDbEB+joHW3hy5FwK5t5OwTKatrSJBkydSF9zdXy98fYzGniRyRA65P0Ix/8J3BYB4edY2/w0Ip/mdYsYQljBY0A== Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.0 MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 26 Oct 2023 14:33:44 -0700 (PDT) On Thu, 2023-10-26 at 17:13 +0200, Hao Sun wrote: > Immediate is incorrectly cast to u32 before being spilled, losing sign > information. The range information is incorrect after load again. Fix > immediate spill by remove the cast. The second patch add a test case > for this. >=20 > Signed-off-by: Hao Sun Thank you for finding and fixing this issue. Acked-by: Eduard Zingerman > --- > Hao Sun (2): > bpf: Fix check_stack_write_fixed_off() to correctly spill imm > selftests/bpf: Add test for immediate spilled to stack >=20 > kernel/bpf/verifier.c | 2 +- > tools/testing/selftests/bpf/verifier/bpf_st_mem.c | 32 +++++++++++++++++= ++++++ > 2 files changed, 33 insertions(+), 1 deletion(-) > --- > base-commit: 399f6185a1c02f39bcadb8749bc2d9d48685816f > change-id: 20231026-fix-check-stack-write-c40996694dfa >=20 > Best regards,