Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3202293imm; Tue, 17 Jul 2018 00:18:21 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcFD9Gw9iAH1FvFAsLbTxTONgdWqeTVnOnhm47jHWoi4Y9scXAEqUlwzv3JRvCyWpxG7p96 X-Received: by 2002:a63:5025:: with SMTP id e37-v6mr448887pgb.341.1531811901228; Tue, 17 Jul 2018 00:18:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531811901; cv=none; d=google.com; s=arc-20160816; b=UHimAVWfrudiyz9xAGOIVLTa1SRr0bPBtTMqe0qU6gqSaijdhJDUKmgCO8+wMHr3u5 uRMoTw4oym00qkDKzZ6aFVfju8hX7c9LC9p0Dy8/4xs/MdWNWcRor4E95RxqnpY+UmMo HJ0mi++8pKU7gF0uoUevXCdHBzBdVwnD00SZfGvb6UDHZo2cRR4MqzwbwHHzCiHiUNL/ iOoXp8OPwTF/x1LglWWjuiVGsYoGBsxyB9AdhbwYUmRS7Dc8JRjaI2oBTBtkYH24wayw 5BHTQz/4OLZKPPJmdGPKglgQc8eSQBMtYybWWsVHqMnMmKWSBFuBN1zLQdM9hLGDonBd vGHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=COAxYPxAY3FjvUa///a1HdmwbG/7g+uNvuhrxKL1Y0k=; b=Qwdt0G04NXua3Rn0pFpkAIQhFVmPt9qadlD6z2r+etKUAA+KJPaGZrIQNFjgSJUzQx svjDsrcFMJzhm+zlYezVdeGsSbf44iyj+OaNtniI2pj4Kpyh92lqkkMlrSlmMW81BBRj cNoVPjih32EgbJzA5qK/2gJZGs4dtxLEgC5L15gApBDuMLunhZDQIw0Ea1ww7n9kMtoP KxhZ3m1dtV+LBn9rc2BH1A2lF7zIXJXZf5y4tDaLiVOF7L5sEl+7O5magw6LaU2v646u MdnNNoQYeOrnNBQ1v6yu/u7e9ATYfk/QyUYTNwQAhqOi2Ky2IdS9kwmVMQ6MRlpCTu81 jAiA== ARC-Authentication-Results: i=1; mx.google.com; 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 v1-v6si144162pgf.515.2018.07.17.00.17.43; Tue, 17 Jul 2018 00:18:21 -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; 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 S1728475AbeGQHq6 (ORCPT + 99 others); Tue, 17 Jul 2018 03:46:58 -0400 Received: from mx2.suse.de ([195.135.220.15]:51552 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727600AbeGQHq6 (ORCPT ); Tue, 17 Jul 2018 03:46:58 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id C162AAEB1; Tue, 17 Jul 2018 07:15:46 +0000 (UTC) Date: Tue, 17 Jul 2018 09:15:45 +0200 From: Joerg Roedel To: Andy Lutomirski 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" Subject: Re: [PATCH 10/39] x86/entry/32: Handle Entry from Kernel-Mode on Entry-Stack Message-ID: <20180717071545.ojdall7tatbjtfai@suse.de> 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> <75BDF04F-9585-438C-AE04-918FBE00A174@amacapital.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <75BDF04F-9585-438C-AE04-918FBE00A174@amacapital.net> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 14, 2018 at 07:36:47AM -0700, Andy Lutomirski wrote: > But I’m still unconvinced. If any code executed with IRQs enabled on > the entry stack, then that code is terminally buggy. If you’re > executing with IRQs off, you’re not going to get migrated. 64-bit > kernels run on percpu stacks all the time, and it’s not a problem. The code switches to the kernel-stack and kernel-cr3 and just remembers where it came from (to handle the entry-from-kernel with entry-stack and/or user-cr3 case). IRQs are disabled in the entry-code path. But ultimately it calls into C code to handle the exception. And there IRQs might get enabled again. > IRET errors are genuinely special and, if they’re causing a problem > for you, we should fix them the same way we deal with them on x86_64. Right, IRET is handled differently and doesn't need this patch. But the segment-writing exceptions do. If you insist on it I can try to implement the assumption that we don't get preempted in this code-path. That will safe us some cycles for copying stack contents in this unlikely slow-path. But we definitly need to handle the entry-from-kernel with entry-stack and/or user-cr3 case correctly and make a switch to kernel-stack/cr3 because we are going to call into C-code. Regards, Joerg