Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp3257828pxy; Mon, 3 May 2021 20:18:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQs4w+S5PLhzMdrQdJeG4EitN7V6G8FF9A2+oi/QKqGYhL88VuWYieJ1R/TY/5MPLQlCB2 X-Received: by 2002:a17:90a:a78c:: with SMTP id f12mr2270574pjq.219.1620098307417; Mon, 03 May 2021 20:18:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620098307; cv=none; d=google.com; s=arc-20160816; b=s7PgnkY+pRvU6adQTLVsgQyRxN/p1dAzOVtuqEJbbgIWbm39TjjXmcsiA4MKeiK5ZB JYm2E9wQKErU0o3DbldZpyVxPmfKsbq+qPlCS9YjPXuhv7cKoaPtGgYFSKZnRfubfgZd UysoaombsTd3Ke0EnOO74/TKFtMfE0Ij8FtPYE5KBsxKDI5Bd+4bE3Pni3KRjjXHzAOY lHS6I/yDzmyAYCpR8XHA72LUAQDU1F/mwsBJdACOTid9y14tREAmBjXuGjHBQu//dsw+ 2uJeG5RRUNhLhCZPyG96RQFnkoNDfPEPXsuoab3N1+3J5y+drwRHVxolKW9aqoLEwANB LK7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=XKk2W5r7HRfkM2VxRD1ExD195oVL/dhaWQIOBv4OHnk=; b=wBng0/fIdnS5kkim8ovXrFlBhwAUYVXwOUmToN69e2fCdWX9GR8yovJOAZcZHK4li6 nSPfOpWxbQTIrZ7BJ2qN8SpDyn74rCoV1ibQ41/XsXrSzed6QNrxe82nRsnTol4l8VtU UNfI0B+tckD19QbSsoC52Rw3th6WmXt9NFwn4qy3hhZY2Lroilx5L386hyLyNmz81P8g ZWeDPEeHiQ5Dx7ujD90Y7DodItf3Flq+vSIhLtSkASQqyn+A2qiC5V0fdiroR8g4xSgr UeFEIH5YbDO0GbJIsNX1pM/6wHKGTZRdjTglM6zLyHvFsJ/oKiGA0CPEpGgLh65YZX3e 9UtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=R9xL0BVv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j64si18234212pfb.142.2021.05.03.20.18.14; Mon, 03 May 2021 20:18:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=R9xL0BVv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229714AbhEDDRT (ORCPT + 99 others); Mon, 3 May 2021 23:17:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:56276 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229708AbhEDDRS (ORCPT ); Mon, 3 May 2021 23:17:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620098183; h=from:from: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=XKk2W5r7HRfkM2VxRD1ExD195oVL/dhaWQIOBv4OHnk=; b=R9xL0BVv+PY2hXXgL/kEMN5gsSoHnuLr+jEqCKVG/ZeG/astq18kGhwl6MMjiQpp2zDLgp +YRUuo1C6DxxLij0zdDofBbicu9e+SaCtgM/TDCMp8reD3NgiwqBMtaP3xnGUTARmoR1H3 q8bjkpEp9cqz7froVElq1buG3sIpFVY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-383-BqZl-IspMSqAQw6DnWdfLw-1; Mon, 03 May 2021 23:16:20 -0400 X-MC-Unique: BqZl-IspMSqAQw6DnWdfLw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 81F09801817; Tue, 4 May 2021 03:16:18 +0000 (UTC) Received: from treble (ovpn-115-93.rdu2.redhat.com [10.10.115.93]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6E6D65D9C0; Tue, 4 May 2021 03:16:17 +0000 (UTC) Date: Mon, 3 May 2021 22:16:16 -0500 From: Josh Poimboeuf To: Andy Lutomirski Cc: X86 ML , LKML , David Kaplan , Andrew Cooper , David Woodhouse , Kees Cook , Jann Horn Subject: Re: Do we need to do anything about "dead =?utf-8?B?wrVvcHM/Ig==?= Message-ID: <20210504031616.covixup7rhdil3yq@treble> References: <20210503233010.x5lzpw4dq3gueg47@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 03, 2021 at 06:31:21PM -0700, Andy Lutomirski wrote: > On Mon, May 3, 2021 at 4:30 PM Josh Poimboeuf wrote: > > > > On Sat, May 01, 2021 at 09:26:33AM -0700, Andy Lutomirski wrote: > > > Hi all- > > > > > > The "I See Dead µops" paper that is all over the Internet right now is > > > interesting, and I think we should discuss the extent to which we > > > should do anything about it. I think there are two separate issues: > > > > > > First, should we (try to) flush the µop cache across privilege > > > boundaries? I suspect we could find ways to do this, but I don't > > > really see the point. A sufficiently capable attacker (i.e. one who > > > can execute their own code in the dangerous speculative window or one > > > who can find a capable enough string of gadgets) can put secrets into > > > the TLB, various cache levels, etc. The µop cache is a nice piece of > > > analysis, but I don't think it's qualitatively different from anything > > > else that we don't flush. Am I wrong? > > > > Wouldn't this type of gadget (half-v1 gadget + value-dependent-branch) > > would be much more likely to occur than a traditional Spectre v1 > > (half-v1 gadget + value-addressed-load)? > > I don't fully believe this. It's certainly the case that: > > if (mispredicted as false) > return; > secret = some_secret(); > if (secret == 42) > do_something(); Well, obviously we should never write secret-protecting code in that manner. I was actually thinking more along the lines of val = 0; if (user_supplied_idx < ARRAY_SIZE) // trained to speculatively be 'true' val = boring_non_secret_array[user_supplied_idx]; if (val & 1) do_something(); In other words, the victim code wouldn't be accessing the secret intentionally. So there's no reason for it to avoid doing data-dependent branches. > will leak the fact that the secret is 42 into the µop cache, but it > will also leak it into the icache and lots of other things. I see > nothing new here. Hm, I suppose. I don't think I'd ever considered that vector though. All the more reason to mask usercopy addresses... -- Josh