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=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 51C12C4332D for ; Thu, 19 Mar 2020 09:24:53 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (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 1E43E20753 for ; Thu, 19 Mar 2020 09:24:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1E43E20753 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=vt.edu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernelnewbies-bounces+kernelnewbies=archiver.kernel.org@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.92.3) (envelope-from ) id 1jErQ4-00009L-38 for kernelnewbies@archiver.kernel.org; Thu, 19 Mar 2020 05:24:52 -0400 Received: from omr1.cc.ipv6.vt.edu ([2607:b400:92:8300:0:c6:2117:b0e] helo=omr1.cc.vt.edu) by shelob.surriel.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) (envelope-from ) id 1jErNz-0006Qb-34 for kernelnewbies@kernelnewbies.org; Thu, 19 Mar 2020 05:22:43 -0400 Received: from mr3.cc.vt.edu (mr3.cc.ipv6.vt.edu [IPv6:2607:b400:92:8500:0:7f:b804:6b0a]) by omr1.cc.vt.edu (8.14.4/8.14.4) with ESMTP id 02J9MeiZ014449 for ; Thu, 19 Mar 2020 05:22:41 -0400 Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by mr3.cc.vt.edu (8.14.7/8.14.7) with ESMTP id 02J9MZEE023119 for ; Thu, 19 Mar 2020 05:22:40 -0400 Received: by mail-qv1-f72.google.com with SMTP id ee5so2103972qvb.23 for ; Thu, 19 Mar 2020 02:22:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:in-reply-to:references :mime-version:content-transfer-encoding:date:message-id; bh=rbecGgQi4iyp4aKj3Qb5rs5ssZosYXApKR51eGjcOkU=; b=Rq/3izkgDiVq9OPpqx67l/yTqkkGSIQtYfPRj+ijjapiDVk8OFkphqciV7R475MD// 3AinDropvuIHCiY/Nv849ejyVsZw3XbFcM3M4to3TZanRWotvwIuSSAkHIujQivj6SAu ZFNq/p6RV27aN2gkVDzBvqh3pSPpZBx+DzrqpQPXWcBfvK3E9AvAhNAw2RHUpuIqiJH9 ZV4x9hJrfm/WeN7DnRjiN6b495qHTCnPS+eNFWer7R/wf172x9ilCaZDJc6OKqRlLaDf 2AtJVO7Gp/t3YyLmr8gfrdhTy3ZAbp+F/e18Cm4nzDYcyArwHYgXW/QfcPVDi9kS2ZJV CzyQ== X-Gm-Message-State: ANhLgQ0KB6rHfEAug0oj0Bzu/PyO6L69oj06+rQ3V9UFjk+xeFEbB6u7 jllr4Ni4mQuEv9PfiWk3JTLBd111+iFbY1npFZJ3HGSl40bXrASqnZk6epnlXf5D/BZ78DyQvup jyuIBgz0MQYHeTSQhxZwL2ksCAZbAxLm08mCR4C4= X-Received: by 2002:ae9:efd1:: with SMTP id d200mr1713566qkg.79.1584609755259; Thu, 19 Mar 2020 02:22:35 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs127R3TLXz4LpRdiOXYhDBwmdgnhgki/3RhUXOUU3XOGoJNawZeNxwsAJqUOmI1vE//Hy8ag== X-Received: by 2002:ae9:efd1:: with SMTP id d200mr1713551qkg.79.1584609754923; Thu, 19 Mar 2020 02:22:34 -0700 (PDT) Received: from turing-police ([2601:5c0:c001:c9e1::359]) by smtp.gmail.com with ESMTPSA id s11sm689239qke.97.2020.03.19.02.22.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2020 02:22:33 -0700 (PDT) From: "Valdis Kl=?utf-8?Q?=c4=93?=tnieks" X-Google-Original-From: "Valdis Kl=?utf-8?Q?=c4=93?=tnieks" X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7+dev To: ", Samuel" Subject: Re: process descriptor address in kernel stack In-Reply-To: References: Mime-Version: 1.0 Date: Thu, 19 Mar 2020 05:22:32 -0400 Message-ID: <22784.1584609752@turing-police> Cc: kernelnewbies@kernelnewbies.org X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============5550678708519783736==" Errors-To: kernelnewbies-bounces+kernelnewbies=archiver.kernel.org@kernelnewbies.org --===============5550678708519783736== Content-Type: multipart/signed; boundary="==_Exmh_1584609752_13116P"; micalg=pgp-sha1; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit --==_Exmh_1584609752_13116P Content-Type: text/plain; charset=us-ascii On Thu, 19 Mar 2020 16:53:32 +0800, ", Samuel" said: > movl $0xffffe000,%ecx or 0xfffff000 for 4KB stacks > andl %esp,%ecx > movl %ecx,p > > Why is *"stack pointer(esp) & 0xffffe000"* equal to the process descriptor > base address? > > That means the base address of process descriptor is always *0xXYZ...000*, > right? It is weird. It's not at all weird if the kernel, when allocating the stack space to begin with, asked for 1 (or 2 contiguous) 4K chunks of memory, at a page-aligned address.... For example, see kernel/fork.c: 238 /* 239 * Allocated stacks are cached and later reused by new threads, 240 * so memcg accounting is performed manually on assigning/releasing 241 * stacks to tasks. Drop __GFP_ACCOUNT. 242 */ 243 stack = __vmalloc_node_range(THREAD_SIZE, THREAD_ALIGN, 244 VMALLOC_START, VMALLOC_END, 245 THREADINFO_GFP & ~__GFP_ACCOUNT, 246 PAGE_KERNEL, 247 0, node, __builtin_return_address(0)); I'll leave figuring out what THREAD_ALIGN is set to, as an exercise for the student. :) --==_Exmh_1584609752_13116P Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Comment: Exmh version 2.9.0 11/07/2018 iQIVAwUBXnM52AdmEQWDXROgAQLlnA//Syu+CWLlIZb/flMRKFb4nGOCqTX04WYC Ed9Lv9TvF5HyWRm0yxoPihlclarETWm+nQnT1fIf/R8hsWjcHEJP/nSiF/6UPn7t Ljg2jSNgkAkgY2dHg7932fs4pKzf8vcHNA74AMpReLctSizXB6P0djVbUMb9hkc9 6802hRSa5HpHZmX8dEdDRvkXz2J/spX7yYirwhvB8uTGJm3l9NPljtjZ27frMYXH zQB4tOpO9SAe2Vc2WZpEq1LDvKjIGzR7io8/rBl9BsLJRmdmMx2emXequ4zNDJ/t O2i2c+rn/og6hTwpohCVUHCr16/YmiYP7W8/CnzdrP/Kue6F6t6lstVAaI2yh17X SLPcrrJAdoAoHKN2bo6UIRPAPaZC+589zM52eRFsSbxerMmioU65r8zKJG/epypH gFQNeB7NpUNQG+ty2rY2hyS4uBPIRN1Y+VUZEumiBAXNAaXn1CmZdIfj+EpQivVh RzH8WS+ghDrvrdDpK8cDgDUZy5QEKBrB6zky9aZvKyO7NVZS8iPV/xTTXuqYtOq+ p6bPueVoIDeU3DYzT75cWb5j1yGcy9nuZz69omfkV9xhSwqdVKIpKP4g2giv6lHF CDl6TC0s4CZVDmbENUsx2zk1tFwfg3IrnyYIbHZnOWr/zoJRQ16++d2pr2QhMhNt Iobh/DZ7Fkk= =07ns -----END PGP SIGNATURE----- --==_Exmh_1584609752_13116P-- --===============5550678708519783736== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies --===============5550678708519783736==--