Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1912085ybb; Thu, 2 Apr 2020 09:33:49 -0700 (PDT) X-Google-Smtp-Source: APiQypLDS7mW0BrGa5mjtIuBUN/0lFNT/0dZEdJyYCS3OX2HDp5mGBT3u0qOfCeFN59/WGqY24mB X-Received: by 2002:a05:6830:146:: with SMTP id j6mr3039202otp.352.1585845229636; Thu, 02 Apr 2020 09:33:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585845229; cv=none; d=google.com; s=arc-20160816; b=RaIW8R9NbdJG++f37pK0z9Fs8GIm/dNApVTnE+kkgGho7194pC23pScm3cer6J+aQX 1Oz9k0m4K0L55As6VgupKog7lA+tJO0k3Le+2C92q1fpX4G9BUJdOWYSwoY5HO1Sqjo5 8SOU+u70VOui6CvpqueKSNwasdrUEEAUJhPkOz/WsQcn+sP94GyOMBA5LRjemfX46dO9 dcYy34MqXvEvK4syLGb1TSTlbHdYNzW2yK0Y9Y8CXZzg5PbeN0ccl+NmNbsUyWAYy90k 0ubC23yIv65Ys7G446HvWNHKe5FWvDaEPtwsvIQ5N44UoJinjNqntOjUFp52VgOCHZkd Rr0A== 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=0qdeGekIQvzSZQ/bchGHqOPc0D8b8p/R5z9ULmhHISQ=; b=wS08P1aebRlZMIKbpQogsf1dcXrVlXPPvgw8jBfZMJAr9WDSJ0XNheyHsLKwFhMjdJ /dOei36uyfqwUETZUqccew6oB3JZ1BEArldY3f0axcWRxu8Lna4wv08/U5/9LtDmLKPv NF/ugyTkh/B15/DMZ4n5IFM1uo6Qh2GZ1LK+KIQYlZlSjSKqLFVH4BSUtO9fHssxHuXz SkW/LjphE6WbUGGzqDEM5HE1ItKAvTJgMURGpKrDY6bfX5RK3GjOFA5+oIp2I98+FIIX LlsH/Ag6bFCPeUFYhGEsvFJjaTJf9XuHAmmBydvviJLlS5jxpoHSNcneUhohPNJg9Kca FdKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=arhfmja5; 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 w203si2489764oig.54.2020.04.02.09.33.36; Thu, 02 Apr 2020 09:33:49 -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=arhfmja5; 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 S2388668AbgDBOus (ORCPT + 99 others); Thu, 2 Apr 2020 10:50:48 -0400 Received: from mail-lj1-f177.google.com ([209.85.208.177]:43459 "EHLO mail-lj1-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729549AbgDBOus (ORCPT ); Thu, 2 Apr 2020 10:50:48 -0400 Received: by mail-lj1-f177.google.com with SMTP id g27so3489097ljn.10 for ; Thu, 02 Apr 2020 07:50:46 -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=0qdeGekIQvzSZQ/bchGHqOPc0D8b8p/R5z9ULmhHISQ=; b=arhfmja5XpBIHDuFu7oNorGl4wxrU0DpZmvk3vHpL0QOXMDs1U44LN6ygn3MBJ/eR3 3wLXRbPkBU+NCWdir2hE0fYj+xCGAf31wkRp7hNMxDnwTg3711UfFAbMQIBv8rl0gnzS 6zF+2Rbql09DPKB+8obYRkfmSPme12s2Kds2gbdUQxcs6t0y0mRwoEjxEm0rTT/uX5kR NNRtmJkZuVEVGSLeq191W5Hbi2hNkc/+mLCYkevKLXtKekdZt6pKC3QFksb7rD6s4dE6 v2wHRLKK3slv+B7Va2Jr0nwgP5poY2NSI6ZEJmImTZ9gAcKu3XNK9O+8dChhnTt63LcN UFxA== 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=0qdeGekIQvzSZQ/bchGHqOPc0D8b8p/R5z9ULmhHISQ=; b=JIqZczd9fI0xA3ach3APJtTu9nAuLBM1/tuXdgqCRAUMwDE4TADuLiix1pa86Aa7nc MiquM1fEyz/3Ug5U+FSIzcwenccI+gYxXI+2c9UypVZWReTMdU1dmPKCv0RtkRkV1HSp 6QzccqFcocPEPpwaHFI+C02L6INfXw87qVETxzicsN3bFGQJGeXdT69znP+gu63UdBQM e2Mt9xSxPtVzAm5lUVd71XY4quKX/jnaCNSXtd0n7sdl2jHiM3b/60w7njUCUmvUCvL4 SOtFprnoAm161ZjezvLOHZLgPM97aOI4hNJrtp/ediMCveuncNhYuoI2Wss4q2ZHcJOA Ikiw== X-Gm-Message-State: AGi0PuaXmjGiMFHGYmjLtjfnKakNXQeYddFXKBDHkwcqLotqEe5yfzGi qBY50Tck2HoPbcol+hkcVFMjBc1OCL6QlQClZVUYZw== X-Received: by 2002:a2e:5048:: with SMTP id v8mr2060638ljd.99.1585839045709; Thu, 02 Apr 2020 07:50:45 -0700 (PDT) MIME-Version: 1.0 References: <4c5fe55d-9db9-2f61-59b2-1fb2e1b45ed0@amd.com> <87k12yns9z.fsf@nanos.tec.linutronix.de> In-Reply-To: <87k12yns9z.fsf@nanos.tec.linutronix.de> From: Jann Horn Date: Thu, 2 Apr 2020 16:50:19 +0200 Message-ID: Subject: Re: AMD DC graphics display code enables -mhard-float, -msse, -msse2 without any visible FPU state protection To: Thomas Gleixner Cc: =?UTF-8?Q?Christian_K=C3=B6nig?= , Harry Wentland , Leo Li , amd-gfx@lists.freedesktop.org, Alex Deucher , "David (ChunMing) Zhou" , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , "the arch/x86 maintainers" , kernel list , Josh Poimboeuf , Andy Lutomirski 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 Thu, Apr 2, 2020 at 11:36 AM Thomas Gleixner wrote: > Jann Horn writes: > > On Thu, Apr 2, 2020 at 9:34 AM Christian K=C3=B6nig wrote: > >> Am 02.04.20 um 04:34 schrieb Jann Horn: > >> > [x86 folks in CC so that they can chime in on the precise rules for > >> > this stuff] > > They are pretty simple. > > Any code using FPU needs to be completely isolated from regular code > either by using inline asm or by moving it to a different compilation > unit. The invocations need fpu_begin/end() of course. [...] > We really need objtool support to validate that. > > Peter, now that we know how to do it (noinstr, clac/stac) we can emit > annotations (see patch below) and validate that any FPU instruction is > inside a safe region. Hmm? One annoying aspect is that for the "move it to a different compilation unit" method, objtool needs to know at compile time (before linking) which functions are in FPU-enabled object files, right? So we'd need to have some sort of function annotation that gets plumbed from the function declaration in a header file through the compiler into the ELF file, and then let objtool verify that calls to FPU-enabled methods occur only when the FPU is available? (Ideally something that covers indirect calls... but this would probably get really complicated unless we can get the compiler to include that annotation in its type checking.)