From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8A46C7618F for ; Mon, 22 Jul 2019 16:04:46 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9B77821901 for ; Mon, 22 Jul 2019 16:04:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="s9RqfCIf"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="KS0cpwUi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9B77821901 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hdj3b4EZL22IUeYoqjNKwWRBUbiMbr7aOrmm28sEfcY=; b=s9RqfCIfQPMccS n34maDXblWSlWL39AwyWanD30/rj6FLFIkpGc/AR85bk90mZakA3EI7NYSuOjdK0nCvZyAbk6ZAfL WywwiIAyNhABzHQlkSdNlycBGPo0UfdutzkkYdA7jRGSI5cod8yG7mgeiEGYeRh2xRxA5xnZwvHd4 BeCYB+BwmvYcn+JYiVA8p56gETft5/uCu4EUl0l/GIHLBe5oPGsfA4dfhD1oKUg6jpa4/Lf8gxhmm Nt4+HXIko86Cv8ztgNLueJtmsHTpa+a6tqEyw/B2kqo6p+6fVWxFqYeF1diFGPgrg26ZbIlX7C2uU 2w/kc2vHLLjuS/1P/qHw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hpann-00075q-9i; Mon, 22 Jul 2019 16:04:39 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hpani-00075X-FS for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2019 16:04:35 +0000 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D9B24218EA; Mon, 22 Jul 2019 16:04:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563811474; bh=7RwDDoYMSKiJXQcAvdFCkYSTfi71JkbCJnKoEX3JQbE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KS0cpwUik1/WWl0IV4JJVch4JI4XF967dMmvdgXgADmy4ekSHl8+x9ztZdOJnq1lh 42dcJaepPvoqmIR1ebI98pz0io9zRxnFJfVeA1AM91ZCPx1+DHfje7g4v+gdLvHFI7 ev3/5agSRmWuLATOZxqCH9n4gs+xIuP/epyE9rUE= Date: Mon, 22 Jul 2019 17:04:29 +0100 From: Will Deacon To: Neeraj Upadhyay Subject: Re: [PATCH v2] arm64: Force SSBS on context switch Message-ID: <20190722160429.wasox4nfl6t5jrew@willie-the-truck> References: <20190722135309.43186-1-marc.zyngier@arm.com> <8c89dbc4-50ba-6802-e582-d4fe54426261@codeaurora.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <8c89dbc4-50ba-6802-e582-d4fe54426261@codeaurora.org> User-Agent: NeoMutt/20170113 (1.7.2) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190722_090434_538702_93CD3F31 X-CRM114-Status: GOOD ( 12.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Catalin Marinas , Mark Rutland , linux-arm-kernel@lists.infradead.org, Anshuman Khandual Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jul 22, 2019 at 08:28:15PM +0530, Neeraj Upadhyay wrote: > On 7/22/19 7:23 PM, Marc Zyngier wrote: > > +static void ssbs_thread_switch(struct task_struct *next) > > +{ > > + if (likely(!(next->flags & PF_KTHREAD)) && > > + arm64_get_ssbd_state() != ARM64_SSBD_FORCE_ENABLE && > > + !test_tsk_thread_flag(next, TIF_SSBD)) { > > + struct pt_regs *regs = task_pt_regs(next); > > + > > + if (compat_user_mode(regs)) > > + set_compat_ssbs_bit(regs); > > + else if (user_mode(regs)) > > + set_ssbs_bit(regs); > > + } > > +} > > + > > /* > > * We store our current task in sp_el0, which is clobbered by userspace. Keep a > > * shadow copy so that we can restore this upon entry from userspace. > > @@ -471,6 +485,7 @@ __notrace_funcgraph struct task_struct *__switch_to(struct task_struct *prev, > > entry_task_switch(next); > > uao_thread_switch(next); > > ptrauth_thread_switch(next); > > + ssbs_thread_switch(next); > > /* > > * Complete any pending TLB or cache maintenance on this CPU in case > > Looks good to me. I inverted the logic in ssbs_thread_switch() so I could add some comments. Please double check: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/commit/?h=for-next/fixes&id=cbdf8a189a66001c36007bf0f5c975d0376c5c3a Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel