Граф коммитов

465 Коммитов

Автор SHA1 Сообщение Дата
Gian-Carlo Pascutto ecee111c1f Bug 1553717 - Use Randomization on all arenas in non-Content Processes. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D70240
2020-05-13 08:31:04 +00:00
André Bargull ebec34a898 Bug 1625138 - Part 16: Replace mozilla::IsIntegral with std::is_integral. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D68371

--HG--
extra : moz-landing-system : lando
2020-03-28 13:57:15 +00:00
Andrew McCreight 4babb2b5ab Bug 1609815 - Remove Web Replay C++ implementation. r=jgilbert,jandem,gbrown
Patch by bhackett and jlaster. Also reviewed by mccr8.

Differential Revision: https://phabricator.services.mozilla.com/D60197

--HG--
extra : moz-landing-system : lando
2020-02-27 17:39:15 +00:00
Ciure Andrei 00dd87f6f4 Backed out changeset d407a28318e6 (bug 1609815) for causing windows ming bustages CLOSED TREE
--HG--
extra : histedit_source : b2c748e31e0f6ba8fcf9960a336e0bbd361b07e6
2020-02-27 07:05:19 +02:00
Andrew McCreight b197e1f783 Bug 1609815 - Remove Web Replay C++ implementation. r=jgilbert,jandem,gbrown
Patch by bhackett and jlaster. Also reviewed by mccr8.

Differential Revision: https://phabricator.services.mozilla.com/D60197

--HG--
extra : moz-landing-system : lando
2020-02-27 04:43:48 +00:00
Mike Hommey a28cf3044f Bug 1613011 - Clear node links when removing it from a RedBlackTree. r=njn
The assert that was added in bug 1610720 assumed the node links were
reset when a node is removed from a RedBlackTree, but that wasn't the
case. We can either remove the assert, or clear node links. We pick the
latter.

Differential Revision: https://phabricator.services.mozilla.com/D61515

--HG--
extra : moz-landing-system : lando
2020-02-04 02:05:19 +00:00
Mike Hommey b535767244 Bug 1610720 - Change moz_dispose_arena to allow to free empty arenas. r=erahm
Currently, it's expected to "lazily" dispose of the arena. That is, if
the arena still has allocations, the arena is kept around. Using it for
new allocations is an error, but otherwise, it's possible to free
allocations from there. Once it's empty, the arena is freed too. Well,
that's the idea, but that last part is not actually implemented, cf.
bug 1364359.

While that is still an (optionally) desirable disposal mode, other modes
would be useful as well. So this bug is here to switch the current mode
to something that can more easily be used for e.g. bug 1377999.

The idea is to make moz_dispose_arena() free the arena immediately, and
MOZ_CRASH if it's not already empty (on a besst effort basis).

Differential Revision: https://phabricator.services.mozilla.com/D60635

--HG--
extra : moz-landing-system : lando
2020-01-24 02:06:32 +00:00
Mike Hommey 505aa46f90 Bug 1610720 - Templatize the base allocator wrapper that uses a free-list. r=erahm
The base_node_alloc and base_node_dealloc are wrappers for the base
allocator that allow to free memory (the base allocator doesn't support
freeing memory), using a free list. They are dedicated to extent_node_t
objects (the only ones we currently ever need to free).

We're going to need to free other types of objects, so make this more
generic.

Differential Revision: https://phabricator.services.mozilla.com/D60634

--HG--
extra : moz-landing-system : lando
2020-01-24 02:03:37 +00:00
Brian Hackett f74708b30a Bug 1598951 Part 2 - Don't record random numbers in jemalloc, r=glandium.
Depends on D58437

Differential Revision: https://phabricator.services.mozilla.com/D58440

--HG--
extra : moz-landing-system : lando
2020-01-10 05:26:10 +00:00
Tom Ritter 2893552105 Bug 1590624 - Define a __imp_ alias for _strdup for mingw-clang r=dmajor
This is affected by the same problem detailed in the comment.

Differential Revision: https://phabricator.services.mozilla.com/D54532

--HG--
extra : moz-landing-system : lando
2019-12-12 06:38:37 +00:00
Andreea Pavel a533b175dd Backed out 4 changesets (bug 1590624) for breaking gecko decision task on a CLOSED TREE
Backed out changeset 2ac8dd1d709d (bug 1590624)
Backed out changeset 8432398c212a (bug 1590624)
Backed out changeset 2b28154aacdb (bug 1590624)
Backed out changeset d305e4160ee4 (bug 1590624)

