Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp957923lqh; Fri, 29 Mar 2024 02:32:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX8umVeNHdUfYmKMR4DHFQVMqgQqOQgw19cZAl3y51rTpA1QXuvrEne10mFtyCbu64uOTDayCxmaM0VbacGXuxRwAY4r/7lAvwrQWnGfw== X-Google-Smtp-Source: AGHT+IE/8oy9zrlNGKx8x8U4iKq8ruQXv7t54q4IfzK6clrIKsMz/0JDwbfHraWHDZwbUYDGqLF6 X-Received: by 2002:a0c:d812:0:b0:691:15c4:7983 with SMTP id h18-20020a0cd812000000b0069115c47983mr6842639qvj.0.1711704734636; Fri, 29 Mar 2024 02:32:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711704734; cv=pass; d=google.com; s=arc-20160816; b=TtXeQp2babXiia4KXCf+vBrKJo2b/GRPfDai5QLwFle0X/EKAStJBWYMIuxpQj55GM fZo7pqJPL6v3FHAe27G3aQ3+xn5B+KxpQ+bJQIn85foSEBPRX0/3n5fG9kW5XNLWA0R0 jrMA43YNxdk8D+z7BK75g17reW6+hiT3nksqZ38qZhpuA3AqElE/kxrRedRmzr0kn6jv VdP9qmDF5Wj0+zFWMYzPwij9W4eYAUmcH8yDPpDr2JqTuZcsub4+TfJJrnYYfVIYHGuN 8jX5fSlPD9Fd2N22j3zQDAYXalZ05fCJIr0dgkeC2yqPWhbF3xdW0Wy9/ckMcdI68QKh esEA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=9yYeY0H/o+D291JZuUItJ//uSQXIkkpkUjGt91aVkHI=; fh=hUVchyKFW2HzFFi3ZZWSvuv1ZvCHbKLRq5zwe3/LUyg=; b=t3IidEtNG6Uq6fgYxELrS+lUWr2T8HnXWSHbc5w9Qw55gZ8AHJwMdywnGDqJugY0IQ 5zcl8e8GvwPuICPiNpBjVl7zPSegXxd31jB9igRZpg9/QwcCDC1HNgjLXmOFTWwn05LI R4DFisNKo2E3TAsD4ulAPgZqHdgPGnQawSGb0m5g9iTJeb2d4Rf9GujOdo4w7PMEGrtz HdMUrTff4mAewoDN8yV3UGzGNpyPPsqCVgavjT8xqPwMXgw3XYuplHaOt17MIKreFxgT m+uea/dSFupiGAPHBnmC0mukuN0ndcQ8lIUjZ/7qLWSvZLL+evYtKFTMQuDoyut+hJs8 Le7A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RDk3CHEd; 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-124344-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124344-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id l14-20020ad44d0e000000b00696a20b29a8si3312026qvl.84.2024.03.29.02.32.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 02:32:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-124344-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RDk3CHEd; 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-124344-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124344-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5F9491C21BFC for ; Fri, 29 Mar 2024 09:32:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AC94D8563F; Fri, 29 Mar 2024 09:28:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RDk3CHEd" Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (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 17F2B81ADE; Fri, 29 Mar 2024 09:28:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711704502; cv=none; b=d53ILXd8Ijn1G2V9dCZqVH/LAa1fcxdtFe3yDXyrFBOq4/sHmcpYLmaPd2/JMcBFNGO8EcFXOAPjg74+n1K9FcRxtF/uatY+kil/nfk4rljtdiseX45EGyKGrZyJdJvz+E2zWFh7scXHEVn+cEyWiQXndGyUF5CeOLTLEMZNcmE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711704502; c=relaxed/simple; bh=FgbEWwixLhT7dYnqZHGKfknzb3PHUcM+sA8G6CiqAe8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=CNHNs+ilh1NcJcTNWbEo5sh9wiEBW0yHf6SX6Oi+zyfmcJe7+M6lMQtnEzKvGvTC2E4VuL9/HH0f0AoFxr7JIqy4dtjCBUgqzJs0prm3ZUv3KXHOifczwSMa7LdYsEugxsX7p6QQ2PErLe93KXKLhp0pa/ECVE518Rrj9IRJkhI= 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=RDk3CHEd; arc=none smtp.client-ip=209.85.218.42 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-ej1-f42.google.com with SMTP id a640c23a62f3a-a4e38f941c6so28531066b.2; Fri, 29 Mar 2024 02:28:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711704498; x=1712309298; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=9yYeY0H/o+D291JZuUItJ//uSQXIkkpkUjGt91aVkHI=; b=RDk3CHEdkEdcpqRbWjRbQe3VU8E0dopCmoojQyOMzbgazZAiuQeXQjgonB3z9mMTwH pmDi49/s9OUDxWhjWAlPPHS7d+zA5UNX12rm08vkXHVslmuJT66eCEQwWmz7IZBJGdmJ tuz+i433/25/MOmmc1Q7lN/nbH89NjC3gB+rwFGtRFWHkDkHnlwWHUFrKm+A62GPne6u Sqhg9A3kk9cO+LF/PbGK/wuaTcncieV1yWtbpioRQAMd2W/+VHYJjCcSERI8KHb/Uzz6 UrNFEFZ4Fi03Pe43CXQtwxSrmaIBKzLx1MgHgs1WhHgqyH+l/IeqTb0RWdapTqX9lPNO jfsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711704498; x=1712309298; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9yYeY0H/o+D291JZuUItJ//uSQXIkkpkUjGt91aVkHI=; b=iHv/GajsIp/qysPqbF7kg8Y9B08TTA91WXIs0CZFZoCiWYSGDTrgnQvq7uo9zYH26B VbO3jNuP8CDCI5Lxm65MUhBApi92Dug+eKVSZxPO/Z8Sz3lO3+ELQsJPPtMKAbtv1wzl pFdT0ALN/JWlvOmVP7OpNyQRGMsM/STEg1+m/njj+xaPYrPHt0akEqRnMbnbiFbb1fq4 cSJ4EzBy3HnPJrjoOnxj5jiw2KazvAQAfE52BgdUHx3pWNqL/jC+H0zsiFQCN2awl1ec qIzmHRTM77JfHCjv2oc/uDYcLw6yh7NWzvkZhWW8dBdbhyvXggYy4wxdVj2kp8Oofa6X 90EQ== X-Forwarded-Encrypted: i=1; AJvYcCWir3iyG7uo3FQ3AFcQd+UsHzncFlSbeEQjspDepL5uZ+xySF7uI+6CCclF0ayC+eu0E3hnbdFmYmm1SL34USEuvWQhCVXhqkZH4TQd X-Gm-Message-State: AOJu0YwmSbh/YANKI406miQp7DWYZs+REKBGSF3cqy9nG8Q4EVv1G8gr BtrLRRxJvL9TIcuqY4NzZI+FTpt+jh8hH9mJaX8Ib9DGoCTcPwoPtAft21vx4Lk= X-Received: by 2002:a17:907:868a:b0:a46:c11d:dd01 with SMTP id qa10-20020a170907868a00b00a46c11ddd01mr1486058ejc.50.1711704498085; Fri, 29 Mar 2024 02:28:18 -0700 (PDT) Received: from fedora.iskraemeco.si ([193.77.86.250]) by smtp.gmail.com with ESMTPSA id jx24-20020a170906ca5800b00a47152e6d10sm1700975ejb.134.2024.03.29.02.28.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 02:28:17 -0700 (PDT) From: Uros Bizjak To: bpf@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org Cc: Uros Bizjak , Alexei Starovoitov , Daniel Borkmann Subject: [PATCH bpf 0/2] x86/bpf: Fixes for the BPF JIT with retbleed=stuff Date: Fri, 29 Mar 2024 10:25:06 +0100 Message-ID: <20240329092723.17435-1-ubizjak@gmail.com> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Joan Bruguera Micó Fixes two issues that cause kernels panic when using the BPF JIT with the call depth tracking / stuffing mitigation for Skylake processors (`retbleed=stuff`). Both issues can be triggered by running simple BPF programs (e.g. running the test suite should trigger both). The first (resubmit) fixes a trivial issue related to calculating the destination IP for call instructions with call depth tracking. The second is related to using the correct IP for relocations, related to the recently introduced %rip-relative addressing for PER_CPU_VAR. Cc: Alexei Starovoitov Cc: Daniel Borkmann Joan Bruguera Micó (2): x86/bpf: Fix IP after emitting call depth accounting x86/bpf: Fix IP for relocating call depth accounting arch/x86/include/asm/alternative.h | 4 ++-- arch/x86/kernel/callthunks.c | 4 ++-- arch/x86/net/bpf_jit_comp.c | 22 ++++++++++------------ 3 files changed, 14 insertions(+), 16 deletions(-) -- 2.44.0