From patchwork Wed Aug 22 08:54:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10572755 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 B9EA714E1 for ; Wed, 22 Aug 2018 08:54:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AFE682B018 for ; Wed, 22 Aug 2018 08:54:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A42A32B03D; Wed, 22 Aug 2018 08:54:30 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 410D62B017 for ; Wed, 22 Aug 2018 08:54:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BF9B96E1AC; Wed, 22 Aug 2018 08:54:21 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2BE1389C85 for ; Wed, 22 Aug 2018 08:54:19 +0000 (UTC) Received: by mail-ed1-x542.google.com with SMTP id o8-v6so878996edt.13 for ; Wed, 22 Aug 2018 01:54:19 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=tC3XOATppghwn4IS9OYXqFuyuqFooxnRd+35pFM+rQQ=; b=lGgWSAM3Ui4TOB6fpzal2beNf28Q7ov2iuv0qUOJgOzKrIQVouhDGuWTOZuQL9I/gC aErR7RbnoFUUHSsl32ABzE0+ZmUdpPCSaYPk5cs26n0YVSWqCKqzQjnofF1tg1xpJKNc yOm50z3rtirJA5LCoNgjwUFEcNbBs32WoW9QFkx5l/lo/YCj2wpz+s6paDBBIZgKFvd9 4f75qCJgPKgFa83raFgOZAQU+OqXA6NUD4jt1ie7zZZ6m1F0F2M7UKYkVukLp8PTLeTH jUU+x/2PBN9v0LF+32PZ7NaCQvs5aRTUc381jPEynGoeAeAhKr2s0vnzdPp73BV+ky8y OFyA== X-Gm-Message-State: AOUpUlFDI7KjFaAOiWokj/WEAG92nhf7uvoDeglWhdNKlwFK0x8PvFP/ NwIKeUcsC0sRWcKygw0SYp2JSg== X-Google-Smtp-Source: ANB0VdZtJDRr3KCy9Hh9eaXTQ855MGDwccZsNLNRCm4dpFO+HWCN5ZGHfwDgeqMt7aLdjFqMeOZ2kQ== X-Received: by 2002:a50:aca3:: with SMTP id x32-v6mr16646537edc.41.1534928057769; Wed, 22 Aug 2018 01:54:17 -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.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Aug 2018 01:54:16 -0700 (PDT) From: Daniel Vetter To: DRI Development Date: Wed, 22 Aug 2018 10:54:05 +0200 Message-Id: <20180822085405.10787-4-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> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 4/4] drm/fb: Stop leaking physical address X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Daniel Vetter , Intel Graphics Development , LKML , =?utf-8?q?Noralf_Tr=C3=B8nnes?= , John Stultz , Daniel Vetter Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP For buffer sharing, use dma-buf instead. We can't set smem_start to 0 unconditionally since that's used by the fbdev mmap default implementation. And we have plenty of userspace which would like to keep that working. This might break legit userspace - if it does we need to look at a case-by-cases basis how to handle that. Worst case I expect overrides for only specific drivers, since anything remotely modern should be using dma-buf/prime now (which is about 7 years old now for DRM drivers). This issue was uncovered because Noralf's rework to implement a generic fb_probe also implements it's own fb_mmap callback. Which means smem_start didn't have to be set anymore, which blew up some blob in userspace rather badly. Cc: Gustavo Padovan Cc: Maarten Lankhorst Cc: Sean Paul Cc: David Airlie Cc: John Stultz Cc: Noralf Trønnes Signed-off-by: Daniel Vetter Acked-by: Sean Paul --- drivers/gpu/drm/drm_fb_helper.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 4b0dd20bccb8..bcb78693c4f7 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -2673,6 +2673,8 @@ __drm_fb_helper_initial_config_and_unlock(struct drm_fb_helper *fb_helper, info = fb_helper->fbdev; info->var.pixclock = 0; + /* don't leak any physical addresses to userspace */ + info->flags |= FBINFO_HIDE_SMEM_START; /* Need to drop locks to avoid recursive deadlock in * register_framebuffer. This is ok because the only thing left to do is