Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp693740pxb; Thu, 19 Nov 2020 11:20:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJxnTjHTbES4xEkpYZZLKJSEwQbXiE+iO5deaic5BsS+u9giRsMli8JICbAQ2Rr3SiF86HBH X-Received: by 2002:a05:6402:8d5:: with SMTP id d21mr2252838edz.11.1605813635785; Thu, 19 Nov 2020 11:20:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605813635; cv=none; d=google.com; s=arc-20160816; b=fzsU0n+CUmC4KH8jkBBiNvyFZATw6ms20xoqHmFzZUxIRf3UuRBpNR2tx5PLFWNlTb AOuPm/QyP3oFgA/WGMJPyovT2oFGFrbObOBoLQa69tUgepGLCF3PTB5ShQ4lb6dUXfbX L5nqjBE8oUrrko1Cu+6QkU8NQk791kGRGgNmy+zosnxRqhkUP9oJRiX/5ebQ/xzNu2+r rXlNoz0FUGc5geudhvZoFj3R2N4sRldB/knshwkwDSbZFL57PZ0DwDVkIs9D5RQ/NGMJ /8OF4JFmyRwgd5vYLn9UOsKoyk2dZPjSHeoXocdff4x59QiOIRa8CcvRAZPXv54R9Dto 0u9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=00LmCFiCkBZbXLGMYseLaPYtcySGGBCwlb2kLV7GY1I=; b=YRKB7aV9V/6XebcCsNaycwVsiMNVyZcRmy/yH6wCIfS60aXLr6083gTrheNj2gn3EH Tnydne+XsvG/oDE+TiDqMQPsiJmUyCaPHqU5C5gyJX8LlPnEIi3V5KCjKej7TfRooysL +sRy68huR9QcWpRT2zM/lGnYoXCuo6nVgERudL5Divw0bhboWZK1/APOe1B3ErHoU9HU b1NlOXtM5ETR5wRKgq87SsQJu+6dy8uC1GHntElfmqpWdpgYV07npgrPKWgwvkKSqigd oi6s/9SWvkFFdSG6TAimb5hoIPJ/0JVc+lsBB1spdRm5HhuLgrcdlw2NsoN5DwRPJh/l Viqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=jAVD3Okv; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=+uewI+pz; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f10si365916edx.567.2020.11.19.11.20.12; Thu, 19 Nov 2020 11:20: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; dkim=pass header.i=@linutronix.de header.s=2020 header.b=jAVD3Okv; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=+uewI+pz; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728050AbgKSTP5 (ORCPT + 99 others); Thu, 19 Nov 2020 14:15:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728021AbgKSTP4 (ORCPT ); Thu, 19 Nov 2020 14:15:56 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1C99C0613CF for ; Thu, 19 Nov 2020 11:15:56 -0800 (PST) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1605813355; 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: in-reply-to:in-reply-to:references:references; bh=00LmCFiCkBZbXLGMYseLaPYtcySGGBCwlb2kLV7GY1I=; b=jAVD3OkvzqvxyRLv4106msrFRJ6SYfVkSZUMfijm+1WcKcCOEo3W3KhGt1QGdDb3CX1LbH vehhiYsUrADO4baFifdSHPYTpDZWqDswAj36agg1V3IJ2hpz8+IuU7tkW1nBcotFTXGhJe 8RbpihVMVyh3B4+QSP0oCZqZZa8V9YuYrA/RwsmUjOspfQ+NgU/KyLllP/re2fGeLAWm8C h8qBNqqa4tA8zNdjnEcPCOufVBWECRMdmwY6QumUJ98pO9MA6MmmW//rpr7Sf9loRn06Md 9Aw8rq+KXwoJtVid/FOQOOnicBnBYJuSvS5kX7iibYfoer0HvaTiKsWl3R94wQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1605813355; 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: in-reply-to:in-reply-to:references:references; bh=00LmCFiCkBZbXLGMYseLaPYtcySGGBCwlb2kLV7GY1I=; b=+uewI+pz8Igij7JLcjUM5y/o1+0t4ajNpE2N6gXlpSlAO4YXPf9yziRpmKRM5KaDtWckg4 UQaefyqPvgRf2FCw== To: Alexandre Chartre , Andy Lutomirski Cc: Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , X86 ML , Dave Hansen , Peter Zijlstra , LKML , Tom Lendacky , Joerg Roedel , Konrad Rzeszutek Wilk , jan.setjeeilers@oracle.com, Junaid Shahid , oweisse@google.com, Mike Rapoport , Alexander Graf , mgross@linux.intel.com, kuzuno@gmail.com Subject: Re: [RFC][PATCH v2 11/21] x86/pti: Extend PTI user mappings In-Reply-To: References: <20201116144757.1920077-1-alexandre.chartre@oracle.com> <20201116144757.1920077-12-alexandre.chartre@oracle.com> <820278dc-5f8e-6224-71b4-7c61819f68d1@oracle.com> Date: Thu, 19 Nov 2020 20:15:54 +0100 Message-ID: <87d009p385.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 17 2020 at 09:42, Alexandre Chartre wrote: > On 11/17/20 12:06 AM, Andy Lutomirski wrote: > The PTI stack does have guard pages because it maps only a part of the task > stack into the user page-table, so pages around the PTI stack are not mapped > into the user-pagetable (the page below is the task stack guard, and the page > above is part of the kernel-only stack so it's never mapped into the user > page-table). > > + * +-------------+ > + * | | ^ ^ > + * | kernel-only | | KERNEL_STACK_SIZE | > + * | stack | | | > + * | | V | > + * +-------------+ <- top of kernel stack | THREAD_SIZE > + * | | ^ | > + * | kernel and | | KERNEL_STACK_SIZE | > + * | PTI stack | | | > + * | | V v > + * +-------------+ <- top of stack Well, the PTI stack might have guard pages, but the kernel stack can now underflow into the PTI stack. Not good. Thanks, tglx