Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1006666pxu; Wed, 2 Dec 2020 08:45:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJwhQW+t/Kg4Y01v6GqO3gHE6hMIVzeU5X/84VGQAyc6dEaueMLV2jTQRdmYqcVu+X1UoKex X-Received: by 2002:a50:ee97:: with SMTP id f23mr727556edr.311.1606927535994; Wed, 02 Dec 2020 08:45:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606927535; cv=none; d=google.com; s=arc-20160816; b=R1LVa/XWXNSlhIVlQZWlZwU4tnmX+ViUGkyWJUGIDZJHfQkdCtfXz+dc1/2pPALSW7 tSSsqjKYq3A8LLf3R3sTWfoEAd4xzCeBAGsPBaj0l1AJ3jIJiC3tsH4j2n1R3Gm0wKiX zNl1Q/kFVBhpkT+xUA4tkH6qqrQ2xZDMzdbg+e2iDAnCgdQ4j/d+8A0bt3DLhLSMLPzQ sP9CCt5Rhyb/OqGx8HsWMcGZpcgQdpP6siwqdmBJZRGC6UqJNC6GFicXlWgqojN475qo wDLO1MJcseUR3OT2CiQYL8RV62B1JeRCkIeRsxcPJ0XUZyLMhRoNvx1ElPgpfAkfh+o0 tPmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=SzqeiB3OLdnGMRySIBky7MAg7jd2kPeLXTQpLFS8lAc=; b=dZWFQt1+toK9wPc2/wsVrjVZFU6bTGGtMtCtUgSKYsZQeEiwetwxnJ04if7mHQoVNP FuGKsQdtrOkxnXt/zFLSVN4M/1eL6jFNHHCWp5EXusdbo3o/JW75NY0hnLtOMHHt7yK6 bmf9zaWjp0IaJFE9aHLh2V0nT+UFHJt4HCtcYlxkjgbOGhZjOI+3dpP06OAhTXFIvVWX CB5Sw4Gboe7yMOFvvJf6UUBtWRZPhO88teJamjUo+9sJmjA3T6uvFgE5Q7oEbd+2oW49 3W9GlP7yrgDkbjpNAdhOTP3mgeXpGjGGbI2sSm1nycTFMN6ismdzOumFUqyd6W5Y2fR/ cbTA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v16si305506eja.188.2020.12.02.08.45.12; Wed, 02 Dec 2020 08:45:35 -0800 (PST) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388140AbgLBNxH (ORCPT + 99 others); Wed, 2 Dec 2020 08:53:07 -0500 Received: from foss.arm.com ([217.140.110.172]:40150 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727761AbgLBNxH (ORCPT ); Wed, 2 Dec 2020 08:53:07 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 191E230E; Wed, 2 Dec 2020 05:52:21 -0800 (PST) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.194.78]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DB2393F718; Wed, 2 Dec 2020 05:52:18 -0800 (PST) Date: Wed, 2 Dec 2020 13:52:16 +0000 From: Qais Yousef To: Will Deacon Cc: linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Catalin Marinas , Marc Zyngier , Greg Kroah-Hartman , Peter Zijlstra , Morten Rasmussen , Suren Baghdasaryan , Quentin Perret , Tejun Heo , Li Zefan , Johannes Weiner , Ingo Molnar , Juri Lelli , Vincent Guittot , kernel-team@android.com Subject: Re: [PATCH v4 04/14] arm64: Kill 32-bit applications scheduled on 64-bit-only CPUs Message-ID: <20201202135216.7jilpcvocnqqp5aj@e107158-lin.cambridge.arm.com> References: <20201124155039.13804-1-will@kernel.org> <20201124155039.13804-5-will@kernel.org> <20201127131217.skekrybqjdidm5ki@e107158-lin.cambridge.arm.com> <20201201165633.GC27783@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20201201165633.GC27783@willie-the-truck> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/01/20 16:56, Will Deacon wrote: > On Fri, Nov 27, 2020 at 01:12:17PM +0000, Qais Yousef wrote: > > On 11/24/20 15:50, Will Deacon wrote: > > > Scheduling a 32-bit application on a 64-bit-only CPU is a bad idea. > > > > > > Ensure that 32-bit applications always take the slow-path when returning > > > to userspace on a system with mismatched support at EL0, so that we can > > > avoid trying to run on a 64-bit-only CPU and force a SIGKILL instead. > > > > > > Signed-off-by: Will Deacon > > > --- > > > > nit: We drop this patch at the end. Can't we avoid it altogether instead? > > I did it like this so that the last patch can be reverted for > testing/debugging, but also because I think it helps the structure of the > series. Cool. I had a comment about the barrier(), you were worried about cpu_affinity_invalid() being inlined by the compiler and then things get mangled such that TIF_NOTIFY_RESUME clearing is moved after the call as you described? Can the compiler move things if cpu_affinity_invalid() is a proper function call (not inlined)? > > > > diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c > > > index a8184cad8890..bcb6ca2d9a7c 100644 > > > --- a/arch/arm64/kernel/signal.c > > > +++ b/arch/arm64/kernel/signal.c > > > @@ -911,6 +911,19 @@ static void do_signal(struct pt_regs *regs) > > > restore_saved_sigmask(); > > > } > > > > > > +static bool cpu_affinity_invalid(struct pt_regs *regs) > > > +{ > > > + if (!compat_user_mode(regs)) > > > + return false; > > > > Silly question. Is there an advantage of using compat_user_mode() vs > > is_compat_task()? I see the latter used in the file although struct pt_regs > > *regs is passed to the functions calling it. > > > > Nothing's wrong with it, just curious. > > Not sure about advantages, but is_compat_task() is available in core code, > whereas compat_user_mode() is specific to arm64. The former implicitly > operates on 'current' and just checks thread flag, whereas the latter > actually goes and looks at mode field of the spsr to see what we're > going to be returning into. Okay, so just 2 different ways to do the same thing and you happened to pick the one that first came to mind. Thanks -- Qais Yousef