Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1024181ybe; Wed, 4 Sep 2019 11:18:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqzdx9KRnW5LcvrgM38KdyqBGGLPavF3jw3mKfvagkF0JGy0pC3sEaYjMgmxkdzan2NuSWdD X-Received: by 2002:a17:902:441:: with SMTP id 59mr42875189ple.62.1567621115928; Wed, 04 Sep 2019 11:18:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567621115; cv=none; d=google.com; s=arc-20160816; b=n416+tqZHvdKmxwIr4DfBHftd2E9kf15c2TnauaFI/2PiBH5LWvZ+YTpNzw8mzCLYO yryUapZYYVUDABvCLVzOOmXX/QR9r2attqXsrSdruqhzqtYnTaTm+PQ0X8O9cYWWNBx8 S9D8jkf1++TxkPqRO8pN20jqpE3Ez2xaxIuQD5FacnGXJaHuVvg2mzXf4EqrW3bg5cSs JnFGPgmtdwUdmS59rh4KTlbV3keBUA7fISKDO6GQ7bjE3NZ/GNdTOr9xDOP8jjWLYFfY FFI82bYTsLevu994+7TqAUboR4Mbe0vcfDtAXtm9OqzFVIPFDmq2QU7WWbO6DYb2HQj8 6xMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sZ+mvkA0MqgLdaLqfI9+JCFOQmduyo4PO9dLr8nd5FI=; b=s5/KUmYqPZoSyQBaMS+JCAY2F1Mg2oWArwCC2k1MYaV4oNxLmV+p/IY6AFEHuU0M+7 Jt1hLsBN2yQEoU5LpKHcsAor4XZpSBsJhBKjmxEmV7AXtjxTAyAqM+NjNMYWhvj7g1j2 pPacyXbGjrK4PdYThp6LVlSWkIHgYwKG+v3+qht4kdUHOuI8ZiTwaMEh9BYyGjD3aRJU X9O0NA5qtoWOOAEGFmhwevc2tS3KVnTNoBgGxR63GrXjfjyCQHkrrkKB7EHwwASBwPp8 7zJbxxkGbrVZOtfB5qzMnKVuEJJzdfQ9vVBATM5ccUFQSGPIJvD4o2hsc2P9vUNCcw93 4ueA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oVXD+K6M; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q4si17866372pgt.20.2019.09.04.11.18.20; Wed, 04 Sep 2019 11:18:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oVXD+K6M; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390466AbfIDSPS (ORCPT + 99 others); Wed, 4 Sep 2019 14:15:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:60798 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390456AbfIDSPQ (ORCPT ); Wed, 4 Sep 2019 14:15:16 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 55323208E4; Wed, 4 Sep 2019 18:15:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567620915; bh=AyF3CQQK9F+gNH7TkbclQHOaJo10IFGgWfEQ7LIJJfc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oVXD+K6MfWYMKweWDU2/DcxLI6tfVoW8Ln3DiS0M7EVJb6JeVTBY99L6bxqioisiK HxF3GxmxTqAMFFE9CVn/UjtxXQ9JB0/nbSdQPR1kgO9WG8UvyP+I0yMKMzJ2+LR9pd NC70JcwwU05bVzRZvhgvpC6x8W9gKMC6WcL1krSo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brad Spengler , Dianzhang Chen , Thomas Gleixner , bp@alien8.de, hpa@zytor.com Subject: [PATCH 5.2 141/143] x86/ptrace: fix up botched merge of spectrev1 fix Date: Wed, 4 Sep 2019 19:54:44 +0200 Message-Id: <20190904175319.981793215@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190904175314.206239922@linuxfoundation.org> References: <20190904175314.206239922@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman I incorrectly merged commit 31a2fbb390fe ("x86/ptrace: Fix possible spectre-v1 in ptrace_get_debugreg()") when backporting it, as was graciously pointed out at https://grsecurity.net/teardown_of_a_failed_linux_lts_spectre_fix.php Resolve the upstream difference with the stable kernel merge to properly protect things. Reported-by: Brad Spengler Cc: Dianzhang Chen Cc: Thomas Gleixner Cc: Cc: Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/ptrace.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c @@ -644,11 +644,10 @@ static unsigned long ptrace_get_debugreg { struct thread_struct *thread = &tsk->thread; unsigned long val = 0; - int index = n; if (n < HBP_NUM) { + int index = array_index_nospec(n, HBP_NUM); struct perf_event *bp = thread->ptrace_bps[index]; - index = array_index_nospec(index, HBP_NUM); if (bp) val = bp->hw.info.address;