--HG--
rename : build/build-clang/clang-9-mingw.json => build/build-clang/clang-8-mingw.json
rename : taskcluster/scripts/misc/build-clang-mingw.sh => taskcluster/scripts/misc/build-clang-8-mingw.sh
2019-12-12 08:35:11 +02:00
Tom Ritter 9a04d03693 Bug 1590624 - Define a __imp_ alias for _strdup for mingw-clang r=dmajor
This is affected by the same problem detailed in the comment.

Differential Revision: https://phabricator.services.mozilla.com/D54532

--HG--
extra : moz-landing-system : lando
2019-12-07 03:03:16 +00:00
Sylvestre Ledru 8d2f0d1b1f Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D54686

--HG--
extra : moz-landing-system : lando
2019-11-26 14:35:02 +00:00
Gian-Carlo Pascutto b5c1d7951a Bug 1539133 - Explicitly say not being able to mmap is likely OOM. r=decoder,glandium
Differential Revision: https://phabricator.services.mozilla.com/D43929

--HG--
extra : moz-landing-system : lando
2019-11-12 00:04:46 +00:00
Sylvestre Ledru f12b9fa5c3 Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D47737

--HG--
extra : moz-landing-system : lando
2019-10-06 18:29:55 +00:00
Nathan Froyd b47e23e17a Bug 1411613 - mark certain allocation functions as non-throwing; r=glandium
glibc marks various allocation functions as `throw()`.  This addition
hasn't been a problem until we tried to enable C++17, where clang
started complaining that we were redeclaring functions with mismatched
exception specifications.  Peculiarly, glibc declares virtually
everything we redeclare as `throw()`, but clang only complains about the
mismatches for a particular subset of functions.

The approach taken in this patch is to add another potentially defined
macro to malloc_decls.h, `NOTHROW_MALLOC_DECL`.  This macro works
exactly like `MALLOC_DECL`, except that clients can define
`NOTHROW_MALLOC_DECL` to add appropriate `throw()` specifiers when
declaring functions at global scope, and thereby avoid mismatched
exception specifications.

Differential Revision: https://phabricator.services.mozilla.com/D44045

--HG--
extra : moz-landing-system : lando
2019-09-04 23:40:15 +00:00
Tom Ritter 1f279f7006 Bug 1547519 - Fix jemalloc redirections for MinGW build r=glandium
In the MinGW build, calls to malloc inside mozglue were not being
redirected as defined in the .def file. We create aliases for the
redirected functions to correctly redirect them inside mozglue.

An alternate solution for this exists. Rather than creating the
importlib during the linking step for mozglue, we could have used
dlltool to create it, and then provided it during linking. This
would allow mozglue to know that it should redirect calls to malloc
to je_malloc as specified in the .def file.

Differential Revision: https://phabricator.services.mozilla.com/D38407

--HG--
extra : moz-landing-system : lando
2019-09-04 02:40:08 +00:00
Mihai Alexandru Michis 13fa935d68 Backed out changeset b1faa1af2967 (bug 1546442) for causing a spike in bug 1475812 and bug 1471001 a=backout 2019-07-26 00:15:37 +03:00
Gian-Carlo Pascutto 08c4b524cb Bug 1546442 - Leading guard pages for normal allocations. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D28516

--HG--
extra : moz-landing-system : lando
2019-07-25 09:22:47 +00:00
Nicholas Nethercote 38dbbfcffc Bug 1523276 - Implement PHC, a probabilistic heap checker. r=glandium,gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D25021

--HG--
extra : rebase_source : 86e94499f746b18a596130341692c6a9992d4867
2019-07-03 09:26:11 +10:00
Mike Hommey 8b2a1911b2 Bug 1559379 - Export C++ allocation functions from mozglue on all platforms. r=froydnj
- On Android, we were already doing it, but using fallible allocations.
- On *nix, it probably doesn't make a difference, but can't hurt. For
  most things in Gecko, operator new/delete are inlined and thus
  replaced by direct calls to the underlying allocator functions
  (moz_xmalloc, malloc, etc.). This may have a benefit for some third
  party libraries that would otherwise go through libstdc++'s to
  eventually end up back into our allocator via the zone allocator
  on macOS and via the exported symbols on others.
