Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp121460imj; Wed, 13 Feb 2019 05:45:37 -0800 (PST) X-Google-Smtp-Source: AHgI3IaMlCJiO4TyvMtqigGkmqN/Q7j3X4zBLzmv+ONVJ+wE8eAJHmUYO1f8QSpw4FGAL7CVIz6m X-Received: by 2002:a62:5c41:: with SMTP id q62mr575375pfb.171.1550065536953; Wed, 13 Feb 2019 05:45:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550065536; cv=none; d=google.com; s=arc-20160816; b=VbSDHYDbA64Jv6267T0nXZh6To3NynAI/62Oc/YxnQ1a8qJr1evHg+4eWOlNxENVr2 BvspY4GDVtVILwuWp2u8bGfCa7yLE3w0Ufqve6OJQkikHbkQIZOD0EUBnw9uaJIIEX9Y 97TYREOqWmXrmEcoqODeAwoyMMJ6OJ5mjrZ+sOS3+VDnK1tOFX1Cbde923IPmmavylzH juP4Ybx5zN0ZfYj7A3+tCGRykB2iROO8i+nrKxzoOmDJ8npZKB/U0gNP35HSJJR/lm3A /Ncw/tUk8bvGqo9t4Y92RgI3foPsrGdyXTJyfMqLevmVx53M8y3j1whai+KBoeC8dIsZ mB9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=czAaUKm5d4NJqhNhwcovfXQn4SkiGplxomEQLfnJLXs=; b=b12mnFvUFfOZ4cAwYh/+GLZLJ7YtaizAt/XhHVLYuRkWroFC8UcZGs1SOH5DuWEYgM Y9FszBHzlWtlDr24kz/pR5mP+xsVlYgupCJ7nlAlEnru9KKJqnhI3OBqSsOsiiJ9t4Ai Aa1GNO8w+Nd4aJb00ki48DEgvSqZLCAEZQtXbiORXgIxUznWSqMQQ15zR0M+CY8di4gu g1+PNbDj4Xt8xE3gTnN/WGvlz4Z6Xsvc6OsVpm/YzUo5HsAM+RmWNGg++212PS3pQQog aSsk8Yinrs8NHd6gtwr3XfZaMCEOklvW7LJq/BqUTiPnMdkPxaRny8kD+nBom6cF1uFY c5bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=jHJJNhfC; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a20si2137452pgk.581.2019.02.13.05.45.20; Wed, 13 Feb 2019 05:45:36 -0800 (PST) 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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=jHJJNhfC; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391463AbfBMKgA (ORCPT + 99 others); Wed, 13 Feb 2019 05:36:00 -0500 Received: from merlin.infradead.org ([205.233.59.134]:40974 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729719AbfBMKgA (ORCPT ); Wed, 13 Feb 2019 05:36:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=czAaUKm5d4NJqhNhwcovfXQn4SkiGplxomEQLfnJLXs=; b=jHJJNhfC68k0s+g824T+ojFF/ RyG1NGZLpeUAjfrd263UZFzBTLsa4GHWlBlybEx3lJM57Pa6fjTTkGYIdeTFFFVSwEYk4BgQnXT20 4gysr+4A+RjR11ZuH1FUUCUv2N1IPKAdHl6EYJqHZ9NvLgmsgWYGGx2hxwiHFCnruSA7AVyDYkqnp sQRJB2CY3CHasCgDslp3BlsywX/tGVTnlfey9HIqHE4EFJ73nbpLMPTI07UAVXQccISuZTaKoJH8+ vnbszb+VGF23wKB/ljdjBoJVyTpC8PCQTkJWQ3oVG0UZUQ1Zj2mT+xyoVJ/kmy22KA0NN/8A0Zrnz iFM9IkVYA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtrtT-0005FS-MI; Wed, 13 Feb 2019 10:35:55 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 06ACE20D0C1E6; Wed, 13 Feb 2019 11:35:54 +0100 (CET) Date: Wed, 13 Feb 2019 11:35:53 +0100 From: Peter Zijlstra To: Julien Thierry Cc: Ingo Molnar , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, mingo@redhat.com, catalin.marinas@arm.com, will.deacon@arm.com, james.morse@arm.com, hpa@zytor.com, valentin.schneider@arm.com Subject: Re: [PATCH v3 3/4] uaccess: Check no rescheduling function is called in unsafe region Message-ID: <20190213103553.GO32494@hirez.programming.kicks-ass.net> References: <1547560709-56207-1-git-send-email-julien.thierry@arm.com> <1547560709-56207-4-git-send-email-julien.thierry@arm.com> <20190211134527.GA121589@gmail.com> <20190211135159.GC32511@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 12, 2019 at 09:15:13AM +0000, Julien Thierry wrote: > >>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c > >>> index a674c7db..b1bb7e9 100644 > >>> --- a/kernel/sched/core.c > >>> +++ b/kernel/sched/core.c > >>> @@ -3289,6 +3289,14 @@ static inline void schedule_debug(struct task_struct *prev) > >>> __schedule_bug(prev); > >>> preempt_count_set(PREEMPT_DISABLED); > >>> } > >>> + > >>> + if (IS_ENABLED(CONFIG_DEBUG_UACCESS_SLEEP) && > >>> + unlikely(unsafe_user_region_active())) { > >>> + printk(KERN_ERR "BUG: scheduling while user_access enabled: %s/%d/0x%08x\n", > >>> + prev->comm, prev->pid, preempt_count()); > >>> + dump_stack(); > >>> + } > >>> + > >>> rcu_sleep_check(); > >>> > >>> profile_hit(SCHED_PROFILING, __builtin_return_address(0)); > I guess I'll drop the might_resched() part of this patch if that sounds > alright. I'm still confused by the schedule_debug() part. How is that not broken?