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=-4.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 149A7C433DF for ; Mon, 20 Jul 2020 06:50:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DFA142065F for ; Mon, 20 Jul 2020 06:50:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="I8NrnAiD"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="JmW05mx6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726855AbgGTGuH (ORCPT ); Mon, 20 Jul 2020 02:50:07 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:55554 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725815AbgGTGuG (ORCPT ); Mon, 20 Jul 2020 02:50:06 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1595227804; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t/qYtaXCKWFcQ++IUuI+8VoH3i4cW6b42fWT4jOgYmA=; b=I8NrnAiDCGeIzMpOK6d/529QMrR7yLW1IOA3Bpek9vOOlA2k5NqKlqZcIMaf1j/rYd9B7i /DxmDZ2C+Nbdvj9u/8Qq3lQkvHe7gnEEHyii2lHAY76prCZMPmkADNulos5ebbC43Ao3am rHmpG/LtLwFFz6wZNAje4k4SNHTbAse2Bj6ythgYRHMm7QQOFZBPAkCkMmHxEf8EY8WIAI 22SrH2ZbgY/tfUZBgBPJL3Z5uWN3pIJERqp9XBjuGrTnUURQpM/OrFaI5f9eYE449INOef KsVHSDgfX0QAsNfyXOx5l6L5To5hWalfvr/+390Tjjf8wf1NakStsO0UXQNyPQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1595227804; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t/qYtaXCKWFcQ++IUuI+8VoH3i4cW6b42fWT4jOgYmA=; b=JmW05mx6NDlANlEtUmk8WumFr8XSkHzEyeysCjvJt7mjlaCLUU8+tb2WwbeVWfpUHTjnBy IV0x3wGCbxgNtKBA== To: Andy Lutomirski Cc: Andy Lutomirski , Kees Cook , LKML , X86 ML , linux-arch , Will Deacon , Arnd Bergmann , Mark Rutland , Keno Fischer , Paolo Bonzini , kvm list , Gabriel Krisman Bertazi Subject: Re: [patch V3 01/13] entry: Provide generic syscall entry functionality In-Reply-To: References: <87v9ijollo.fsf@nanos.tec.linutronix.de> Date: Mon, 20 Jul 2020 08:50:02 +0200 Message-ID: <87a6zuof39.fsf@nanos.tec.linutronix.de> 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 Andy Lutomirski writes: >> On Jul 19, 2020, at 3:17 AM, Thomas Gleixner wrote: >>=20 >> =EF=BB=BFAndy Lutomirski writes: >>>> On Sat, Jul 18, 2020 at 7:16 AM Thomas Gleixner w= rote: >>>> Andy Lutomirski writes: >>>>> FWIW, TIF_USER_RETURN_NOTIFY is a bit of an odd duck: it's an >>>>> entry/exit word *and* a context switch word. The latter is because >>>>> it's logically a per-cpu flag, not a per-task flag, and the context >>>>> switch code moves it around so it's always set on the running task. >>>>=20 >>>> Gah, I missed the context switch thing of that. That stuff is hideous. >>>=20 >>> It's also delightful because anything that screws up that dance (such >>> as failure to do the exit-to-usermode path exactly right) likely >>> results in an insta-root-hole. If we fail to run user return >>> notifiers, we can run user code with incorrect syscall MSRs, etc. >>=20 >> Looking at it deeper, having that thing in the loop is a pointless >> exercise. This really wants to be done _after_ the loop. >>=20 > As long as we=E2=80=99re confident that nothing after the loop can set th= e flag again. Yes, because that's the direct way off to user space. Thanks, tglx