From patchwork Wed Aug 22 08:54:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10572741 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BE04914E1 for ; Wed, 22 Aug 2018 08:54:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2738283BD for ; Wed, 22 Aug 2018 08:54:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A593D2B017; Wed, 22 Aug 2018 08:54:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37B44283BD for ; Wed, 22 Aug 2018 08:54:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728481AbeHVMSM (ORCPT ); Wed, 22 Aug 2018 08:18:12 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:40418 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728114AbeHVMSM (ORCPT ); Wed, 22 Aug 2018 08:18:12 -0400 Received: by mail-ed1-f66.google.com with SMTP id e19-v6so899690edq.7 for ; Wed, 22 Aug 2018 01:54:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id; bh=rAzeZPpkLXm+S3HvDpqe2gOLTvp6aw7vSq8ch9u5vVc=; b=Nk/j5WWS6SVT2XvS+2eRge6Pgkdoqu6oZIKoqI/ggOr4nMstAJWt8mNXEDn4c/dJu+ bYI7Doo+FSrVo6rRXKiwb/DSmrM/Z/+aANUuU1HbLyZ+Jdc9AtyHwOHXAp0A/9EATl62 IBIOoZWwNG6Ud1VoJjrkzVh6JVQgqj5AmqD34= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=rAzeZPpkLXm+S3HvDpqe2gOLTvp6aw7vSq8ch9u5vVc=; b=Kd/h/KiOHuxVMgz8Ejp+qS0cYVA+sfC5nsZSbMbU7WOIu+2Xl9G2iCES9GCRcMQwbk 1fpitEf9iW9fGzrtXNqMbZ5lQ0oC4j9a2Lw+o+qd0Z65EqMkc/amFzIJZW0VaOA+K3yU eLeNWhvt5aqu40e3vDMlPrv5PbTTc9u6B9+hfXUn49dWsUHqKl4/EwWk0imzHlYEPfCm LwbzReaT9cTdgNQG+Kbk8wLHhR8hHrP+pYWY97wZDWbA3ky4Kf9MfDsAsL7uew+5Z1y/ Ch1BsDCWjJqi+Lk9rkl4kBgdgw1apL1qpADReZAIaGUUCno/V9J18fLJYKZmzXlCypWn 9AOQ== X-Gm-Message-State: AOUpUlFmV/WrEsyEU9oPFmUHCNJSBdBRd64d3jpNup6B2x2X3VyM6toe W8Na2QN4iBdSqboF1cUP+WnMAA== X-Google-Smtp-Source: AA+uWPwroOnIZiO092ahZiBlDVFB/sBJkDRxjB3R290paXBz/YxovTW/rg9cD0k5LwUOBXVi4d8LJg== X-Received: by 2002:a50:afc4:: with SMTP id h62-v6mr65306370edd.251.1534928053542; Wed, 22 Aug 2018 01:54:13 -0700 (PDT) Received: from phenom.ffwll.local (212-51-149-109.fiber7.init7.net. [212.51.149.109]) by smtp.gmail.com with ESMTPSA id r21-v6sm636418eds.7.2018.08.22.01.54.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Aug 2018 01:54:12 -0700 (PDT) From: Daniel Vetter To: DRI Development Cc: Intel Graphics Development , LKML , Daniel Vetter , Ben Skeggs , Bartlomiej Zolnierkiewicz , Greg Kroah-Hartman , Hans de Goede , Alexander Kapshuk , Kees Cook , Thierry Reding , David Lechner , nouveau@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Daniel Vetter Subject: [PATCH 1/4] fbdev: Drop FBINFO_CAN_FORCE_OUTPUT flag Date: Wed, 22 Aug 2018 10:54:02 +0200 Message-Id: <20180822085405.10787-1-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.18.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This was only added for the drm's fbdev emulation support, so that it would try harder to show the Oops. Unfortunately this never really worked reliably, and in practice ended up pushing the real Oops off the screen due to plentyfull locking, sleep-while-atomic and other issues. So we removed all that support from the fbdev emulation a while back. Aside: We've also removed the kgdb support, for similar reasons. Since it's such a small patch I figured I don't split this up into the usual 3-phase removal. Cc: Ben Skeggs Cc: Bartlomiej Zolnierkiewicz Cc: Greg Kroah-Hartman Cc: Hans de Goede Cc: Daniel Vetter Cc: Alexander Kapshuk Cc: Kees Cook Cc: Thierry Reding Cc: David Lechner Cc: nouveau@lists.freedesktop.org Cc: linux-fbdev@vger.kernel.org Signed-off-by: Daniel Vetter Acked-by: Bartlomiej Zolnierkiewicz --- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 1 - drivers/staging/vboxvideo/vbox_fb.c | 3 +-- drivers/video/fbdev/core/fbcon.c | 1 - include/linux/fb.h | 4 ---- 4 files changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 844498c4267c..20a260887be3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c @@ -379,7 +379,6 @@ nouveau_fbcon_create(struct drm_fb_helper *helper, info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT | FBINFO_HWACCEL_IMAGEBLIT; - info->flags |= FBINFO_CAN_FORCE_OUTPUT; info->fbops = &nouveau_fbcon_sw_ops; info->fix.smem_start = fb->nvbo->bo.mem.bus.base + fb->nvbo->bo.mem.bus.offset; diff --git a/drivers/staging/vboxvideo/vbox_fb.c b/drivers/staging/vboxvideo/vbox_fb.c index 43c39eca4ae1..034f8ffa8f20 100644 --- a/drivers/staging/vboxvideo/vbox_fb.c +++ b/drivers/staging/vboxvideo/vbox_fb.c @@ -155,8 +155,7 @@ static int vboxfb_create(struct drm_fb_helper *helper, * The last flag forces a mode set on VT switches even if the kernel * does not think it is needed. */ - info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT | - FBINFO_MISC_ALWAYS_SETPAR; + info->flags = FBINFO_DEFAULT | FBINFO_MISC_ALWAYS_SETPAR; info->fbops = &vboxfb_ops; /* diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 5fb156bdcf4e..2b5bb52b1798 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -1104,7 +1104,6 @@ static void fbcon_init(struct vc_data *vc, int init) if (p->userfont) charcnt = FNTCHARCNT(p->fontdata); - vc->vc_panic_force_write = !!(info->flags & FBINFO_CAN_FORCE_OUTPUT); vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; if (charcnt == 256) { diff --git a/include/linux/fb.h b/include/linux/fb.h index aa74a228bb92..fa8c6f9c9c3a 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -457,10 +457,6 @@ struct fb_tile_ops { */ #define FBINFO_BE_MATH 0x100000 -/* report to the VT layer that this fb driver can accept forced console - output like oopses */ -#define FBINFO_CAN_FORCE_OUTPUT 0x200000 - struct fb_info { atomic_t count; int node; From patchwork Wed Aug 22 08:54:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10572753 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 76D881579 for ; Wed, 22 Aug 2018 08:54:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64B192B018 for ; Wed, 22 Aug 2018 08:54:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58EC72B03D; Wed, 22 Aug 2018 08:54:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED9BD2B017 for ; Wed, 22 Aug 2018 08:54:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728400AbeHVMSY (ORCPT ); Wed, 22 Aug 2018 08:18:24 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:40421 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbeHVMSP (ORCPT ); Wed, 22 Aug 2018 08:18:15 -0400 Received: by mail-ed1-f67.google.com with SMTP id e19-v6so899760edq.7 for ; Wed, 22 Aug 2018 01:54:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=z4YaKXzJ/DownRwu4yv1jXZW8lTAGwrCMpU9ehgypc4=; b=d76XWmxNBPKF2ilzx595VNc8Fb69toGGSwPhmi4orJx6Q32PdRq9eRDWJ5NY5SUIoW lXizKQdmV06CqSvFYDg1Z9MLrgb2fgfPTONZ4mBOPbFvacepXNzPVf5S2ZTf5vsjcaLo zYy2OyMB5XIjbzysXPjq7BLXFE4r241d7PD/Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=z4YaKXzJ/DownRwu4yv1jXZW8lTAGwrCMpU9ehgypc4=; b=YGUPdHMDDckrfiqX9EjK6Gdwo9mXdRZGpJdwNVsRbaO4/IFNC5feD7dnYUUWMTkMad KySuIagRg8NxXnWU/filHwtYWMVy55LO3p7I6z/ld42IvhpXSnYbhdrm0ZeWO4ssmNLl cxc8usYsLwNdQt+JT4w5TA7LPhVP5HZV9YzIBht/ShE1izSTyDAHw7e3iK0qfKgoPsC9 KwwKlrQfZxvNL/m3QgUg/c90PxjHA8jGoGqwg3GCtZUY/QV6o7OVu7ftpzHCv5zHhqQw Ka8734jjx6CaswPVDWudFDkrHOlhaBB1wlebUAj//XL0f8ano9dP+7SPIK2a37yDGPl5 QVkg== X-Gm-Message-State: AOUpUlHF+zYTLD0ZfJUqlW+dOkG1Oy4DReK95gZ1RYfk9LyI7h4pHlX+ bf/zvo3BlYdYaZNdhR7vvfoPbEIujajP5g== X-Google-Smtp-Source: AA+uWPzAaBN0YUaOkXa9n2AysLGFpumX2evUm4a/aTID+b2O4fqiFRFgv06TKiNogRx4zNQGMA/g0g== X-Received: by 2002:a50:b8c5:: with SMTP id l63-v6mr64588855ede.80.1534928056364; Wed, 22 Aug 2018 01:54:16 -0700 (PDT) Received: from phenom.ffwll.local (212-51-149-109.fiber7.init7.net. [212.51.149.109]) by smtp.gmail.com with ESMTPSA id r21-v6sm636418eds.7.2018.08.22.01.54.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Aug 2018 01:54:15 -0700 (PDT) From: Daniel Vetter To: DRI Development Cc: Intel Graphics Development , LKML , Daniel Vetter , Bartlomiej Zolnierkiewicz , Kees Cook , linux-fbdev@vger.kernel.org, Daniel Vetter Subject: [PATCH 3/4] fbdev: Add FBINFO_HIDE_SMEM_START flag Date: Wed, 22 Aug 2018 10:54:04 +0200 Message-Id: <20180822085405.10787-3-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180822085405.10787-1-daniel.vetter@ffwll.ch> References: <20180822085405.10787-1-daniel.vetter@ffwll.ch> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP DRM drivers really, really, really don't want random userspace to share buffer behind it's back, bypassing the dma-buf buffer sharing machanism. For that reason we've ruthlessly rejected any IOCTL exposing the physical address of any graphics buffer. Unfortunately fbdev comes with that built-in. We could just set smem_start to 0, but that means we'd have to hand-roll our own fb_mmap implementation. For good reasons many drivers do that, but smem_start/length is still super convenient. Hence instead just stop the leak in the ioctl, to keep fb mmap working as-is. A second patch will set this flag for all drm drivers. Cc: Bartlomiej Zolnierkiewicz Cc: Kees Cook Cc: Daniel Vetter Cc: linux-fbdev@vger.kernel.org Signed-off-by: Daniel Vetter Acked-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/core/fbmem.c | 4 ++++ include/linux/fb.h | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 609438d2465b..549d0f86fcf3 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1116,6 +1116,8 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, if (!lock_fb_info(info)) return -ENODEV; fix = info->fix; + if (info->flags & FBINFO_HIDE_SMEM_START) + fix.smem_start = 0; unlock_fb_info(info); ret = copy_to_user(argp, &fix, sizeof(fix)) ? -EFAULT : 0; @@ -1326,6 +1328,8 @@ static int fb_get_fscreeninfo(struct fb_info *info, unsigned int cmd, if (!lock_fb_info(info)) return -ENODEV; fix = info->fix; + if (info->flags & FBINFO_HIDE_SMEM_START) + fix.smem_start = 0; unlock_fb_info(info); return do_fscreeninfo_to_user(&fix, compat_ptr(arg)); } diff --git a/include/linux/fb.h b/include/linux/fb.h index fa8c6f9c9c3a..f42b09ca71f8 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -456,6 +456,13 @@ struct fb_tile_ops { * and host endianness. Drivers should not use this flag. */ #define FBINFO_BE_MATH 0x100000 +/* + * Hide smem_start in the FBIOGET_FSCREENINFO IOCTL. This is used by modern DRM + * drivers to stop userspace from trying to share buffers behind the kernel's + * back. Instead dma-buf based buffer sharing should be used. + */ +#define FBINFO_HIDE_SMEM_START 0x200000 + struct fb_info { atomic_t count;