Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp2781971rwb; Mon, 7 Aug 2023 03:30:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGFCVaXaUj9Q+3Nhfc8NXqusOZQE964W59qUBcjuijfrlmlvOWU5ond6O32CulSR+W1qlLP X-Received: by 2002:aca:1314:0:b0:3a3:6e43:e681 with SMTP id e20-20020aca1314000000b003a36e43e681mr8884185oii.58.1691404255182; Mon, 07 Aug 2023 03:30:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691404255; cv=none; d=google.com; s=arc-20160816; b=d4Cgf8P3rk7DFDSbgwoLpSlmodOgdkX59MX9Gs331X3w2FsrwiEdGgWLdFjHjAWeWw IsnG6yOh2U9xBObDB+kOyyoOgfGUNSg6sSBf7KQcNeqEzG9UoKyIKMnXwaJh7bw56GKE H78GRTxVl5nEgd/MigkYjmDUTfFo/UyhgajLGEBNyJY6iXV0Dpaf2zwDFfZB/IJIL3IO Km5qNndWjNes07y1ZzbVdlcNJjWjec+EJJWV/FF4PhOJ65RtMfcfFgeX3o7PALiibFDZ 2FSec+a3IEOWVSdoWoA+4ikQqXjIXKI6pyd60zQlfkFoWFqHnOSpId4EmkHRbgczinyS UONA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Z0BIx/DwsSPZgVGJC3d5waXyUmpwnTVitNmKM5gOvHE=; fh=GgVp6j7KAnDP2IEVOIOkSaJTyK60bOjwSiCfffJDAsI=; b=sJp5gStqXuMAxH8wJL16VekmyJnsmhG+IXnU5PXv6D48e8uf3rCz9DIMDL3RnX6o2H tH7Mo89RXqagNArp0h+AfNUMg6EAG/DSgHtWDR122kLJ2X1Nl/YgEytIbTASsBzoulBv CeVBpAye6pZKaFkhCKRZZJ2G/sQLESBLhT3aS0X3gL2wrj8PNvXloiFHX3p9ODhqG337 MFys4WA0hR3LgZOp6dTfLEOd9TJriiIx4FK4r6fAZpXVIF+3o0dfUPCV+okB5tAjVQ2r njK1wLCyNBNLowkDGh78XispaFuxncqrIRwNk0qbDoSOZeA8ao6Dg3Z4HY9OMoiNbqyG aRZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=USDb3373; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i14-20020a636d0e000000b00564514df654si5339324pgc.895.2023.08.07.03.30.42; Mon, 07 Aug 2023 03:30:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=USDb3373; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229491AbjHGJkp (ORCPT + 99 others); Mon, 7 Aug 2023 05:40:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229640AbjHGJko (ORCPT ); Mon, 7 Aug 2023 05:40:44 -0400 Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com [IPv6:2607:f8b0:4864:20::b35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCCF410C1 for ; Mon, 7 Aug 2023 02:40:42 -0700 (PDT) Received: by mail-yb1-xb35.google.com with SMTP id 3f1490d57ef6-d0b597e7ac1so4918923276.1 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=fbZkEtXpwEof4oHP5/Z6+s5JB0dhbQc9KfNjxOmXmVPtyWLYD5f9YpeUL6tv6Lttbo Z8sZGh6rtqALqkmaMZHJ3Igfn01opiH++zx3nm88tk9y5nCHRHhtCq1bVoZ+6kFnZVsY hoBP6zFucIO8RVqZ0aVrLMIGoDl/6j0aANaeQWPyT0Qz66cVr9nwl+/bbmaU+3AHzNJG JxnV6VF+MdFG+FGOgcAxjrATAPYzyG+AvuIT6iIx7uF5UuzF4ZPb4WKHXRZmSUhhX7bz KHUCJGNfpeXuL/3fWu5T/G+1P80Yx1cUQhJkLMXYKYus8kbQSLZwEGczZ5/er4XElIS1 7s0w== X-Gm-Message-State: AOJu0YyQkuzuenT+S5D60LjLzTd0aNNFhXrt5gNoFuuXLENaQYc0NQr3 2eiFunZoO5T/t4lT+rtIF5C1rI6x5oAv3+3rsHL0JJXBsddRuntW3qQ= 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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