- On Windows, because of how some CRT static libraries are, a non-inlined
  operator new (thanks to some disabled STL wrapping) would end up linked
  against the system malloc, causing problems.

Overall, this can only be better. This also reduces the number of places
where we define those functions.

And on Android, this means operator new within mozglue becomes infallible,
which is more consistent with everything else.

Differential Revision: https://phabricator.services.mozilla.com/D36166

--HG--
extra : moz-landing-system : lando
2019-06-27 22:07:42 +00:00
Andreea Pavel f145bcfd98 Backed out 2 changesets (bug 1559379) for SM build bustages on a CLOSED TREE
Backed out changeset 0defd54899e2 (bug 1559379)
Backed out changeset ee4f23ea8530 (bug 1559379)
2019-06-28 01:03:23 +03:00
Mike Hommey 52dc935c68 Bug 1559379 - Export C++ allocation functions from mozglue on all platforms. r=froydnj
- On Android, we were already doing it, but using fallible allocations.
- On *nix, it probably doesn't make a difference, but can't hurt. For
  most things in Gecko, operator new/delete are inlined and thus
  replaced by direct calls to the underlying allocator functions
  (moz_xmalloc, malloc, etc.). This may have a benefit for some third
  party libraries that would otherwise go through libstdc++'s to
  eventually end up back into our allocator via the zone allocator
  on macOS and via the exported symbols on others.
- On Windows, because of how some CRT static libraries are, a non-inlined
  operator new (thanks to some disabled STL wrapping) would end up linked
  against the system malloc, causing problems.

Overall, this can only be better. This also reduces the number of places
where we define those functions.

And on Android, this means operator new within mozglue becomes infallible,
which is more consistent with everything else.

Differential Revision: https://phabricator.services.mozilla.com/D36166

--HG--
extra : moz-landing-system : lando
2019-06-27 14:01:31 +00:00
Tom Ritter 0b01745031 Bug 1376408 - Randomize free region selection for small allocations in a run r=glandium
This allows freelist randomization on a per-arena basis, by supplying parameters to
arena creation.

It uses an xorshift PRNG with a 128-bit state. It is not cryptographically secure. An
attacker who can observe outputs of the RNG, or read its state, is already in a position
to bypass the randomization applied. At the same time we make its state 128 bit to prevent
a trivial bypass if one or two outputs are observed.

The way a run selects masks to check has not been modified, so the randomization is limited
to at most 32 bits in the current mask being tested. It should be noted that while allocations
from the same run may now be non deterministic (up to the maximum entropy as previously
stated), an attacker who can perform multiple allocations will still be able to allocate
a targeted free region (for example while exploiting a use after free vulnerability in the
DOM). Non deterministic allocations will only impede an attacker who has less control over
how they allocate a targeted free region, and may provide some benefit during exploitation
of a heap based buffer overflow vulnerability where the attacker wishes to construct a
precise layout of regions pre overflow.

Differential Revision: https://phabricator.services.mozilla.com/D32219

--HG--
extra : moz-landing-system : lando
2019-06-18 21:18:23 +00:00
Nicholas Nethercote 94ec493862 Bug 1557907 - Fix `jemalloc_replace_dynamic()`. r=glandium
`jemalloc_replace_dynamic()` is badly broken. If you install a malloc table
other than the default at startup (e.g. DMD's or PHC's), when you call
`jemalloc_replace_dynamic()` it installs a new allocator that wraps the
*default* allocator, and then when you call `jemalloc_replace_dynamic(nullptr)`
it switches back to the *default* allocator.

This commits makes numerous improvements.

- It removes the "flip-flopping" between malloc tables, which didn't really
  work and isn't necessary.

- `jemalloc_replace_dynamic()` now switches between the *original* malloc table
  and the new one, rather than the *default* malloc table and the new one.

- It renames various things, to make the names shorter and clearer.

- It clearly documents the dangers and limitations of
  `jemalloc_replace_dynamic()`.

- It removes and inlines `profiler::Init()`, because there was only one call
  site.

- It rearranges `install_memory_counter()` so the control flow is simpler.

Differential Revision: https://phabricator.services.mozilla.com/D34266

