Received: by 2002:ab2:6486:0:b0:1ef:eae8:a797 with SMTP id de6csp547487lqb; Sat, 16 Mar 2024 16:21:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUGuqBQlWLAblS4rDZDvo7xLtj4OpET0R7EHDvTZqsSXaGTdTd+W4lG+MOMMbm2ECcWgwN8GwHH+VoHeaTVrecDFBVIc5Pwbx4p0xciug== X-Google-Smtp-Source: AGHT+IFD9j4H0Jw4GlVtDUHuxgX7ryJBcBkmbMdderYNN+ggQghu0p4pQDKmu22tW3I1ZggiMZCW X-Received: by 2002:a17:906:2990:b0:a3f:1f0b:57d9 with SMTP id x16-20020a170906299000b00a3f1f0b57d9mr5380819eje.1.1710631284476; Sat, 16 Mar 2024 16:21:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710631284; cv=pass; d=google.com; s=arc-20160816; b=jy42XtnCtJ9DFaj/e8W22uBmZG3wkW+odrD+6CCcwJOfv6a07GL6dZC2e+sYNwBlnu K69qOG2tCu4kqIf0+xlIymxDZSpGGI8FExZxiV9OeU8m1ErHyG2D0JxoOLhLqIaqv3dv 7qjhuVgXF/+Qh7dhPYEb62EUcN0tmTsH3MgxbHGdLd5wNtjjDSmcgbp+sqvNFMW1MQkH Dikss+mm+HGsWn7GkgOMtP0LD1REtMLrsBtrOCFMjsNeMBkTLmo7tpufxVXPB88D6INq SKJ9GBL/tfnuEkkFZE0wdawBquA7ENtn/86z24ZKH7UUqftc0nX0ZAEjpe45eA/L8aSl M8bw== 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=u9RemNCbJK07Y6CWgTnC8EJ/F3+o5RaU3BSPTubYEeY=; fh=Ob+3Atd2ZPTP1gwZpyaBho7feBw+0fee7Cyom54fDsQ=; b=a2Chp3o7vys/89g6NaxIfyDxREOH3NitPlHmcKvUK6XpJoiJOpeI90iKhP0Q/yc7sK ncM/bnW5ruxsdcHYJA8XOdGzXbU/zmeJthxbVknn0PfkrzIIDdb+jYTEIOfP5Ajnpge6 vMoTTbZKO48CNJaFoRGHeBr23P2ZBahRByHKS2VzZ+ZvzOVTXqSzcNuDP9t+jHDOCwUy XUmvoTSxQ7uaJx/nca78rEr3aIhpI+Hj77J0UHUpQGbEwMk7yOp4Y+TG2uCgYcBH4QiL TWCId6U/0NFzaXdaWWcIzShVRg3kdDKnFO1su+HSRB5oLjX7OnNt5dSA3gjME0gS0TuF 2P7w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ddns7PQ8; 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-105305-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-105305-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 lf25-20020a170907175900b00a4671c92908si2925571ejc.190.2024.03.16.16.21.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Mar 2024 16:21:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-105305-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=ddns7PQ8; 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-105305-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-105305-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 21FB41F215E0 for ; Sat, 16 Mar 2024 23:21:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2529A43AC2; Sat, 16 Mar 2024 23:21:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ddns7PQ8" Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 5975E1CAAA for ; Sat, 16 Mar 2024 23:21:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710631277; cv=none; b=C4R1ZuhBJvxQ3DgjFm4q7JKJ1bZsQoGRxc345lPv7ofYVK/5V5wp11vvwxwxDwsr3Ly8YaAHD1E1wyFTCFrp2vCQa0U9kbCqeOAWeDKx7dvCSaqkQttEWhvLKrsoOts83Ce08y6NhRurE9p2SV9HYZaJiAIVCPY1+oq3ymlGLNY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710631277; c=relaxed/simple; bh=sMWZ8gwC6b4q/IlyOLqAExi//RIEkYeEOlRu42CrpKU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=tiAA7RiJYY5GHNpIZ92zXUFZTwjUMJV+cODSKS5EZUTlAeofT+DOV846/fiKeywhgz7wsVpRXUBrodyPIlZPjISDn0YKGP+1ZbLGv/5+X9KDBtZtgwmSrFH6zQtEHGLt5XerFuioUBLAJsIVFnb9681jl61iuCKj4DHkDRGueKs= 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=ddns7PQ8; arc=none smtp.client-ip=209.85.128.43 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-wm1-f43.google.com with SMTP id 5b1f17b1804b1-41409c8d7a4so3813055e9.0 for ; Sat, 16 Mar 2024 16:21:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710631273; x=1711236073; 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=u9RemNCbJK07Y6CWgTnC8EJ/F3+o5RaU3BSPTubYEeY=; b=ddns7PQ8Dx53zGzqOiV4s10Ssn8MA3YaPPY6AjGHDULkVFZ6QoTbzoOldzrHWKIJ5A LhisbinZy3wpke1hLAJHwAnk11XBpTK+EY74dcLl1Hfht0v2Yyfes9KmGW6XSlw5Oa4D 2afA/YnPtLEIrF4b2C5Jq6i9ONtj9uW3QqZL8SunwUkJ5a6JPARoEFYSwL2VcRUTaTNt vQcoI1U2H8iRku/gG9zVC3/lu6Tobl/SSNNW61yT8hmVru46h4ErCguWaUydEZxPqKin gg7vouINI1WItr9unwhKAPC6RNANJcq4mguW2hLfkM9MRK35MfpQMDGiYGKvjs2UQ1Bu /IhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710631273; x=1711236073; 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=u9RemNCbJK07Y6CWgTnC8EJ/F3+o5RaU3BSPTubYEeY=; b=qpE1bV3E5FByrepOPqbfdnqpikRb/G0SYNzp9vsq+JlGsyDAaPq8t4FjoUJMXjt57v JgJ90SeOgNRzYSBX2y7mTk8vdcC602MvTfWdZK9tgB4Uyqwg91nwBRnUOVH8qzHvAfU3 Dmh8tFHlYm5L6Laiz83+J24cJeMu0vShvR0Ho0YsrTqORitizjZs7veJCkaKSlNeEYTX cFVavEfN2aZvYF+RgtLF7fM9fhM60poK11tP/Zc4XSAGWKY0r9iD/0mHOE1boXFegaZ2 jnvpATbu6F3z6SohCBz2oku1F7barSdY2/DSFkto6JObCZ2ZTTWCPLKjZOJCd3EXPkgu /6Dw== X-Forwarded-Encrypted: i=1; AJvYcCUxm3VvO3WEKBcROIrJHdsldSbe28qYWkStFCnPbgSFnXeaBUPS7Z7Qh07jRvCnGS3KwwFJO672yAqcj14Q8Pbosd9DERkd05bPO0I8 X-Gm-Message-State: AOJu0YzbtEPvKrL/jOj4s1Ebc/TSwZdc7paAqfSeChV5AWP3Z/uzqJt8 JhUq2de/3lyjGDXTJQ6LlHFGRDE6ecY33i0DbNIWuKNxAhwQfc9IKDlP7iD5fGE= X-Received: by 2002:a05:600c:468d:b0:413:1d88:f85c with SMTP id p13-20020a05600c468d00b004131d88f85cmr6602731wmo.33.1710631273318; Sat, 16 Mar 2024 16:21:13 -0700 (PDT) Received: from solport.. (82.red-83-42-63.dynamicip.rima-tde.net. [83.42.63.82]) by smtp.gmail.com with ESMTPSA id fm13-20020a05600c0c0d00b004140a13f998sm1597028wmb.11.2024.03.16.16.21.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Mar 2024 16:21:12 -0700 (PDT) From: =?UTF-8?q?Joan=20Bruguera=20Mic=C3=B3?= To: x86@kernel.org, linux-kernel@vger.kernel.org Cc: Thomas Gleixner , Ingo Molnar , Uros Bizjak , Borislav Petkov , Dave Hansen , Peter Zijlstra , "H. Peter Anvin" , =?UTF-8?q?Joan=20Bruguera=20Mic=C3=B3?= Subject: [PATCH 0/2] x86/bpf: Fixes for the BPF JIT with retbleed=stuff Date: Sat, 16 Mar 2024 23:21:02 +0000 Message-ID: <20240316232104.368561-1-joanbrugueram@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 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. 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