Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1484746pxa; Thu, 6 Aug 2020 08:37:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0lxT/LtwpuJ1rHPVlx9CnFY46PfHv1SF/bXK0pP3IkNe+0sr5jnHZ2V7gQn13ofJTHQ23 X-Received: by 2002:a05:6402:206d:: with SMTP id bd13mr4671169edb.57.1596728235856; Thu, 06 Aug 2020 08:37:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596728235; cv=none; d=google.com; s=arc-20160816; b=XPt3X22ZMX7wOqXAUMnAaVAnzUte3MynlCs4QeBsnuRgDrgsWBJf1d5ceLeTBf+Fsy mpTDd8rGA8h9DEwofPDqni4EXIr0ikZdFTbVvdG84z+d9uetfZRotk2gzK1DzQNuPC/r JJD8TvfAmeAHzchMJ0rNrAz3KSJ7Xoyaca/7vW7ic+/X38q2pFVw2Jkk+F/I/t9m3mgW LYeiKmLcWPry1ZbHfduxoRhHDZnyQjzmZUQAG+k3DHjF03YguARAd38ZN7JdgDl1Iviu XealYC236LXNHg/Jz6ro62nXVnji1AY8g6Ux4PhAbQlbUI7mYRAtgtOHXinu1ohJWHnL 9/WQ== 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:mime-version :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=TAjJwS8vlxBW7QvhvZsI4TIjVO26d8rrgTrwu4jH/ds=; b=McotXb4udx0mNS6cML38lbwU89FpfJTB45pRxzPbGfFbpNLdIYQ8ys1XL+l+4Bwalk Q/vB1c0r4ktRD2L1LvAWrXiGvkS5HZO2aRINL8ONGyGd4JjNKouXZIMK3gB9iMDMRIjl us183MSJArqUVNsIw0hXQxPrG3sannyHlpjoJIcvGQPqn4cou6W2T/3Tkc5/e3wdg5jW SAOD2X/B059jSkgYv+WcO6NTj//e53zLdhreVoATFZmD2IAzrc82G9BrHIac3AVnYacn /gns8dOzAnahVEcv1Wcik7ZFXhTRAJn1xdmaeuaJMdNR09FwnFdLcrHKeEPxlNM4ma2o LQlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=ML510IxL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v8si4158077edl.307.2020.08.06.08.36.50; Thu, 06 Aug 2020 08:37:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=ML510IxL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729310AbgHFPMC (ORCPT + 99 others); Thu, 6 Aug 2020 11:12:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726901AbgHFOUR (ORCPT ); Thu, 6 Aug 2020 10:20:17 -0400 Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 819F2C03460C for ; Thu, 6 Aug 2020 05:38:40 -0700 (PDT) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4BMnvf1j5rz9sPC; Thu, 6 Aug 2020 22:33:02 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1596717182; bh=TAjJwS8vlxBW7QvhvZsI4TIjVO26d8rrgTrwu4jH/ds=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ML510IxLqcGl6DYF2mWi34tO+E9wo6FolIaLFXJKWEepZqHA2W9oTRIQ/Vd/1Mpor /AOuCO+aNnjrvWlqn8S+y+AXFfRNlFnsgCsoA0At/9ubLlDq+Kf5I1Yo23yIzVcXON rXmGnrxfpM/hJdzSDXbzTme+c3Ut4g140pPbS2P7FIpM2Shd2pRZUDlW5OT3+Kv2FM +6d73MFgNQk0PHxPQ+cXPEU2egHsRlhMoxVDV4wH3QYD9psG9fS0iqqb86GWkbqbj1 p3v3vF0hr0gsbbJ/39rvIkgIILwMPPrYo1xFigCsIbVwOQcEROUtT85rLq8FJ6Lqua MhSa82/pb2sng== From: Michael Ellerman To: Christophe Leroy , Christophe Leroy , Benjamin Herrenschmidt , Paul Mackerras Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v2] powerpc/uaccess: simplify the get_fs() set_fs() logic In-Reply-To: <2d0b777d-f1aa-08a1-f287-47ac68efbd99@csgroup.eu> References: <87mu3nyh3w.fsf@mpe.ellerman.id.au> <2d0b777d-f1aa-08a1-f287-47ac68efbd99@csgroup.eu> Date: Thu, 06 Aug 2020 22:33:01 +1000 Message-ID: <87a6z8ymwy.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Christophe Leroy writes: > Le 25/07/2020 =C3=A0 13:22, Michael Ellerman a =C3=A9crit=C2=A0: >> Hi Christophe, >>=20 >> Unfortunately this would collide messily with "uaccess: remove >> segment_eq" in linux-next, so I'll ask you to do a respin based on that, >> some comments below. > > Done, sent as v3, together with the 2 patchs from Linux next to get it=20 > build and boot. Thanks. >> Christophe Leroy writes: >>> On powerpc, we only have USER_DS and KERNEL_DS >>> >>> Today, this is managed as an 'unsigned long' data space limit >>> which is used to compare the passed address with, plus a bit >>> in the thread_info flags that is set whenever modifying the limit >>> to enable the verification in addr_limit_user_check() >>> >>> The limit is either the last address of user space when USER_DS is >>> set, and the last address of address space when KERNEL_DS is set. >>> In both cases, the limit is a compiletime constant. >>> >>> get_fs() returns the limit, which is part of thread_info struct >>> set_fs() updates the limit then set the TI_FSCHECK flag. >>> addr_limit_user_check() check the flag, and if it is set it checks >>> the limit is the user limit, then unsets the TI_FSCHECK flag. >>> >>> In addition, when the flag is set the syscall exit work is involved. >>> This exit work is heavy compared to normal syscall exit as it goes >>> through normal exception exit instead of the fast syscall exit. >>> >>> Rename this TI_FSCHECK flag to TIF_KERNEL_DS flag which tells whether >>> KERNEL_DS or USER_DS is set. Get mm_segment_t be redifined as a bool >>> struct that is either false (for USER_DS) or true (for KERNEL_DS). >>> When TIF_KERNEL_DS is set, the limit is ~0UL. Otherwise it is >>> TASK_SIZE_USER (resp TASK_SIZE_USER64 on PPC64). When KERNEL_DS is >>> set, there is no range to check. Define TI_FSCHECK as an alias to >>> TIF_KERNEL_DS. >>=20 >> I'd rather avoid the "DS" name any more than we have to. Maybe it means >> "data space" but that's not a very common term. > > I thought it was a reference to the ds/fs/gs ... segment registers in=20 > the 8086 ? Yes. In your changelog you used "data space limit", so I thought you were trying to retrospectively redefine the "DS" acronym to mean that. cheers