Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3308870imj; Tue, 19 Feb 2019 00:55:19 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia7SyIldeabInFwv0eiSiggb1mUjUgBi4J7+ZDFmSQ8c/M0EmFqeEBQzOSR8bvFMNDYB2GM X-Received: by 2002:a63:28c1:: with SMTP id o184mr8762149pgo.123.1550566519354; Tue, 19 Feb 2019 00:55:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550566519; cv=none; d=google.com; s=arc-20160816; b=CrSyKpaUPRLaClc+sj+OG+V+oY3UHtLcOTULzSUEaFmPdzJQXBajYUpixmCy1kOZwv 6YDYvOuSH8wlYHDC7hZ7/h/lmA594EILfc3N9OsqMiY2/4lNcNSs7q3lIZSZvpbO7qqT HowkVIhVTRTH3qdCtkYmiwH6cgF6X2bu8ECV4RpqwrJNQZ7MQ4EEL8Qc1ENfboFEaTS+ THDhZDeUqkWYbNLnpg5Np8uh9ojca4vUbKT+inm03dmZ4z25nNSYxOcs1wxjmmRfBm+2 YityOFD/z6AQ7SNn5cBCUUcBZehkyefPId0O3go8abqJUzu30wobgZsfxdvUyL28mjgy nufg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=r6y/+ZZ4RKl/HN256vXihBFdKy8tyhh4rOwIw3W5qhs=; b=P1HM6erh45qJVzHAimVUz9V1sLNCffQM2Jzgm9p2hwvPqV5l733JXCAxgr1cTAgkpE 5fuqubkmHncWZiC3ExuGcy/G2GO3qa/EnWx1IFngGGKFyMjaNfWZMhk39tHUYU9+Zba0 HxmuprENqQKItZid1Oe9zCfX4LxSlfEc/OdO+0tUXZiww7YI5Ej1+l8T5qau2FgCbsvS fzsYgjaxQ5ATANHoDvNXki5W92aKP87czD2arTInXX7IfjdFrho31FI2hHy9/xpmILSa 5JrqH0GBFVq6DKRLoXjzzxCnFSrV7/x49pFnSLgICU3Vco27+JWFZT7ZgkI6NAn1qRHM 16VQ== ARC-Authentication-Results: i=1; mx.google.com; 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 x7si15562476pfe.257.2019.02.19.00.55.03; Tue, 19 Feb 2019 00:55:19 -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; 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 S1727839AbfBSIx3 (ORCPT + 99 others); Tue, 19 Feb 2019 03:53:29 -0500 Received: from foss.arm.com ([217.140.101.70]:41932 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727249AbfBSIx3 (ORCPT ); Tue, 19 Feb 2019 03:53:29 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7E26AEBD; Tue, 19 Feb 2019 00:53:28 -0800 (PST) Received: from [10.1.197.45] (e112298-lin.cambridge.arm.com [10.1.197.45]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7A3693F675; Tue, 19 Feb 2019 00:53:25 -0800 (PST) Subject: Re: [PATCH] sched/x86: Save [ER]FLAGS on context switch To: Linus Torvalds , "H. Peter Anvin" Cc: Peter Zijlstra , Andy Lutomirski , Will Deacon , Ingo Molnar , Linux List Kernel Mailing , "linux-alpha@vger.kernel.org" , Ingo Molnar , Catalin Marinas , James Morse , valentin.schneider@arm.com, Brian Gerst , Josh Poimboeuf , Andrew Lutomirski , Borislav Petkov , Denys Vlasenko , Thomas Gleixner References: <20190213140025.GB6346@brain-police> <20190213142524.GW32494@hirez.programming.kicks-ass.net> <20190213144145.GY32494@hirez.programming.kicks-ass.net> <20190213154532.GQ32534@hirez.programming.kicks-ass.net> <20190213222146.GC32494@hirez.programming.kicks-ass.net> <20190214101429.GD32494@hirez.programming.kicks-ass.net> <20ABBED1-E505-45F6-8520-FB93786DF9A9@zytor.com> <20190216103044.GR32494@hirez.programming.kicks-ass.net> <9e037d68-75e7-1beb-0c9c-33a7ffeced1b@zytor.com> From: Julien Thierry Message-ID: <8a3f9094-63a7-7fe2-bb4d-6deb5c022596@arm.com> Date: Tue, 19 Feb 2019 08:53:22 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/02/2019 00:24, Linus Torvalds wrote: > On Mon, Feb 18, 2019 at 2:31 PM H. Peter Anvin wrote: >> >> The question is what "fix it" means. I'm really concerned about AC escapes, >> and everyone else should be, too. > > I do think that it might be the right thing to do to add some kind of > WARN_ON_ONCE() for AC being set in various can-reschedule situations. > > We'd just have to abstract it sanely. I'm sure arm64 has the exact > same issue with PAN - maybe it saves properly, but the same "we > wouldn't want to go through the scheduler with PAN clear". > As of right now, we have the same issue on arm64 as on x86. We don't currently save the PAN bit on task switch, but I have a patch to do that. Unless we decide to go down the route of warning against uses of schedule() inside. As for the abstraction, I had this patch[1] that added another primitive for the user_access API (although this might not be suited for x86 if you also want to check DF). However, an issue that appears is where to perform the check to cover enough ground. Checking inside the schedule() code you only cover cases where things have already gone wrong, and not the use of functions that are unsafe to call inside a user_access region. [1] http://lists.infradead.org/pipermail/linux-arm-kernel/2019-January/625385.html Cheers, -- Julien Thierry