Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Oct 2020 20:25:46 +0200
From:      Paul Floyd <pjfloyd@wanadoo.fr>
To:        FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject:   Re: Extra memory mapping seen on freebsd-12 which was not seen in freebsd-11
Message-ID:  <9CCF59F6-06F2-4352-94E5-C508E165D0C2@wanadoo.fr>
In-Reply-To: <CAB6rxaSNSoCywTy6tx6w%2B%2B-aJhQHb3FJiHoRL0vXs2CJAHe1OA@mail.gmail.com>
References:  <CAB6rxaSNSoCywTy6tx6w%2B%2B-aJhQHb3FJiHoRL0vXs2CJAHe1OA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

> On 15 Oct 2020, at 16:54, karnajit wangkhem <karnajitw@gmail.com> =
wrote:
>=20
> Hi freebsd team,
>=20
> While checking on a valgrind issue, I encountered the following =
mapping of
> a simple test program on a freebsd-12.

;-)


> [Stable 11]
>=20
> # procstat -v 85507
>=20
>  PID              START                END PRT  RES PRES REF SHD FLAG =
TP
> PATH
>=20
> <SNIP>
>=20
> 85507        0x800820000        0x800822000 rw-    1    1   1   0 ---- =
df
> 85507     0x7ffffffdf000     0x7ffffffff000 rw-    1    1   1   0 ---D =
df
> 85507     0x7ffffffff000     0x800000000000 r-x    1    1 104   0 ---- =
ph
>=20
> There is an extra ~511MB reserved mmap area starting at 0x7fffdffff000 =
in
> stable 12. Could you please give me an insight of what this is for and =
is
> it ok for a userspace program to modify this mapping?
>=20
> The reason is that our applications reserve some fixed memory that
> crosses/modify the above region. As this mapping was not called by the
> client program, valgrind had taken control of it. So, I have to decide
> whether to give the control to the client and allow =
modifications(mprotect,
> unmap, mmap, etc) on this memory segment or logically(not mandatorily) =
a
> client program should be allowed to modify this area?


This extra memory is the MAP_GUARD, which was introduced in FreeBSD 10.4
and changed to be a large zone in FreeBSD 11.1.

If I understand correctly, it=E2=80=99s a kind of super-sized guard page =
for the stack.
There are more details in the mmap man page.

If you run Valgrind with the -d option it will print a table of the =
memory mapping
(Prefixed with =E2=80=98aspacem=E2=80=99 for Address Space Manager). If =
you want to see some
more Valgrind details, see aspacemgr-linux.c from line 1646 (despite the =
name
it's used by all supported platforms).

A+
Paul




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9CCF59F6-06F2-4352-94E5-C508E165D0C2>