Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756442Ab3IMIcx (ORCPT ); Fri, 13 Sep 2013 04:32:53 -0400 Received: from mail-ie0-f178.google.com ([209.85.223.178]:63211 "EHLO mail-ie0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755072Ab3IMIct (ORCPT ); Fri, 13 Sep 2013 04:32:49 -0400 MIME-Version: 1.0 X-Originating-IP: [178.83.130.250] In-Reply-To: <5232CB66.6000906@vmware.com> References: <20130912150645.GZ31370@twins.programming.kicks-ass.net> <5231E18D.7070306@canonical.com> <5231EF5A.7010901@vmware.com> <52323734.4070908@canonical.com> <5232B44C.9010408@vmware.com> <5232BBE1.5030509@canonical.com> <5232C2BB.9070303@vmware.com> <5232C3E8.2050501@canonical.com> <5232CB66.6000906@vmware.com> Date: Fri, 13 Sep 2013 10:32:48 +0200 Message-ID: Subject: Re: [BUG] completely bonkers use of set_need_resched + VM_FAULT_NOPAGE From: Daniel Vetter To: Thomas Hellstrom Cc: Maarten Lankhorst , Peter Zijlstra , Dave Airlie , intel-gfx , dri-devel , Linux Kernel Mailing List , Ingo Molnar , Thomas Gleixner Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1352 Lines: 29 On Fri, Sep 13, 2013 at 10:23 AM, Thomas Hellstrom wrote: > As previously mentioned, copy_from_user should return -EFAULT, since the > VMAs are marked with VM_IO. It should not recurse into fault(), so evil > user-space looses. I haven't put a printk in the code to prove this, but gem mmap also sets VM_IO in drm_gem_mmap_obj. And we can very much hit our own fault handler and deadlock .... On a _very_ quick reading (and definitely not enough coffee yet for reading mm/* stuff) it looks like it's get_user_pages that will return an -EFAULT when hitting upon a VM_IO mapping (which makes sense since there's really no page backing it). Actually using get_user_pages was the original slowpath we've had in a few places until we've noticed that for pwrite that breaks legit userspace (the glBufferData(glMap)) use-case), so we've switched to lock dropping and proper slowpaths using copy_*_user everywhere instead of trying to pin the userspace storage with get_user_pages. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/