Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp587618imm; Sat, 14 Jul 2018 07:38:46 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd3imWYEMXej60Hx58reFIWHeejIHpKlgvRG5KE8xRfuy+IhGhXnTL1qLwKODjHdmXLFrN6 X-Received: by 2002:a62:1f06:: with SMTP id f6-v6mr11373777pff.140.1531579126081; Sat, 14 Jul 2018 07:38:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531579126; cv=none; d=google.com; s=arc-20160816; b=bNGa0f2WNWYmbWHwr8n5uqX1zeyj56H/bBR8vjdaeAvorIs7zlUyUo0DVNt0xv+QoT Ff5DmlbUYUfnE63KAd4m181TWp6SjiQeYGnSuS2fAXcEdmxfk5kYxOvojgIaMVydywT9 uHfuZdP8vrtpuJ4wvlhsEw1ICUeF9Q7coZAUWZKSR088po5XOmCaJTCnpAohitIk4/Sw F2TMhakVhwqpMTHby7ijUppNg+GhBhHl1sQaOBie3cDqkq2U0e1HmEHRPSxK14n6awll 6HrGegxw474MG2mYrHS3kKC7QzQlxIIKUlXCaFoWcL1ecmm100v1wXq/RHd46JJBgbdv mDcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature:arc-authentication-results; bh=LoklCVrFsx/fI1fmNdWe00DMZXR9lXDr8bXcZL95ONs=; b=xe2BRNpBgsdpEAKZoYQ/2SsRNmvMRb+bPGsMW0C47+HXSS/SiIRWylEYr2T5M3USS3 KukF7ga81F63ZpDBOZJ9KArLPGthEBDz1yNCahiMwX9pfQLEqf/rlC5+ik4rCgyCSvbq TgnK6ZJd3w6NvOjwFAFCHhOVaveZ2JtDUGxCQ9uzCV0s85mhPiA5LdppYSbfNN3rNf3t iNTmeUgFNHFsctPhIP7pQ8zuYD6aV3fpAi2rP2kkj9nYbkMOvVqYw8Mb3QKJQrV4v9Mx B/mcLTDitXXWrD7eXVrThY+yc8TxKK45nTcS0YjDqlkZaHwB/ZL6DxHTcfrgZmNyWsoT MU2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=zNCcgEiO; 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 g35-v6si22859452pgm.54.2018.07.14.07.38.30; Sat, 14 Jul 2018 07:38:46 -0700 (PDT) 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; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=zNCcgEiO; 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 S1730002AbeGNO4J (ORCPT + 99 others); Sat, 14 Jul 2018 10:56:09 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:41429 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726793AbeGNO4I (ORCPT ); Sat, 14 Jul 2018 10:56:08 -0400 Received: by mail-pg1-f196.google.com with SMTP id z8-v6so4450538pgu.8 for ; Sat, 14 Jul 2018 07:36:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=LoklCVrFsx/fI1fmNdWe00DMZXR9lXDr8bXcZL95ONs=; b=zNCcgEiOA403efYsrFYBiUqL4hX8CLcsTiGtmKNwov8EfG0xyt38MrQghmeW7p9AFH eO2jBVKE0nOvVo6WSm82EKOjDT6qC3HIb0p4zCy/1JGui4lR77wIQY1AQpzf/NgAekWa 9YaagNTjZK5tGcdX4saQ2Ji+LmRi2JHKxlsu3c6WMAhRF/gsJs82aP6u6njP//pmgazt A03NP5FO03eMDOa6787pAwxn2oqY1lhfmrmSyQ39cZK4dniwzjuFBxr8unhDrC6jbjaX f2kUp7NIp0RtQIEq8Ex/QptsCBDCHoz6pQC9hJO80h4vfiTXnbMBYWz3wr/01i+7NGYB UfLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=LoklCVrFsx/fI1fmNdWe00DMZXR9lXDr8bXcZL95ONs=; b=E3Sj7Y0PAhXDA603VdpUYysIpXzb0Grlg1xLu4StDMXq83oxTKotXwNccNf8IKfHxf PpvzsTcvzM6mHEufvCqRjcWvoWGSBYubnn+Hl8bLa4THaMcVUvL42HX2DKTKMMVJLOzA ZWB5IM8fFUos/iij7sazm0ICU9XKyYEKlEoIuOthdkBBU2mK6ARhEg6ou8bdAg6BAYeo oYy/bgJRyVzo9KXE2+nQgVdp7TqZ3yriMko8aNtOAI0KscS6DLpT79kYipQ3RbgudqS9 e8KaoTx2PNRDAAY0Nb4ixCnC4CU5OrwRj08Xwl5Hcw64v7f20KHlYxqB7KV7UqnD7l/s JbVw== X-Gm-Message-State: AOUpUlH9DnRKAbRhNDkjmd5U0tiIJVCKFIc5oo+Cru2bNNwYjyBd2gN9 NKcx0mlKLK3wTCe92F6knOlqbw== X-Received: by 2002:a63:dc17:: with SMTP id s23-v6mr9972523pgg.40.1531579011389; Sat, 14 Jul 2018 07:36:51 -0700 (PDT) Received: from ?IPv6:2600:1011:b00b:a01c:a552:f4c5:78d1:838b? ([2600:1011:b00b:a01c:a552:f4c5:78d1:838b]) by smtp.gmail.com with ESMTPSA id s12-v6sm41385652pfm.41.2018.07.14.07.36.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 14 Jul 2018 07:36:49 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: [PATCH 10/39] x86/entry/32: Handle Entry from Kernel-Mode on Entry-Stack From: Andy Lutomirski X-Mailer: iPhone Mail (15F79) In-Reply-To: <20180714080159.hqp36q7fxzb2ktlq@suse.de> Date: Sat, 14 Jul 2018 07:36:47 -0700 Cc: Andy Lutomirski , Joerg Roedel , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , X86 ML , LKML , Linux-MM , Linus Torvalds , Dave Hansen , Josh Poimboeuf , Juergen Gross , Peter Zijlstra , Borislav Petkov , Jiri Kosina , Boris Ostrovsky , Brian Gerst , David Laight , Denys Vlasenko , Eduardo Valentin , Greg KH , Will Deacon , "Liguori, Anthony" , Daniel Gruss , Hugh Dickins , Kees Cook , Andrea Arcangeli , Waiman Long , Pavel Machek , "David H . Gutteridge" Content-Transfer-Encoding: quoted-printable Message-Id: <75BDF04F-9585-438C-AE04-918FBE00A174@amacapital.net> References: <1531308586-29340-1-git-send-email-joro@8bytes.org> <1531308586-29340-11-git-send-email-joro@8bytes.org> <20180714052110.cobtew6rms23ih37@suse.de> <7AB4F269-E0E8-4290-A764-69D8605467E8@amacapital.net> <20180714080159.hqp36q7fxzb2ktlq@suse.de> To: Joerg Roedel Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Jul 14, 2018, at 1:01 AM, Joerg Roedel wrote: >=20 > On Fri, Jul 13, 2018 at 11:26:54PM -0700, Andy Lutomirski wrote: >>> So based on that, I did the above because the entry-stack is a per-cpu >>> data structure and I am not sure that we always return from the exceptio= n >>> on the same CPU where we got it. Therefore the path is called >>> PARANOID_... :) >>=20 >> But we should just be able to IRET and end up right back on the entry >> stack where we were when we got interrupted. >=20 > Yeah, but using another CPUs entry-stack is a bad idea, no? Especially > since the owning CPU might have overwritten our content there already. >=20 >> On x86_64, we *definitely* can=E2=80=99t schedule in NMI, MCE, or #DB bec= ause >> we=E2=80=99re on a percpu stack. Are you *sure* we need this patch? >=20 > I am sure we need this patch, but not 100% sure that we really can > change CPUs in this path. We are not only talking about NMI, #MC and > #DB, but also about #GP and every other exception that can happen while > writing segments registers or on iret. With this implementation we are > on the safe side for this unlikely slow-path. Oh, right, exceptions while writing segment regs. IRET is special, though. But I=E2=80=99m still unconvinced. If any code executed with IRQs enabled on= the entry stack, then that code is terminally buggy. If you=E2=80=99re exec= uting with IRQs off, you=E2=80=99re not going to get migrated. 64-bit kerne= ls run on percpu stacks all the time, and it=E2=80=99s not a problem. IRET errors are genuinely special and, if they=E2=80=99re causing a problem f= or you, we should fix them the same way we deal with them on x86_64. M >=20 > Regards, >=20 > Joerg