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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4C45C001B0 for ; Mon, 7 Aug 2023 09:40:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5E5E56B0072; Mon, 7 Aug 2023 05:40:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5948B6B0074; Mon, 7 Aug 2023 05:40:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 45BA78D0002; Mon, 7 Aug 2023 05:40:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 33B966B0072 for ; Mon, 7 Aug 2023 05:40:45 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E177E80483 for ; Mon, 7 Aug 2023 09:40:44 +0000 (UTC) X-FDA: 81096814008.21.33FE5DF Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) by imf02.hostedemail.com (Postfix) with ESMTP id 1F6A980011 for ; Mon, 7 Aug 2023 09:40:42 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=USDb3373; spf=pass (imf02.hostedemail.com: domain of linus.walleij@linaro.org designates 209.85.219.171 as permitted sender) smtp.mailfrom=linus.walleij@linaro.org; dmarc=pass (policy=none) header.from=linaro.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691401243; h=from:from:sender: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:dkim-signature; bh=Z0BIx/DwsSPZgVGJC3d5waXyUmpwnTVitNmKM5gOvHE=; b=EIl+Q9Qnyq/sSh8MCx/iwqV9WJuW+DOXHxxf3+WFrkiACIYQyKbBQapTIJbHu+1LUgNsMw u1ZTpO9nh2u3KU5W47cbiXig3kQlCzryNQvJXkKPX+c7GiNKrbjz9d8TYfqpvZXeZvW/C/ 0mvkVY3bCbG1JP+XrzpTCz8o5FTMKuU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691401243; a=rsa-sha256; cv=none; b=QCXWcfPqI5bjDjEKxERubOUFYd+YPtIZwiWenekfAIovu8csdzS4bCcnzPrIsGF7l8to1e fnu2TO8EnZoR27BtpZLF5c3x273sC0/zKQsiqvLazuChVDlJo1B2xkpKYQLthU5jtixyge PH00efRj7zglL07gXhrwl3ov/zuQSJg= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=USDb3373; spf=pass (imf02.hostedemail.com: domain of linus.walleij@linaro.org designates 209.85.219.171 as permitted sender) smtp.mailfrom=linus.walleij@linaro.org; dmarc=pass (policy=none) header.from=linaro.org Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-d18566dc0c1so4948721276.0 for ; Mon, 07 Aug 2023 02:40:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691401242; x=1692006042; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Z0BIx/DwsSPZgVGJC3d5waXyUmpwnTVitNmKM5gOvHE=; b=USDb3373iehLTf75iQhizKmSVDbZFFGRKRsJOyNXaLSF7qJFSVRrZ7OOGUAbr8hewW wAbhAITm0J3tScId7uL4BZ+5p/IPwRWHXebJqdOEpWdcnLaMpZbcOwxTreHwfT7f9vT5 Yu5z+OkPYsAHTX68z35rbi7RtTBWvhtKqjtjyeuAmWAJDrqoejtwplYKDWm1GaGfJFE3 re2hsNN6NXtOHVQKX6eTSQBQiXTmVnxbt7F1ZqOlU0/RVc/Whmc2zu5JIWD9ij8aMiBD ZikynjeXX7Mg2N08ouqti00b9pHhwmGSUnm/+052JO4lgeiuYzIRbZrmfZ3fUCxhZqPY 68cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691401242; x=1692006042; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z0BIx/DwsSPZgVGJC3d5waXyUmpwnTVitNmKM5gOvHE=; b=cZmgm3FPJ3c67KPSiBYPg+zKqOUJipq0BkJPH+ZKcdC9gvLGega+nEL1WHs6DWVZML mv1TetZ4PNRYLcjQbHVmhELuXAk3isF8l/DO4mRLIujoK0Gh27HjBzWFTBAsDT7lTtP/ MRtH2DiL+o6nfWRU9UG8U5exW6r3MaCLnOOVt+Bgl2cli8uwpywetAo6R7oGZpBCgWPb wIYFs3oQcVpPHD3Osquc/1FKHKOuA+yJM1Zs7VqqPd4vlD3R6rt2KuGHPrf8+wSwriRf WzmvW2Yj4kv3ek4MC5kcewYVr0NFEt5tfpnp6MftN3aJ8VvySqI4eA/Rbe+pM7dpgJ4C SdQg== X-Gm-Message-State: AOJu0YydMmGc3Bk0w3RX007SqKcp2v7gknjVXzRqN6xPZR4e7iQEIHug QaPGYKzxqKsaACyM+L0tM76glX+AZVNaoX9qjnuL/g== X-Google-Smtp-Source: AGHT+IFjgVVEbs75Yy6UHOvcZs/Zmb8sTBl4Zg/Gk6G3S+nGQ6xP3TrMvuSZUsuCKJDebDvYO7m7I7MdetFFTSLjqmY= X-Received: by 2002:a25:d757:0:b0:d07:23bf:2824 with SMTP id o84-20020a25d757000000b00d0723bf2824mr9006539ybg.50.1691401242129; Mon, 07 Aug 2023 02:40:42 -0700 (PDT) MIME-Version: 1.0 References: <20230728120054.12306-1-fmdefrancesco@gmail.com> In-Reply-To: <20230728120054.12306-1-fmdefrancesco@gmail.com> From: Linus Walleij Date: Mon, 7 Aug 2023 11:40:30 +0200 Message-ID: Subject: Re: [PATCH] Documentation/page_tables: Add info about MMU/TLB and Page Faults To: "Fabio M. De Francesco" Cc: Jonathan Corbet , Jonathan Cameron , Mike Rapoport , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Ira Weiny , Matthew Wilcox , Randy Dunlap Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 1F6A980011 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 1w1n19azt88f35r39dgzguy9g4swu6dc X-HE-Tag: 1691401242-408196 X-HE-Meta: U2FsdGVkX1+yzQXzo2w4XUbNPcrEbMl5ll+eIQV97zOnuWRevlXN3Dwo9UQ9fMJqYw5V5D5QgLiCI+H9oK5oLxn0PNub8vK0FniAT+ovGow9eqgQU7rrhD5SD6zdRo/UTPoKpuqYxurdCl6trkbwn94KE9UUpgyVB97vxWdQEhN47CesJSrJ2Rha+J2BlCBKbVCR4QS4nfk6esXOtcI8YOS8+ffBGESg79ncpehOoHGezxDuSucJxN7SFzosI5hKxRpGB08xo3ebWjgj/pItyVyzrPsDRnWffAPOTvwMwhdbgbJ9Ji4L2tELbFx/pBBnjWJbBuU2GkGLUs/ldAw63v4sc5tkXfqT6gWCfXMkPLYijvwM2FglnAxqvrLCXVeWCMeQ/o6hIIl5oW/11KnpwE9QAySAoyF3ddnHI2lg++ky/haFbxjibPfHxWeilA/7uWKw2Au+sPRXCgCvW5zyIbXE7JB/gMj4ivVJbzTAYpDg0QhkB4qOhdxbs8z2HgM4fh6skwu2DVbTcLSK4dqysxyv2IMuGmMvo46iwjOb2AVJwUAJSiYcz4C+wHEQjkUTsQjMQJM4ezp4Af6xgd/DYW9J1mVDZf7IOJ19wD0h1aknqOSXdLki+Lq15tAZJZSyJRpwQUkMXj7K/frNgvU3POzd58ctI6iJyDXnEfeEgCIwHx23jx8gtvhZTOCLgojWx/n+J7NSU0sExlHwIthzLcy3DxNK2ymT4BYVwSCVd1yy+mQ9iMBFanIitl/cE/C0CX5iyXqUg9TNjYlGgvbd2YGfGtvOZSNeLuEpB5B6tSJnnB7MFbG2KbkHUXL2GOS47Cx4bDqMwfnOYmQOdbOwaZQ3AyLy8n+GmkXY+Mds+nFaWHPakr3dzC+RYKKr0pgAjPqM4G8IyrkLiv6ogM/dwG2+w0nraX9ondQypZtyqeCrhv8tLItDmeCMJ5uA8f1uLmLG+uBKfPmb2LNXPAP 84ublVOy P9WNuTRPfhi3DVCQVmHwOuNvpnF4jp6GEXwxb7+qmsIcaX2cEMWisGAOQd0wN/M8XoAeYdMPRCrP2i+zM504eIz+8kWsQwrPVCbMeYmCpwar839cOoULHheIlzdZJoSZ6ipShcNIBUG0e+87CA42NBf8MIfbshMGf/kQBbBADZJreAqiEJoJ7ATyDdXBqmgi7g+9Mb48qYzQ9VQVmln5fuC4ARi9Xn5qZiISZhOO3avuBqzg2CSmsL7hjp9Qw5MkOABR8LWqxjBnz7ppC2G0+xepGeJCiKQWRxfy4chFlSU0hbuqrCFoTFz3OaLWifCPjVDYBOsvKj3Ft8ggzcMcpwh/fP/OlNW1Q8n836Q/hiHzj4nqt9ph+o1nqCbXX9kCWDe0kMhh93BYcE34casCBBqF++1s6nkGp3yWYBL+qsf4fXeSN3dVMtTGwTKp3raisku8JWh9H2/ZlfKQiXWoDK7j2jes4VVZLVACp X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi Fabio, I'm back from vacation! Overall this documentation looks good and in line with the reset in this section. On Fri, Jul 28, 2023 at 2:01=E2=80=AFPM Fabio M. De Francesco wrote: > +One cause of page faults is due to bugs (or maliciously crafted addresse= s) and > +happens when a process tries to access a range of memory that it doesn't= have > +permission to. This could be because the memory is reserved for the kern= el or > +for another process, or because the process is trying to write to a read= -only > +section of memory. When this happens, the kernel sends a Segmentation Fa= ult > +(SIGSEGV) signal to the process, which usually causes the process to ter= minate. This "segmentation fault" (SIGSEGV reads "signal segmentation violation) is actually a bit hard to understand for people not familiar with the 1970ies hardware. The Wikipedia tries to explain it but gets a bit long and confusing. https://en.wikipedia.org/wiki/Segmentation_fault The computers where the first Unix was developed (PDP machines) simply named its MMU the "memory segmentation unit" so "segmentation fault" is just a 1970ies way of saying "MMU access violation", which stuck inside Unix and thus inside Linux. Here is the explanation: https://wfjm.github.io/blogs/w11/2022-08-18-on-segments-and-pages.html The binary loader would generously use the plentyful virtual memory "segments" to split each executable into three segments when loading the bi= nary, still reflected in ELF binaries to this day: https://en.wikipedia.org/wiki/Code_segment https://en.wikipedia.org/wiki/Data_segment https://en.wikipedia.org/wiki/.bss Then the page table got special permissions set to each segment for read/wr= ite etc. Other programs and the kernel memory are also in inaccessible segments= , so accessing any of the own segments in the wrong way, or another programs segment, or an unmapped segment (virtual memory) would all result in the SIGSEGV opaque message "segmentation fault" I don't know how to reflect this in a good way in the documentation though, maybe copy/paste/edit some of my text or I can try to write something as an addit= ional patch if you prefer. Yours, Linus Walleij