Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp993901lqb; Wed, 17 Apr 2024 18:07:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXlS63k/gfCOjXr7kRQ6B+0GdPOqKLJcLgI5yftHUWWa3O12hHEb2bfe0nMVd9cgT4pRqbz79xFTRbswKXJceiARPoI4rYKBnTZE1s6RA== X-Google-Smtp-Source: AGHT+IFRcnoi2+MXrNUzQhoeT0Kb3StKYhyxR4ZphPxgUcu/sRcaNzlmqkVE/5yKXg75nbRaltaI X-Received: by 2002:a9d:731a:0:b0:6eb:94e4:4054 with SMTP id e26-20020a9d731a000000b006eb94e44054mr1301388otk.10.1713402457715; Wed, 17 Apr 2024 18:07:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713402457; cv=pass; d=google.com; s=arc-20160816; b=Fe0DJGZ1juKSjmmyv6ef63L44zkvSLRsVGcWIrBp9uEJYlrYmJ5c6A8KTg0+/DIogi US4N+hoFlHWX4DjwhWBsUXU5nsCDdLuradSapuJe5hVgAk7RLqOkoNuAuiBzvAwwRx3r UbxrkPn6/LNrmIRmbfqub22mkl2mRYfKCgzlDVKlu1NIS6PCNHSmxAxftZK9BPV3/GWa eZjw+fR3BZ20Gq6Hl28bVtK3kvugL6Wmx55ld/LNUZQ+8yh6nVJ81WnB7zCIsgjZeM6r QmUX9ronrOH5ceW73wvSpIZSRVX18mpDnJRTE+9ffKc9+NqHhsKSCoe8hjDNRfcP68Am zYUQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=MdSRxrDWVrTdyXc/SZ7hHOG18QRAIlMKQeP4juS8/a4=; fh=iFdGF/uNXCQgqAbmqFDjmTVdp/fHzOm/XE++UtZLbOU=; b=MyccEn52u3Z3LokGvNXyMW0CwhHK3BinYdSGX47asjhA25ceYYR5OzZ5Pw24Jyu3lI nbw0w66ZCKN9vLHs/eoPHl4C91HxQ/qfzSIYLRyp8OEqbcJiWAYKU7gavsuyEKlthyUr xSmimreMrxW1rsOvRuqvg8QuXJbBROjFGeqy66omrbeYN8/yMt0rFOjBfRbJKS3X+Msx LzBGCgyDlo17G+USyTvRaXYEjefA3EjBGJMTtrGa0YFror7XH5pJQUIwfgsSwjnxGPnY evLwuPsRVmZDavAA9G8dXW+cskCx4eUf4U7a0thLzjBVG8C16TkNKUPBvNnPGwtGLXYh 4K2g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=F9+yefgp; arc=pass (i=1 spf=pass spfdomain=flex--edliaw.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-149375-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149375-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id o7-20020a656147000000b005ee3f1a2d57si352084pgv.885.2024.04.17.18.07.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 18:07:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-149375-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=F9+yefgp; arc=pass (i=1 spf=pass spfdomain=flex--edliaw.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-149375-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149375-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 3D83E281EA1 for ; Thu, 18 Apr 2024 01:07:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B4F738830; Thu, 18 Apr 2024 01:07:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="F9+yefgp" Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (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 902D4611B for ; Thu, 18 Apr 2024 01:07:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713402448; cv=none; b=qylO6CKaXM8deQgIRFHMzTsRvtLtKz9d+YQihaAzyuYEnXgJ+ypWHiJ/C0FcHxW6mbg04edI1hz2MWCdgH2VNH2b/7cYNXKLVZNNpPSuWVv4svs4rHHfhzorQ+VmcjibITkErtzOHqizSzaB3Ar472y0Kn5yz4rijpfF4lyiqMw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713402448; c=relaxed/simple; bh=ugT74PoHd8kn03j1TJX7vb14OkXu1n5AwTPK5v5aCCg=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=hc+1JC25SQI+vxHKuM/zUmsAoROhv4N0nABOD4kHT6wKrSBfD5aBuJZVQZxkNnkZ0UJnKH7KwT6ggaL7ABbgfKjDOZJFYx9ZTuaCtMVKhbuD5sA7N6Kso9tK0cXamfdeJfZhIMW0ohMkxt55wYYBNvfBye6XAc9RZlv151X/bhU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--edliaw.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=F9+yefgp; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--edliaw.bounces.google.com Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dcc0bcf9256so643982276.3 for ; Wed, 17 Apr 2024 18:07:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1713402446; x=1714007246; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=MdSRxrDWVrTdyXc/SZ7hHOG18QRAIlMKQeP4juS8/a4=; b=F9+yefgp1nl7+IS9tccDVRKISTF7ti0wHBoZYtO5xeMClW5IeoRjUIg5mnKy2wExkQ 7IbHtLW1LvUwFLNr702k+80yPJoTL2wvcjGc7w4aoQB0uCLCQBMcvDobMNegIIn+wLW7 i+0VrBR9if43i1lQt3ByjE35ojYTmwQkt7LxhHklhh2euRfj0DewgA7/nkzpUxMQWTJf 0kQ7G2bMk2CsqcxHhr4dJ+GcEogX1fjeIuTcLD92z5ymnSotq2S97GjY3bZhTDc+8IEN KtBvH3Yzl91CCV3Bh3lh46x90600Bp3cjixEu6y9opcMcmgW3TuIuEElSYbCFdSLRLb9 Ye/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713402446; x=1714007246; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MdSRxrDWVrTdyXc/SZ7hHOG18QRAIlMKQeP4juS8/a4=; b=H9kpXE4dK8qnGsSP+rWw8OEz5dRYfSyZwD6zh2ijwqj/ngyhV66CpBlTAcTnIhNLjf EE8c/XkWyNTfBUfsuKpxJb7uU2qoootcgTeQHgBe6Frlwtwf2Y43my9SO7FSAgFUmWxi /74jvxiSW88zcMdyiRse8ZoajcqW37rbqn+kfmQ/+8WuKs3Z0jVCGXnF6mSmpmP58znt wyEuZ2bXjxUFDgrEuXNG/3MV2ZkDvh+HL4TlvaIpVi1gHRRh9KqncXSBrCkqykB+NhX1 pkb1IHgjKhXcSrfL6+WK49zOabsQlEyDpsF19YSkyvP38Wcn8rZBmdPOnUEsN3D43Qfn rR3w== X-Forwarded-Encrypted: i=1; AJvYcCWAItgqrTvabdVCV4JOSmN6VabeYSuY6ORjrmRBlCvi6Yb0vUpsa615hQfnU8ylqX+VwwY3TfkL9o4/VNcBQlRmm1Q4nWbqHQV/fdBK X-Gm-Message-State: AOJu0Yxd2bnhhOMiXhTjCY0dND+ReEUF2oJV88Dh1F+8+4uVeKxtBkGT gTFzjQa83lomZa0PRsDKb6P9GOl325zAwArBCS/WYcgaOOfB/FweJA4Mcm2Ku3b3Blcw2Obiool 1fQ== X-Received: from edliaw.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:305d]) (user=edliaw job=sendgmr) by 2002:a05:6902:18cc:b0:dc6:b982:cfa2 with SMTP id ck12-20020a05690218cc00b00dc6b982cfa2mr116831ybb.8.1713402446546; Wed, 17 Apr 2024 18:07:26 -0700 (PDT) Date: Thu, 18 Apr 2024 01:07:09 +0000 In-Reply-To: <16430256912363@kroah.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <16430256912363@kroah.com> X-Mailer: git-send-email 2.44.0.769.g3c40516874-goog Message-ID: <20240418010723.3069001-1-edliaw@google.com> Subject: [PATCH 5.15.y v2 0/5] Backport bounds checks for bpf From: Edward Liaw To: stable@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Hao Luo Cc: bpf@vger.kernel.org, kernel-team@android.com, Edward Liaw , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" These backports fix CVE-2021-4204, CVE-2022-23222 for 5.15.y. This includes a conflict resolution with 45ce4b4f9009 ("bpf: Fix crash due to out of bounds access into reg2btf_ids.") which was cherry-picked previously. Link: https://lore.kernel.org/all/20220428235751.103203-11-haoluo@google.com/ They were tested on 5.15.94 to pass LTP test bpf_prog06 with no regressions from the bpf selftests. v2: Made a mistake of not including the out of bounds reg2btf_ids fix Daniel Borkmann (4): bpf: Generalize check_ctx_reg for reuse with other types bpf: Generally fix helper register offset check bpf: Fix out of bounds access for ringbuf helpers bpf: Fix ringbuf memory type confusion when passing to helpers Kumar Kartikeya Dwivedi (1): bpf: Extend kfunc with PTR_TO_CTX, PTR_TO_MEM argument support include/linux/bpf.h | 9 +++- include/linux/bpf_verifier.h | 4 +- kernel/bpf/btf.c | 93 ++++++++++++++++++++++++++++-------- kernel/bpf/verifier.c | 66 +++++++++++++++++-------- 4 files changed, 129 insertions(+), 43 deletions(-) -- 2.44.0.769.g3c40516874-goog