From patchwork Sat Dec 2 13:08:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 172839 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp1749645vqy; Sat, 2 Dec 2023 05:08:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IEuZCsD78rDRIbHRqCNIjXJIHxCOSL9QQEFZ6hSxwF8eStsdvYD6KvHhooJLN/FO1TFN9Mp X-Received: by 2002:a17:903:1c2:b0:1d0:7011:6979 with SMTP id e2-20020a17090301c200b001d070116979mr1216525plh.12.1701522501132; Sat, 02 Dec 2023 05:08:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701522501; cv=none; d=google.com; s=arc-20160816; b=lzvGxolVMEawglS6BHqjAGhMAubpqLlooMTW/BC8Wdg+Jooi/nD5BjjfUXFy3aeax3 gqXxSXLLpiaplKoG7CWa5V8XX6QyfdaG+DCbTi2G49Q+ifo+mqwpzNCgN7XvHDLXiBHZ JlwkrOxT5TzxZlWdotyvv31K1aDR7bVY/YiFqZizk5K0jD/9KyMaQv8NoBiWZjhsuR5E vw001eZQ4KruApi5XP6ex5tS50F8v6CJnw9VjQZbGhY/LRoRp+zBRQBwpoMhnLsScDKz JhLn6rTY/0YVwCIvPAsDv5JOIJL10Hn4n/3fyRK8KdxKnpdaKodK/8cH06NNhz93T0Bd W6dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=Ahtf6qtGLkSFfzmKo7NT7kkLqGD19uzWB44u2/ZhTpI=; fh=6nb+o1eAWRernNjo9d+NWUXWMFjnuraqXdvwSCS0QGM=; b=UXkelr0aZMyoPEr1T7b1R0/0tzYjjWmrC0sZItQOLITqKZaRDsU7RA7UsUGESsJv+E NRnd8F4jjzKtt+Ap+TNEuo2b2RIi/+NQusgqMVi+dCROOLsSt04uxGb9Of5tWGFCFob/ CkIM2P2q284yKhBknbeJLrFnRD7loXqyex9PAwfCMAM+Z9MTRB+g/kzqs3fyerOFGQdn 2U0L331wqSU9qTi6CahSZddQFv5UkOBVyhN1mj0VMQVnPT7rcFdX9ogn1zfz2IyjhD6d MAYCe5K5uORcNRv5yTbHamXhgYMh6JYpf2ATiDiejbgaF+z/OB1idXl5GNTI+oC6xczM /V6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="L9PND/m0"; dkim=neutral (no key) header.i=@linutronix.de header.b=ce9VhqqK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id t15-20020a63460f000000b005b8f24e6526si4938648pga.234.2023.12.02.05.08.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Dec 2023 05:08:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="L9PND/m0"; dkim=neutral (no key) header.i=@linutronix.de header.b=ce9VhqqK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 1A47A80A5FB1; Sat, 2 Dec 2023 05:08:20 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232745AbjLBNIL (ORCPT + 99 others); Sat, 2 Dec 2023 08:08:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229671AbjLBNIK (ORCPT ); Sat, 2 Dec 2023 08:08:10 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 442B0119; Sat, 2 Dec 2023 05:08:16 -0800 (PST) Date: Sat, 02 Dec 2023 13:08:12 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1701522493; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ahtf6qtGLkSFfzmKo7NT7kkLqGD19uzWB44u2/ZhTpI=; b=L9PND/m0+A3zEJvrkuKQ/MakGvjD/5B66zjE4CZEK0P2U/uSg5TlOGU2NTv5A++yunWgpB GKC2AAKEJxKQOmLSoyyiHoiHIr1ce+6x9ZEmhSWYK0XqdAhnu2bMBBha0ZuqlUEeXxHHR+ c0xsnjTDvS2XkW14I0qymYgljALCJpmrMKXVkXu+ybBDWgfMVF/VAsJokPPTlhApkYD1U4 g20oTh8cBIdyx1O6s6WNeTwOVVQ+Hja8DBh5njl7TQP3vWMykM3RjdvHGVgTTYSc88EeWS 4wICZNk0UF+Cf4oxlbZmj30+K0vOmgrF2G3rlRkJ8qQv1R/69SwbKJC9q8aL9A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1701522493; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ahtf6qtGLkSFfzmKo7NT7kkLqGD19uzWB44u2/ZhTpI=; b=ce9VhqqKCeR9Zs6Zb8m/ol+M10bds++4dJzmwwgqpFQVN/p6K/HKeDJXb5xv+14qOnFl+7 0qY0wDvoiqiBeuAA== From: "tip-bot2 for Uros Bizjak" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/percpu] x86/callthunks: Correct calculation of dest address in is_callthunk() Cc: Nathan Chancellor , Uros Bizjak , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231201085727.3647051-1-ubizjak@gmail.com> References: <20231201085727.3647051-1-ubizjak@gmail.com> MIME-Version: 1.0 Message-ID: <170152249271.398.7485179912974283410.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 02 Dec 2023 05:08:20 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784069288881758516 X-GMAIL-MSGID: 1784175658105228616 The following commit has been merged into the x86/percpu branch of tip: Commit-ID: fc50065325f8b88d6986f089ae103b5db858ab96 Gitweb: https://git.kernel.org/tip/fc50065325f8b88d6986f089ae103b5db858ab96 Author: Uros Bizjak AuthorDate: Fri, 01 Dec 2023 09:57:27 +01:00 Committer: Ingo Molnar CommitterDate: Sat, 02 Dec 2023 10:51:28 +01:00 x86/callthunks: Correct calculation of dest address in is_callthunk() GCC didn't warn on the invalid use of relocation destination pointer, so the calculated destination value was applied to the uninitialized pointer location in error. Fixes: 17bce3b2ae2d ("x86/callthunks: Handle %rip-relative relocations in call thunk template") Reported-by: Nathan Chancellor Signed-off-by: Uros Bizjak Signed-off-by: Ingo Molnar Closes: https://lore.kernel.org/lkml/20231201035457.GA321497@dev-arch.thelio-3990X/ Link: https://lore.kernel.org/r/20231201085727.3647051-1-ubizjak@gmail.com --- arch/x86/kernel/callthunks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/callthunks.c b/arch/x86/kernel/callthunks.c index f56fa30..2324c7f 100644 --- a/arch/x86/kernel/callthunks.c +++ b/arch/x86/kernel/callthunks.c @@ -312,7 +312,7 @@ static bool is_callthunk(void *addr) if (!thunks_initialized || skip_addr((void *)dest)) return false; - *pad = dest - tmpl_size; + pad = (void *)(dest - tmpl_size); memcpy(insn_buff, skl_call_thunk_template, tmpl_size); apply_relocation(insn_buff, tmpl_size, pad,