From: Vibhav Pant <vibhavp@gmail.com>
To: Emacs developers <emacs-devel@gnu.org>
Subject: Re: feature/asan-gc-poisoning: Better memory checks using AddressSanitizer
Date: Sun, 18 Dec 2022 01:38:33 +0530 [thread overview]
Message-ID: <CA+T2Sh1AWiqWWH7zwu3EQGZGTNKBPegV+TGHPVEJzMqb+PzC1Q@mail.gmail.com> (raw)
In-Reply-To: <CA+T2Sh3CF34drunaKb89c2MXo4VS9HRPAqSKfm1+O8sV9RKPqQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2352 bytes --]
Unless there are any objections, I plan to merge this branch into master
today.
Thanks,
Vibhav
Vibhav Pant
vibhavp@gmail.com
On Tue, Dec 6, 2022, 02:05 Vibhav Pant <vibhavp@gmail.com> wrote:
> As part of trying to debug the deluge of GC borks in
> scratch/comp-static-data, I took a slight detour through Emacs' memory
> management code and the sanity checks that it optionally comes with.
> The changes in feature/asan-gc-poisoning attempt to augment the
> latter, specifically when Emacs is built with '-fsanitize=address'.
>
> When enabled, almost all memory management operations are instrumented
> with calls to ASan's "(un)poisoning" functions, which allow ASan to
> mark allocated but not freed addresses as "poisoned", triggering
> errors whenever they have been accessed. The idea behind this is to
> add another layer of checks against code that makes use of free lists
> and arena based allocators, only allowing access to regions of the
> memory that are actually intended to be accessible (aka "unpoisoned"
> in ASan parlance) by non alloc-related C code. An instance of this is
> any object on a free list, or a vectorlike with the type PVEC_FREE (we
> do abort whenever we come across such a vector, but this ideally
> catches the bug way earlier in the flow, and therefore closer to the
> source of the actual problem). Additional documentation explaining
> this feature is available both on src/alloc.c and the "Running Emacs
> with address sanitization" section in etc/DEBUG.
>
> The branch bootstraps successfully both with native-comp enabled and
> disabled, and passes everything on the test suite on my machine.
> Because enabling Address Sanitizer comes with a significant
> performance + memory overhead, using it as a daily driver isn't
> without a decent bit of sluggishness, although building with -O2 and
> native compilation seems to help, at least a little.
> I plan to get install this in `master` soon, so both feedback and
> testing from other users would be greatly appreciated. The current
> codebase quite likely does everything alloc related correctly, so an
> ASan error might be indicative of a snag in this branch instead of
> Emacs itself (fingers crossed for the opposite, however :)).
>
> Thanks,
> Vibhav
> --
> Vibhav Pant
> vibhavp@gmail.com
> GPG: 7ED1 D48C 513C A024 BE3A 785F E3FB 28CB 6AB5 9598
>
[-- Attachment #2: Type: text/html, Size: 3057 bytes --]
next prev parent reply other threads:[~2022-12-17 20:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-05 20:35 feature/asan-gc-poisoning: Better memory checks using AddressSanitizer Vibhav Pant
2022-12-17 20:08 ` Vibhav Pant [this message]
2022-12-17 20:24 ` Eli Zaretskii
2022-12-18 14:59 ` Vibhav Pant
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA+T2Sh1AWiqWWH7zwu3EQGZGTNKBPegV+TGHPVEJzMqb+PzC1Q@mail.gmail.com \
--to=vibhavp@gmail.com \
--cc=emacs-devel@gnu.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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).