--HG--
extra : moz-landing-system : lando
2019-06-13 20:42:19 +00:00
Nicholas Nethercote 637456901b Bug 1558365 - Simplify `PtrInfoTag`. r=glandium
This makes it less mozjemalloc-specific, which is helpful for PHC. No non-test
code uses the extra detail anyway.

Differential Revision: https://phabricator.services.mozilla.com/D34441

--HG--
extra : moz-landing-system : lando
2019-06-12 07:38:30 +00:00
Mike Hommey a36bd5ae07 Bug 997353 - Make powerpc not use static page sizes in mozjemalloc. r=njn
__powerpc__ covers powerpc and powerpc64.

Differential Revision: https://phabricator.services.mozilla.com/D33750

--HG--
extra : moz-landing-system : lando
2019-06-06 05:25:59 +00:00
Mike Hommey 4a87ec2ddc Bug 1553058 - Remove unused gPageSize case. r=njn
MALLOC_STATIC_PAGESIZE is only set on some platforms. Specifically, it's
not set on ia64 and sparc. Which means the case MALLOC_STATIC_PAGESIZE
&& (sparc || ia64) never happens, and gPageSize is never 8 KiB.

Differential Revision: https://phabricator.services.mozilla.com/D31965

--HG--
extra : moz-landing-system : lando
2019-05-21 23:01:21 +00:00
Gian-Carlo Pascutto 3b43637e56 Bug 1537781 - Trailing guard pages for normal allocations. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D27912

--HG--
extra : moz-landing-system : lando
2019-05-02 14:19:17 +00:00
Chris Martin ef8ae4fcb3 Bug 1052579 - Add ability to query ArenaID to mozjemalloc_ptr_info r=glandium
To ensure that any new JSString has its char buffer allocated in the new arena,
it is useful to be able to query a pointer and assert that it is in the
correct arena (at-least in Debug Build).

This adds the required functionality to mozjemalloc, and JSString can use it
for its new assertion in a later change.

Differential Revision: https://phabricator.services.mozilla.com/D25711

--HG--
extra : moz-landing-system : lando
2019-04-23 12:39:58 +00:00
Narcis Beleuzu cd1fcbc396 Backed out changeset 497561b76737 (bug 1052579) for bustages on mozjemalloc_types.h . CLOSED TREE 2019-04-22 19:00:58 +03:00
Chris Martin cb3f697d99 Bug 1052579 - Add ability to query ArenaID to mozjemalloc_ptr_info. r=glandium
To ensure that any new JSString has its char buffer allocated in the new arena,
it is useful to be able to query a pointer and assert that it is in the
correct arena (at-least in Debug Build).

This adds the required functionality to mozjemalloc, and JSString can use it
for its new assertion in a later change.

Differential Revision: https://phabricator.services.mozilla.com/D25711
2019-04-02 03:55:06 +00:00
Gian-Carlo Pascutto bfcbc83c13 Bug 1542290 - Decommit unused base_page allocations. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D26327

--HG--
extra : moz-landing-system : lando
2019-04-16 11:04:21 +00:00
Sylvestre Ledru 7f60810d86 Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D27245

--HG--
extra : moz-landing-system : lando
2019-04-12 13:14:25 +00:00
Petr Sumbera a65de26d20 Bug 1542758 - mozjemalloc.cpp should use posix_madvise on Solaris r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D26529

--HG--
extra : moz-landing-system : lando
2019-04-09 08:20:48 +00:00
Gian-Carlo Pascutto d735d8aa70 Bug 1529922 - Add guard pages following huge allocations. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D23292

--HG--
extra : moz-landing-system : lando
2019-03-20 10:45:15 +00:00
David Major e5773183d6 Bug 1528074 - Remove MSVC warning flags that clang-cl doesn't understand r=chmanchester
Per the previous patch, clang-cl only understands five MSVC-style warning flags: 7219c7e9af/clang/include/clang/Driver/CLCompatOptions.td (L188-L197)

This patch removes the flags that clang-cl doesn't understand.

Differential Revision: https://phabricator.services.mozilla.com/D22588

