Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp917565imm; Fri, 12 Oct 2018 08:44:25 -0700 (PDT) X-Google-Smtp-Source: ACcGV63YhPgdcrV5UHrW9yuRFp+4nsctRKuo6/zw7i0QQ0DB7MfMrGeRmrD0IHIuGvvwKO1tYok3 X-Received: by 2002:a65:668d:: with SMTP id b13-v6mr5931392pgw.163.1539359065662; Fri, 12 Oct 2018 08:44:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539359065; cv=none; d=google.com; s=arc-20160816; b=Oa9hvt8oYlcgf0Pv2FVFDv+zE+aceX6mlTCB9+tEdyyhURKT+dE9WuSshLbvCvJf5u gpE4Jrvdz1aX2EVroWXJfLAao98tK/mBlIsqCPCVcv5AVTQkfyIK+bxvKdx2Zv0Fk0Ww fMRXwB3YvVqCzymME+3M9s14z7HOxuMyU86yM5F9f2uo/h1pLkuVQYbGQ159r89ChTqq 37QZ76316FqeVdZ2VcdsVpj/mhnc3PapWGtPj3KhCtaVKZL6SX8LAEAMhbDkRKo2zgou Kz7pl6tBVTAtDegpK+OoJZOdn0hSG3ryztyaqwgTBy5kY+UqKY0jD0Ac+N37i4t+odDj WxHQ== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=TGKNdRiAqsJ+9vv05Ju7TZ00qhmWcvpBHNFs7xhl1cA=; b=nD0q6/gTJCvrSJPKrQIMbl4enA3zFF9KuVXAGyaZvHvBire5LdW0VMeZrjjA9g5Uh1 muIHKQVoTBn18Tiz8wzwJtnfbUEMIpxXzWsR3k7ME5hvBwBtAWUsXWJIxJaHxcO4wNNx iT+uCAMVrUVGUhGsU1zkAJvpETwZSNP7Hfpt8IUUlWYXv36MqhortE9SSNDcTDA6d8Ev CSKJpsL8/VfENc4pfbfNfjkRqvo2ouC4Hb7Pj/KpKVabl25nebCwxzHKMV6F3teqpvtk 5PSQ4LYdeFg7EET2xHjoSdRGqsYhUwWjcWAFh4B1Mtw06HtspP5ZVqzepvBok9QZDaL9 jrCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=TDSHcY9+; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u4-v6si1506200pgi.554.2018.10.12.08.44.10; Fri, 12 Oct 2018 08:44:25 -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=@google.com header.s=20161025 header.b=TDSHcY9+; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729128AbeJLXPT (ORCPT + 99 others); Fri, 12 Oct 2018 19:15:19 -0400 Received: from mail-ot1-f43.google.com ([209.85.210.43]:43052 "EHLO mail-ot1-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728884AbeJLXPT (ORCPT ); Fri, 12 Oct 2018 19:15:19 -0400 Received: by mail-ot1-f43.google.com with SMTP id k9so12763316otl.10 for ; Fri, 12 Oct 2018 08:42:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=TGKNdRiAqsJ+9vv05Ju7TZ00qhmWcvpBHNFs7xhl1cA=; b=TDSHcY9+usFj9Lg6fBVkeBPBqHzT6L5PlJk9Ilc3Y4gFExb+XQVPOKr6UwRbfZeGGr CnOHT3sZzjpaVCeHWvPPHc0XsgGxVZUI8C4vTB2wH+MvpZKfJT0/+v5fhU0MPlqn532s vkfcBVwsL8e1DeEB7T1mJD4JMapXBL3G5Rbx0p52OwGTzdPCBZYMjqG4yLAKCxCpiUuP Tos9HVlJ+VLVsVE1x6wV6uDYbU+tyTpjiOcYT0/O/bCWdp7XS5Znf3+N7LMTY9UZ0xcE C0Wq5z7dC/wlM7G06Vl7r+t7rzn8yks6Y3axC3NoTtnaRoljKzuzYN8vQKwzejAkJR7x DIQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=TGKNdRiAqsJ+9vv05Ju7TZ00qhmWcvpBHNFs7xhl1cA=; b=EbYUyFdrhtK/pD6mHLR4VONIUegi2aeDWDUbnaCi2GV2sE0VLY+uOCBdp96EUxcS5d n0mzWY8fTkumh07XyZoUuxXq0VSure1mtSJdXifxt5owp51wTs9QVJpiyTjaT1IucDNC AeUrr/L4/ADNbQIQaYdG9nwkGYBeAN/PGnqzN4fdFv8ioQfcoRlB5SLAP2A08hssUotv Kn23Qd0nfgYReyRjQE0x0v5oH6cZgEK73Ab75C4dyhdGjXU9ZaEndBANkH/PJl1mzcbE Pt04Wg1+S2GcXLS3bGWBW33NcmsuoA3UrA0eAp5jLXfJJ5dhGG1PqpHV6PSrdT2k2p2y ihmw== X-Gm-Message-State: ABuFfoj0ulBc5kfrZU8706OhoqBtr7WUK2g7iFqoOaROmXT6ugErCxE+ BLHNRFcQbIfRVEmTo/4ktynuQZ1v3ZWwT0U2D7tyXg== X-Received: by 2002:a9d:2f23:: with SMTP id h32-v6mr4393271otb.255.1539358936091; Fri, 12 Oct 2018 08:42:16 -0700 (PDT) MIME-Version: 1.0 References: <20181011185458.10186-1-kristen@linux.intel.com> <20181012152515.1d816906@alans-desktop> <77F59E25-5244-4CBC-A3CB-DCF863803CD2@amacapital.net> <20181012160219.7d16ef59@alans-desktop> In-Reply-To: <20181012160219.7d16ef59@alans-desktop> From: Jann Horn Date: Fri, 12 Oct 2018 17:41:49 +0200 Message-ID: Subject: Re: [PATCH] x86: entry: flush the cache if syscall error To: Alan Cox Cc: Andy Lutomirski , Andy Lutomirski , Kees Cook , kristen@linux.intel.com, Kernel Hardening , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , "the arch/x86 maintainers" , kernel list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 12, 2018 at 5:03 PM Alan Cox wrote= : > > > My understanding is that the standard =E2=80=9Cbreadcrumb=E2=80=9D is t= hat a cache line is fetched into L1D, and that the cacheline in question wi= ll go into L1D even if it was previously not cached at all. So flushing L1D= will cause the timing from a probe to be different, but the breadcrumb is = still there, and the attack will still work. > > Flush not write back. The L1D is empty (or full of other stuff the way > the prototype I tested did it as x86 lacked a true L1 flushing primitive) What about the TLB? Once KPTI is unnecessary, are you going to need an extra TLB flush here to prevent PRIME+PROBE on the TLB? Also: Are you assuming that the attacker would only be able to do PRIME+PROBE, not FLUSH+RELOAD or other attacks that rely on shared memory (like FLUSH+FLUSH, or the MESI-based stuff that detects when a line stops being in modified state on another core)? > > > At best you have a microscopic window to attack it on the SMT pair. > > > > So only the extra clever attackers will pull it off. This isn=E2=80=99t= all that reassuring. > > It's going to be very hard for them to do that. You don't really have the > timing control in userspace to do that sort of thing easily. > > At the end of the day it's an additional hardenening not a fix. It's > designed to provide extra protection for the cases we don't know about > until we find them and lfence them. All of this (and all sidechannel of > any kind) is merely about reducing the bandwidth an attacker can achieve. > > The idea is that it's cheap enough that it's worth doing. > > > Or I would get a fancy new CPU and use UMONITOR and, unless UMONITOR is= much cleverer than I suspect it is, the gig is up. The time window for th= e attack could be as small as you want, and UMONITOR will catch it. > > That would be an interesting line of attack. You would still have to > navigate a fair bit of noise. > > Alan