Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1257308ybb; Wed, 1 Apr 2020 19:36:27 -0700 (PDT) X-Google-Smtp-Source: APiQypKBb2KESwn77ncoFrPg3NmATPXi2kpA+9Ys4NT7LCft0eb3tQuIEf6ZAnlmJqKa7m0OpUbu X-Received: by 2002:aca:d9c1:: with SMTP id q184mr729779oig.6.1585794987148; Wed, 01 Apr 2020 19:36:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585794987; cv=none; d=google.com; s=arc-20160816; b=R9IEKHY1DHRxfvm+SxEc3dbCzjaMxp0e8eurs/8wCfQTeIXbBo49UPwvl+zETl5gkW Hl6gR/oC/X4l2vLwPcG2tAjnXYxeEMyd8QWPfdKm7Dnr56bf25SesiBy2/3yfCBFOEx7 Rt7DDGOlADJD9qA3IVMHwmb12YLOjcmBy+nHWAuUh8e8zDDFoGd9XIge5ffISbT3St72 w7vdjqbYexzxkP/p4ItPHipkYDAhF2zn5AwLsa/KBlA+i0bc2NAcUgXccvR3Px4OZbT6 pMvUvbiX4e1q+TY55qS7v6OgUd6oz1NbpkaKTJknV7z292RwqK2Ggj2v9z/jmWGxglpa Tubg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :mime-version:dkim-signature; bh=ce4+jt1QnAedyVF+O0B43RTY85VjYC1oRuPq2H/Wy7k=; b=Oxg8xSLNo+HTrsjzLXT8oAYoYZfUdznp7ehdSox4Dw1tA1Emn4oe5+JPBBdtCuLHAJ iFVQqfR+o2dlPrBh6EigzKiKAIkXeyrKL6XvSNR5zXbR/mp6RmNPmbql7ja+9RHt43Af WYvJIxqHGtqpUkMU+QTj2MY4i6QT8Z95QP02KT1BCmQQT19rAn+DahKBFKuHixAE5Uhd zwn8V8Ef7W92tc+trOkVd22ejdINRuYm+uPfuyfILU37BICU7p+CUvJyki/mrPbn6kdV BDwX8nytb1jRzGV8b28agpzm2wCx0gO9I+OjZ15SVxPnA8KPzfPiCO+UUExGBXsDIjmx AbJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=A6wogXWb; 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 s84si1622630oib.83.2020.04.01.19.36.14; Wed, 01 Apr 2020 19:36:27 -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=A6wogXWb; 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 S1733283AbgDBCfV (ORCPT + 99 others); Wed, 1 Apr 2020 22:35:21 -0400 Received: from mail-lj1-f170.google.com ([209.85.208.170]:34201 "EHLO mail-lj1-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732664AbgDBCfV (ORCPT ); Wed, 1 Apr 2020 22:35:21 -0400 Received: by mail-lj1-f170.google.com with SMTP id p10so1644178ljn.1 for ; Wed, 01 Apr 2020 19:35:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=ce4+jt1QnAedyVF+O0B43RTY85VjYC1oRuPq2H/Wy7k=; b=A6wogXWb5tIgKQaMIGu+zexhgOwdF6lvWAZm6SmTGOJJnskmH/gBZkeLs280lc9mCO 76K5tHRHF4bNPBFY1Vw3xv/9kq5Dr5z498LI8cgExeQLhvzQx1m2F7QHYF4+dItfiqPC ECRlkqxZn7xuEYE0nqIxocSu12YOryDxx7NKkYYfx5xOoD2qPQsMG09WDVc0TQHDFAwe FoOp3yCdSi2sIKf8B95fjPdXWjsMhNsoPcv2TnpUkB9dote+qhBOl3SM4hrV0s3OsqhX gqlCnOtXyW93zxJkpnd1o7QcfHXxxDy3zwD2Doa4MmUyJV1LZeCgrJFBmMpEXVg0B+Fo 5HVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=ce4+jt1QnAedyVF+O0B43RTY85VjYC1oRuPq2H/Wy7k=; b=WsFGOOzYrNRNO+Prixq+lSG4k5BQhRBkaDzGRPkUu8RvLFdPvuC2QVfyI1jFUPoa97 VvrtSJ5a+EGqXfnxdifiBDiJJEPqg2J1B3GdwSPm2s8P89D6vLViOM295m1CHrdlmUSy vXIhC1/XoVFfLHNK6L/6v+sNCOZ2cMzNxrjN987R604N6G1LkFUHXJTAXd5H9u/vZ43Y o0wSMt4Ys0+92YdWSrwb4+q1Za7+2zK75xoJVaWM5cXV7N0hoZZ49hoPz2s/X1Qvj75K IaEI7rR77Xu326A+B5hxoNtdM4uTndhd4Dyz9iSSDUjU0Wk9dBkvMC42OHuQtD2IU46o p8Jw== X-Gm-Message-State: AGi0PuZX+WuEgnuHvVMwuMRAgTKfIDtADZ4hG6ULGm7UI1vZP9YuBpse U0Fc9lqCFq602cglDwCI1ImyqDpN4oxIIdt1UztW/A== X-Received: by 2002:a2e:9247:: with SMTP id v7mr575345ljg.215.1585794918859; Wed, 01 Apr 2020 19:35:18 -0700 (PDT) MIME-Version: 1.0 From: Jann Horn Date: Thu, 2 Apr 2020 04:34:52 +0200 Message-ID: Subject: AMD DC graphics display code enables -mhard-float, -msse, -msse2 without any visible FPU state protection To: Harry Wentland , Leo Li , amd-gfx@lists.freedesktop.org, Alex Deucher , =?UTF-8?Q?Christian_K=C3=B6nig?= , "David (ChunMing) Zhou" Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , "the arch/x86 maintainers" , kernel list , Josh Poimboeuf , Andy Lutomirski Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [x86 folks in CC so that they can chime in on the precise rules for this stuff] Hi! I noticed that several makefiles under drivers/gpu/drm/amd/display/dc/ turn on floating-point instructions in the compiler flags (-mhard-float, -msse and -msse2) in order to make the "float" and "double" types usable from C code without requiring helper functions. However, as far as I know, code running in normal kernel context isn't allowed to use floating-point registers without special protection using helpers like kernel_fpu_begin() and kernel_fpu_end() (which also require that the protected code never blocks). If you violate that rule, that can lead to various issues - among other things, I think the kernel will clobber userspace FPU register state, and I think the kernel code can blow up if a context switch happens at the wrong time, since in-kernel task switches don't preserve FPU state. Is there some hidden trick I'm missing that makes it okay to use FPU registers here? I would try testing this, but unfortunately none of the AMD devices I have here have the appropriate graphics hardware...