--HG--
extra : moz-landing-system : lando
2019-03-13 20:19:08 +00:00
Masatoshi Kimura e59e3b3e20 Bug 1528651 - Fix some trivial warnings and re-enable warnings-as-errors on Windows in some directories. r=dmajor
--HG--
extra : source : 5ee9efeda9e67f6af0521be85266703763cc4c50
2019-02-19 20:42:11 +09:00
Mike Hommey ef3ad686ee Bug 1512504 - Remove support for MSVC. r=froydnj
Consequently, this removes:
- MOZ_LIBPRIO, which is now always enabled.
- non_msvc_compiler, which is now always true.
- The cl.py wrapper, since it's not used anymore.
- CL_INCLUDES_PREFIX, which was only used for the cl.py wrapper.
- NONASCII, which was only there to ensure CL_INCLUDES_PREFIX still
  worked in non-ASCII cases.

This however keeps a large part of detecting and configuring for MSVC,
because we still do need it for at least headers, libraries, and midl.

Depends on D19614

Differential Revision: https://phabricator.services.mozilla.com/D19615

--HG--
extra : moz-landing-system : lando
2019-02-14 21:45:27 +00:00
Ehsan Akhgari e5e885ae31 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
# ignore-this-changeset

--HG--
extra : amend_source : 7221c8d15a765df71171099468e7c7faa648f37c
extra : histedit_source : a0cce6015636202bff09e35a13f72e03257a7695
2019-01-18 10:16:18 +01:00
Mike Hommey a8d4234310 Bug 1511251 - Remove redundant and costly assert. r=njn
The diagnostic assert (so fortunately, it doesn't impact release builds)
as added in bug 1405159, but is costly because it uses the modulus of
the division with a variable integer, which is a slow operation.
However, in arena_run_reg_dalloc, we end up doing the same diagnostic
assert, in a different form: after performing the division in a faster
manner, we assert that the result, multiplied by the diviser, returns
the original number.

Differential Revision: https://phabricator.services.mozilla.com/D13501

--HG--
extra : moz-landing-system : lando
2018-12-05 14:45:52 +00:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Chris Martin adde9e8556 Bug 1402282 - Change jemalloc to use secure random private arena ids r=glandium
Previously the id for a new arena was just a counter that increased by one
every time. For hardening purposes, we want to make private arenas use a secure
random ID, so an attacker will have a more difficult time finding the memory
they are looking for.

Differential Revision: https://phabricator.services.mozilla.com/D10158

--HG--
extra : moz-landing-system : lando
2018-11-21 01:52:26 +00:00
Mike Hommey c4ea7f7d5a Bug 1507035 - Fix run sizes for size classes >= 16KB on systems with large pages. r=njn
Differential Revision: https://phabricator.services.mozilla.com/D11836

--HG--
extra : moz-landing-system : lando
2018-11-14 06:58:53 +00:00
arthur.iakab 27754a7d12 Backed out 2 changesets (bug 1402282) for turning multiple browser chrome bugs into permafail
Backed out changeset db7059b57f92 (bug 1402282)
Backed out changeset cea1d44ac776 (bug 1402282)
2018-11-05 17:56:37 +02:00
Chris Martin 3824b0d43e Bug 1402282 - Change jemalloc to use secure random arena ids r=glandium
Previously the id for a new arena was just a counter that increased by one
every time. For hardening purposes, we want to make the new counter a secure
random ID, so an attacker will have a more difficult time finding the memory
they are looking for.

Differential Revision: https://phabricator.services.mozilla.com/D10158

--HG--
extra : moz-landing-system : lando
2018-11-05 00:27:31 +00:00
Chris Martin a1d5bd1909 Bug 1402282 - Clang-format on mozjemalloc r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D10794

--HG--
extra : moz-landing-system : lando
2018-11-05 00:26:00 +00:00
Randell Jesup 0f390bf1a5 Bug 1480430: Modify jemalloc to allow dynamic replacement r=glandium 2018-10-09 22:28:37 -04:00
Mike Hommey 5f59918688 Bug 1482797 - Don't use MADV_FREE on Linux until we support it properly. r=njn 2018-08-15 21:33:57 +09:00
Masatoshi Kimura 3b21b7868b Bug 1090497 - Re-enable warnings as errors on clang-cl. r=froydnj
--HG--
extra : rebase_source : c09366fb93e5b0f72abe1e99d3094e3d96a934fb
extra : intermediate-source : 5950c9d63c3b4fd63a25464a7b50944aaec7079f
extra : source : ca1b9a2bcc4381795f556fea2fb59066567c30f3
2018-07-31 22:10:07 +09:00