From: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Jonathan Corbet <corbet@lwn.net>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Mike Rapoport <rppt@kernel.org>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
Ira Weiny <ira.weiny@intel.com>,
Matthew Wilcox <willy@infradead.org>,
Randy Dunlap <rdunlap@infradead.org>
Subject: Re: [PATCH] Documentation/page_tables: Add info about MMU/TLB and Page Faults
Date: Wed, 09 Aug 2023 15:27:53 +0200 [thread overview]
Message-ID: <2443562.jE0xQCEvom@suse> (raw)
In-Reply-To: <CACRpkdYcAWDZV0GkdP6gEJv971wjYQ-8WweHkreTJ-w7sfKKQg@mail.gmail.com>
On lunedì 7 agosto 2023 11:40:30 CEST Linus Walleij wrote:
> 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 PM Fabio M. De Francesco
>
> <fmdefrancesco@gmail.com> wrote:
> > +One cause of page faults is due to bugs (or maliciously crafted
addresses)
> > 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 kernel 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 Fault +(SIGSEGV) signal to the process, which usually
> > causes the process to terminate.
> This "segmentation fault" (SIGSEGV reads "signal segmentation violation)
> is actually a bit hard to understand for people not familiar
> with the 1970ies hardware.
Linus,
Actually, I see a lot of "Segmentation fault (core dumped)" because I still
develop in user space.
Stupid distractions are enough to get that message printed...
#include <stdio.h>
#include <malloc.h>
int main() {
int *p1, *p2;
p2 = malloc(sizeof(int));
*p2 = 9;
printf("*p2 is %d\n", *p1);
return 0;
}
fabio@suse:/tmp> gcc -o test test.c
fabio@suse:/tmp> ./test
Segmentation fault (core dumped)
Furthermore, everybody can still type "man signal.h" (document written in
2017) and lookup the table of the POSIX signals and see that SIGSEGV is for
"Invalid memory reference.".
>
> [Snip]
>
> 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
> additional patch if you prefer.
I suspect that people is much more used to get more "Segmentation fault" these
days than in the 1970's (when developers probably were a little more careful
with pointers - at least this is what I have heard about this subject :-)).
BTW, please feel free to change / extend this paragraph with a follow up
patch.
Thanks for your comments,
Fabio
> Yours,
> Linus Walleij
next prev parent reply other threads:[~2023-08-09 13:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-28 11:53 Fabio M. De Francesco
2023-08-03 17:08 ` Fabio M. De Francesco
2023-08-07 9:40 ` Linus Walleij
2023-08-09 13:27 ` Fabio M. De Francesco [this message]
2023-08-07 10:50 ` Mike Rapoport
2023-08-09 13:00 ` Fabio M. De Francesco
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2443562.jE0xQCEvom@suse \
--to=fmdefrancesco@gmail.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=ira.weiny@intel.com \
--cc=linus.walleij@linaro.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rdunlap@infradead.org \
--cc=rppt@kernel.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox