Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp2131137lqe; Tue, 9 Apr 2024 10:17:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWAlevbCafiRrnKulOtgQN+A1jq5FXkaM1ErNCqtx6KUBbC1g9QhVDkAmEHjHdFhLCV2zmIOqIoOT659uaUMDYTdxT3KFnlUKeE4xlzqA== X-Google-Smtp-Source: AGHT+IFxftPPVi0fPkjKMP5U7IsZ2L7kbi1py+mogiKko0ASe/sxVgY1cjxkasSWOxxfc4utRQuZ X-Received: by 2002:a17:906:6d0:b0:a51:cde7:4130 with SMTP id v16-20020a17090606d000b00a51cde74130mr55760ejb.52.1712683039787; Tue, 09 Apr 2024 10:17:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712683039; cv=pass; d=google.com; s=arc-20160816; b=0gnnDJO99ieX9mgJlU8Oh2UgK0MPpssReJ3nYuttMumHyslWIcRPa0t6SFXbgsm0Pn XQHqNjzaZ0QQe3NVh8D5eSRns+pa5srI4mmTWt75bofRBZc7nG/0Z78SsmXeMtwllgFa yZ9t8oBQyKH7SeMvZ8eU7dno0ylIbnKqfqEwVakaU/R78FPWzMyzUMIx1fT/nWUdusZ1 Ibb5xdV8zYInkkV+HuroZgwDdpF8HqYvZaz4aylnJL4bA15thsxf+qMNOhFsK3KmI3XV 5A5XuDJ3xQs45bgoL6/eEg0dhEnrQXgHxq6bUc5guJEPiJ9eVt+pdtEPzgcfiMzhzfbc lfpQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=GcyQviJT/ZKll5Y+ZKktvq3eLlaWHgRX/7+F6P9kW0A=; fh=NFmBCIurdzs7/Z/jR4Jo0KAkEZ0nXmJqg2u8NzQ5n4k=; b=WGLsKiUSd7TZXepW/YyuOyfsnOGG/PCeBS7JzDwuLolcHhtqYpgcisqJ3zn6jYk7br 9vJFsFYjwaUk6kU+3QqMJXKZ1DsqzvMr0h0BckqfEmYfGbCKglk1uyDi0Zbc0iYFHO31 74u7Olk7oDAnaIHepmN7K8F37wkpGNyoyzUDh/lbTuYf6d+CD6WA0kJ8nHaJxJMoTNCP SQUZzXk4auPlqJKswoppoMiVwFdZ1t7Kad0LU5cbGZ40lFydHZ9Y10OymTB0TXmwFbVV q6wakxjK8CIdCs6BIEL9N9PYsEEKwl49YxZf2OvAwMIttZy92yKBIH4p520SgVcbYo4X gS8w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Bl60pRRN; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-137391-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137391-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ga41-20020a1709070c2900b00a51ce3feeb3si2929766ejc.437.2024.04.09.10.17.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 10:17:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-137391-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Bl60pRRN; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-137391-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137391-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 651A01F23984 for ; Tue, 9 Apr 2024 17:17:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F40A6155A53; Tue, 9 Apr 2024 17:17:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Bl60pRRN" Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8560815359E; Tue, 9 Apr 2024 17:17:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712683030; cv=none; b=dzQd5HFNg6ojK7JsWa9dANK+gRMbEgjhaDQf6/O8doMDk9eB+0BVJ8Tj5RpHTgvVyIIcaZbyPoRrIYSvBrPKzIdCbdUXwAXkJtLr2AiK3+NhxXtHN5Xc5o7OJO200RsHdhvPvRqa5BljaLoNfiBmkc7Uuu+x+E64MTI3B5XCiGg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712683030; c=relaxed/simple; bh=yPLx0WlPcqbYP7PztskjJ6gP7k8HuYhFWSUP1+GpN6U=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=onJZ5nMf1XI6r2oNpzsx+7flemqukb6jBg//iVZQyZ4RvFeYJBemzyQr4JLgKcdxTShNi2+vUpVe+rGf9Iebfg3jQXFkjscREJyaZoZxawsarHQt0X7C8KWrMsrKdhl8TZEBDtXCFYN6mjcowSegRvud+qU1O2YDEIDTG9JvqAI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Bl60pRRN; arc=none smtp.client-ip=209.85.208.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2d4a8bddc21so82894731fa.0; Tue, 09 Apr 2024 10:17:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712683027; x=1713287827; darn=vger.kernel.org; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject:from:to:cc :subject:date:message-id:reply-to; bh=GcyQviJT/ZKll5Y+ZKktvq3eLlaWHgRX/7+F6P9kW0A=; b=Bl60pRRNiLWIUAVIEFZv4IS8swHBa9qWkqf1b8Y6m680/9HPbT/Dvp874evkBUgynH 1sdpIzl7kxd07pKt0HNpebGrg5n/ONOWR8sh97RbhtJWtQJqcQTO2/WlH+ciEeRg2uuh oXVO3fsAu6aHbA51ORZOR3Sqw6Zh5vIRbe01+QAj7KdnT0Wu8bmVv5eGmuXx9M1sIQoB T/ssuBjebg0gxxqMfM+fG17W5gveKdMT7yOtrJ0GIXzx7DXI5TjQpLJe04zR5CcSRVc/ CebfXKR1xasx5kN7QV63Gs6gvVQEbYP/Sa415yLWiRvqLj5EWmWiCJFFVVAJZzcZEfEn z2wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712683027; x=1713287827; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=GcyQviJT/ZKll5Y+ZKktvq3eLlaWHgRX/7+F6P9kW0A=; b=QmaWShPN0wNpXmF6mp9Sh2TRTR5cbpBmMnzCG3x6t7hvW8tivsxm3ri2Qmi7NTDbEE NiAqOHn7A4ozLfFjAWyJMMx93Mn0eGxlI6Q2Jh01xP4cdeOwd0ib+xuS2DvYm6yPLkmA APoLlzhmLgba85WDzTQMPidbiKiTuTKwDiGWDpe2WA6rh8Tcu44Z/rwg9gvFK6FcLV1u eI2Ne3I0O9nqHrwO1OoOBmL/h+ZtPhkSfyHVjuV76Q/IO33oPFwfwASAAmrwUzc3HiX9 URahBAsYbCwvF57c9ccGTtb/fZL5Bes+0QF7ryO7mNTZ4wokZrhLcwZ3BOFyXiv8ySID 1aKQ== X-Forwarded-Encrypted: i=1; AJvYcCX9UTZ2mpKlEU+r62+tRudfnHnYMGquj7TPciIRaaKKZp1eW2+yiqVm0X6ymdcJ54BiVg1xUR0D4C6BtQzeJfUZbJvF6D74vfGJRb7TjLbZqi2UwCWCfLaMHNVrc2WgPTBo X-Gm-Message-State: AOJu0Yxk2DseqzcGMKwD1u/T08hHvKPY9y4TNRXIQ5lQ31lHPzNu02e7 pCqubYTGfejllx/0qgeG1/7D76v+kvEokFEc5K1OwPUXg5LoVmKbjXmL8FKNILU= X-Received: by 2002:a05:651c:1a28:b0:2d8:34ad:7f4e with SMTP id by40-20020a05651c1a2800b002d834ad7f4emr434658ljb.4.1712683026485; Tue, 09 Apr 2024 10:17:06 -0700 (PDT) Received: from [192.168.1.122] (cpc159313-cmbg20-2-0-cust161.5-4.cable.virginm.net. [82.0.78.162]) by smtp.gmail.com with ESMTPSA id p14-20020a05600c358e00b0041674bf7d4csm7945486wmq.48.2024.04.09.10.17.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 09 Apr 2024 10:17:06 -0700 (PDT) Subject: Re: [PATCH v2 bpf-next] bpf: Fix latent unsoundness in and/or/xor value tracking To: Harishankar Vishwanathan , Edward Cree Cc: ast@kernel.org, harishankar.vishwanathan@rutgers.edu, paul@isovalent.com, Matan Shachnai , Srinivas Narayana , Santosh Nagarakatte , Daniel Borkmann , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , "David S. Miller" , bpf@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240402212039.51815-1-harishankar.vishwanathan@gmail.com> <77f5c5ed-881e-c9a8-cfdb-200c322fb55d@amd.com> From: Edward Cree Message-ID: <9d149d61-239c-67ac-0647-b59a12264299@gmail.com> Date: Tue, 9 Apr 2024 18:17:05 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit On 04/04/2024 03:40, Harishankar Vishwanathan wrote: > [...] > Given the above, please advise if we should backport this patch to older > kernels (and whether I should use the fixes tag). I don't feel too strongly about it, and if you or Shung-Hsi still think, on reflection, that backporting is desirable, then go ahead and keep the Fixes: tag. But maybe tweak the description so someone doesn't see "latent unsoundness" and think they need to CVE and rush this patch out as a security thing; it's more like hardening. *shrug* >> Commit message could also make clearer that the new code considers whether >> the *output* ubounds cross sign, rather than looking at the input bounds >> as the previous code did. At first I was confused as to why XOR didn't >> need special handling (since -ve xor -ve is +ve). > > Sounds good regarding making it clearer within the context of what the > existing code does. However, I wanted to clarify that XOR does indeed use > the same handling as all the other operations. Could you elaborate on what > you mean? Just that if you XOR two negative numbers you get a positive number, which isn't true for AND or OR; and my confused little brain thought that fact was relevant, which it isn't. -e