Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1233643rwe; Thu, 25 Aug 2022 19:18:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR7k1UCbg/XPSrs2mvOeTetarrZE5mfyFFaI80T6TXPdSWkKmHrTgwB3D+GHUG9IitXvpYDn X-Received: by 2002:aa7:8653:0:b0:52d:6fc3:1e41 with SMTP id a19-20020aa78653000000b0052d6fc31e41mr1745000pfo.13.1661480326871; Thu, 25 Aug 2022 19:18:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661480326; cv=none; d=google.com; s=arc-20160816; b=TJTYs+lmJdhesE+08uhMzWSDTe43JMp3Bv9CO/+ojs7+M2yehHc1A+OrB6rcBmpZox WmM2TCHaAHjwmsWgxW1oIGriJubNJDnwvOiLgo+cygKHk9bS7dfXvGl5mgbLxSVksIzl fICyFUEzgW3TRSpr4xppyz+kNlNGih/2mvBZjOgBs0aURiU3zlohSVnEFPXGQYe6Mbff JAnoDkhotXQczfJ7Z0rQwug/M56P9ZNmlYJuRw90hP7hy+I6POZBtgyTm/sJImhtYXjr QJJNEPqpJ8+dOHcZIz94ctSTbz6fpOVlYO/+Jba1G3JY+ipQ/VD7FxXdJjtyeJZ3g1Te JV4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=USnukc/188Y9AouXvyJSCZFszKTYIwRy8hfHnkd63Zg=; b=C7eueO7/PUcLD1AZ43uvoj67E4qhIfR9ymesJntCpd0us1AL3j0vw+wGrRijcFVjTZ 98Liss37Z9m21Qi536MRBlYna2Gt3TBgmGeCsaWZoziUbOY0srfUkkr58Jm5vfE0WsnG J3QB9ocFzze5fNHLDbUAqJxn+Wb3CQ0hnfV32z+59sPIGt/PA/8R0Y9YxSlkXV96RKR6 mqO2zrBCVIZROrgV/lrsnvTPzn/lIjUpI6SJhIXsASmAXYmSB5Ola/0lscvbElOyws9n SEfF5udAsMxYJhQnTaiBEqh2Gcbz0rzkuWbhhgkESfEYGqrAKsezva708RZsru95FemT ubfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jOBJjSn3; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j15-20020a170903024f00b0016ede128c1asi510594plh.423.2022.08.25.19.18.36; Thu, 25 Aug 2022 19:18:46 -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=@gmail.com header.s=20210112 header.b=jOBJjSn3; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244449AbiHZBz1 (ORCPT + 99 others); Thu, 25 Aug 2022 21:55:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244025AbiHZBzW (ORCPT ); Thu, 25 Aug 2022 21:55:22 -0400 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50563AA4E1; Thu, 25 Aug 2022 18:55:21 -0700 (PDT) Received: by mail-il1-x142.google.com with SMTP id d15so156469ilf.0; Thu, 25 Aug 2022 18:55:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=USnukc/188Y9AouXvyJSCZFszKTYIwRy8hfHnkd63Zg=; b=jOBJjSn3uhe6R65ntwBq62rWm+g9yTDC+1ZL9gc/4gDeF18XrVNfQKqoHultqxnnQg /1dKMm2Ig2nrGr7oOY1KqXjnqjyATY4gUnZw1unhVyHf2jcpKk00zlmhCVCdpLz5uSQA tI4tZ2Bnx6stX4Wm7UoU7fMg862SH3b5SexcJvKl7vFtzhWiN8iL02zYyGwW+wI9Mdeu JXPrRk89eVO6K9WL7+OQK2FKXJ6z9P+pITKYxYSUzos9RlCy/J7sdR7DHCFwZiNTbXpV 41lI3vOyWLmV+C+G6Y+cJtQNVubXlMUeBChPoDqIyrZKi4XoPY0MVIQ/NE9aakL7TaRZ U3sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=USnukc/188Y9AouXvyJSCZFszKTYIwRy8hfHnkd63Zg=; b=nnTpOskY+N5XRMK7A4VFEXQMjTP5fLSIUN1xT7bV5NVgJS0SeX+3e8qD1yjSVDML5c P/aBBCbrIc2VWDGPntOLDCpn5jLf0FEqes1DhZsXz3Tu3CuYOv/t2mGrpa4ZyumRZiO2 /CjwHoiZlJqMEsZAQDA0Ml65JdE7NylaLlYpTCrVMYq3Ys1LqSkN/IKo7O+U55HXyV8d 1N9eBQfsMRxwrLSFBsHpMqLqaNfBGTdS0+SYvBfgqWhi/bzutgxdvhHEVSqDUmsSLy0v LGGT+LlULeAXSLmjeL+YY1kch2dLFdGZvzBFjCsUYoT8sw2nWxzV0NwHJklZXEdcnjPv Y7dw== X-Gm-Message-State: ACgBeo0N0KjA75kJkS2aUkpKr3L98oagsP3fWUGYV+xVKuD9WKbHuM89 D21CRX6eDhFrVF8GdHxcbA5bU7LYc8feZCBXwho= X-Received: by 2002:a05:6e02:661:b0:2e2:be22:67f0 with SMTP id l1-20020a056e02066100b002e2be2267f0mr3130745ilt.91.1661478920738; Thu, 25 Aug 2022 18:55:20 -0700 (PDT) MIME-Version: 1.0 References: <20220824134055.1328882-1-benjamin.tissoires@redhat.com> <20220824134055.1328882-3-benjamin.tissoires@redhat.com> In-Reply-To: <20220824134055.1328882-3-benjamin.tissoires@redhat.com> From: Kumar Kartikeya Dwivedi Date: Fri, 26 Aug 2022 03:54:45 +0200 Message-ID: Subject: Re: [PATCH bpf-next v9 02/23] bpf/verifier: do not clear meta in check_mem_size To: Benjamin Tissoires Cc: Greg KH , Jiri Kosina , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Shuah Khan , Dave Marchevsky , Joe Stringer , Jonathan Corbet , Tero Kristo , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 On Wed, 24 Aug 2022 at 15:41, Benjamin Tissoires wrote: > > The purpose of this clear is to prevent meta->raw_mode to be evaluated > at true, but this also prevents to forward any other data to the other > callees. > > Only switch back raw_mode to false so we don't entirely clear meta. > > Acked-by: Yonghong Song > Signed-off-by: Benjamin Tissoires > > --- > > no changes in v9 > > no changes in v8 > > no changes in v7 > > new in v6 > --- > kernel/bpf/verifier.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c > index d694f43ab911..13190487fb12 100644 > --- a/kernel/bpf/verifier.c > +++ b/kernel/bpf/verifier.c > @@ -5287,7 +5287,7 @@ static int check_mem_size_reg(struct bpf_verifier_env *env, > * initialize all the memory that the helper could > * just partially fill up. > */ > - meta = NULL; > + meta->raw_mode = false; But this is adding a side effect, the caller's meta->raw_mode becomes false, which the caller may not expect... > > if (reg->smin_value < 0) { > verbose(env, "R%d min value is negative, either use unsigned or 'var &= const'\n", > -- > 2.36.1 >