Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1010957ybe; Wed, 4 Sep 2019 11:06:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwa4R0Q6Kx7IoRgVFURopeHdVn59Jz0MWzBDyhERW7XLW5UETxkztRU973EzD5C7UUuyprF X-Received: by 2002:a17:902:8a88:: with SMTP id p8mr12895598plo.152.1567620406204; Wed, 04 Sep 2019 11:06:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567620406; cv=none; d=google.com; s=arc-20160816; b=kdEa2/httzD3+f573u/lQ9rDRuvaBEv5m1DClJlYFnEZMEhoYfrMnYScrRHTxgoDwR fnscZ8DbEHM3uvC6ozwp6al1pX8yqqLdsld5gVrZ+E8AnqGqCc62QsktJOnFJukLnx8g Ig2648z6f+lOg7/dZlJ9E+Q0zib7YpgU6cASDpARqrjEwfJSAyUrVbQdmBmnF2vEHgLV olLkFyJMcM+gZy5j6QiXe/xvsQUFKNhTCmhAaSU8lMspO5ISPK3vh7BtVX1Zknr9KjDM 05+EpdV/SMrrSwpy/xJcBxIHlWXUdjLZ4NJ2H0K524MLYz5Yl87o5DVsnvP3YUes0Hgg OOag== 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=yKYR+CxG7e5rmkLyqJX0dBEAQe3oholJPEvEf+Io/Do=; b=XEFf1h4aJhEPGdSVNTxBcfNC1LGuYTE40N/RP5yW3SCeoVrhaJwqGvWTZyRCriXQcR o4+vgbTJuzO6BZzL0MTc07fp5F9dqjMXiNbp7WVX4azmFdOhz+qNmguOIBdMHkah2tBh PUbnxPGVuNH+27kF7x8Hak2zI4M3IKfyKmgWvF5HPw1OW4wFN+Xq6RHevPLTaFF9HvCd nF3a64j12yCALjtTlaiLqmL4qpHJkNE0h8Iw99D8rmCFL8FfO+TN50pfrOq1yeHahySx fWIZLAya9Jr7FVATTHTtLd2QyDT0bWXuxyXj9KAuYtP6jxSsn/CHJjLTjXXrZk5l/CnZ j/tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iE4Yfawh; 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 91si18139814pld.380.2019.09.04.11.06.22; Wed, 04 Sep 2019 11:06:46 -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=iE4Yfawh; 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 S2389110AbfIDSEn (ORCPT + 99 others); Wed, 4 Sep 2019 14:04:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:45780 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389117AbfIDSEj (ORCPT ); Wed, 4 Sep 2019 14:04:39 -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 2E71D206BA; Wed, 4 Sep 2019 18:04:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567620278; bh=AlYrLLd2/oNTqAUY81/sN6/lWfyg0HvsynexbqdfeLI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iE4Yfawh76dePGnlD7h8yAgdSu6diNTqgo6Psi4usPlrn1Um4KEFEFZXyTwgVjZxO bM/eHhba7wQqR5y15lwO2CaEvwiPKMaUpAbfp3xa0tdkU5takLVjgw8mA3unJw3DnS n/sYD4Iu7GThuelLmtOLa3z4z755vl5rWxP9RlEs= 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 4.14 57/57] x86/ptrace: fix up botched merge of spectrev1 fix Date: Wed, 4 Sep 2019 19:54:25 +0200 Message-Id: <20190904175307.682768555@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190904175301.777414715@linuxfoundation.org> References: <20190904175301.777414715@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 @@ -652,11 +652,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;