Commit Graph
1299 Commits
Author SHA1 Message Date
Mihai Alexandru Michis d40c0d7e73 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 641ebc025a Bug 1546442 - Leading guard pages for normal allocations. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D28516
2019-07-25 09:22:47 +00:00
Nicholas Nethercote fb3b8e2759 Bug 1523276 - Implement PHC, a probabilistic heap checker. r=glandium,gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D25021
2019-07-03 09:26:11 +10:00
Jed Davis 7c7146cc0b Bug 1562358 - Move fallible.h into MFBT. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D36541
2019-07-10 01:51:15 +00:00
Csoregi Natalia 319606dd83 Backed out changeset 5bf39249f6e4 (bug 1562358) for spidermonkey bustage. CLOSED TREE 2019-07-09 19:26:58 +03:00
Jed Davis e8985ed6ea Bug 1562358 - Move fallible.h into MFBT. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D36541
2019-07-02 09:08:21 +00:00
Victor Porof f68f735013 Bug 1561435 - Format memory/, a=automatic-formatting
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D35912
2019-07-05 10:51:11 +02:00
Nick Thomas bf5a91c63c Bug 1559975 - enable py2 and py3 linting in memory r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D35251
2019-06-28 18:53:28 +00:00
Mike Hommey f24b476a63 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
2019-06-27 22:07:42 +00:00
Mike Hommey 931d225ffd Bug 1559379 - Remove GCC ASAN workaround that seems to be unnecessary nowadays. r=froydnj
Bug 1147248 added the workaround for GCC 4.9, but from an attempt with
GCC 6, it seems unnecessary anymore.

Differential Revision: https://phabricator.services.mozilla.com/D36165
2019-06-27 22:07:44 +00:00
Andreea Pavel dc8819d8da 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 487b8cdd33 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
2019-06-27 14:01:31 +00:00
Mike Hommey 312a4c780e Bug 1559379 - Remove GCC ASAN workaround that seems to be unnecessary nowadays. r=froydnj
Bug 1147248 added the workaround for GCC 4.9, but from an attempt with
GCC 6, it seems unnecessary anymore.

Differential Revision: https://phabricator.services.mozilla.com/D36165
2019-06-27 13:37:36 +00:00
Tom Ritter 24744fd00f 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
2019-06-18 21:18:23 +00:00
Nicholas Nethercote b54643de80 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
2019-06-13 20:42:19 +00:00
Nicholas Nethercote 7f09190030 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
2019-06-12 07:38:30 +00:00
Mike Hommey 42d0d6619b 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
2019-06-06 05:25:59 +00:00
Mike Hommey 7a770ed018 Bug 1553363 - Generalize the *_impl goop for allocation functions in mozglue. r=froydnj
The current situation is suboptimal, where we have the same goop
repeated in multiple files, and where things kinda sorta work out fine
thanks to the linker for files that would have been forbidden, except
when the linker doesn't do its job, which apparently happen on
mingwclang builds.

This change only really covers C++ code using operator new/delete, and
not things that would be using malloc/free, because it's easier.
malloc/free is left for a followup.

Differential Revision: https://phabricator.services.mozilla.com/D32119
2019-05-29 22:49:42 +00:00
Mike Hommey ce34c88cf7 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
2019-05-21 23:01:21 +00:00
Chris Martin 573d21918b Bug 1052579 - Modify GTest for jemalloc_ptr_info() to check arenaId r=glandium
In D25711, I added an arenaId member to `jemalloc_ptr_info_t` when `MOZ_DEBUG`
is defined. This modifies the GTest for `jemalloc_ptr_info()` to ensure that
the new member returns the correct value.

Differential Revision: https://phabricator.services.mozilla.com/D30087
2019-05-07 00:34:42 +00:00
Gian-Carlo Pascutto b8b640e095 Bug 1537781 - Test for trailing guard pages for normal allocations. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D27913
2019-05-02 14:19:19 +00:00
Gian-Carlo Pascutto 51783d701a Bug 1537781 - Trailing guard pages for normal allocations. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D27912
2019-05-02 14:19:17 +00:00
Sylvestre Ledru ad31adba4c Bug 1547143 - Format the tree: Be prescriptive with the pointer style (left) r=Ehsan
# ignore-this-changeset

Depends on D28954

Differential Revision: https://phabricator.services.mozilla.com/D28956
2019-05-01 08:47:10 +00:00
Chris Martin 887024dd18 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-23 12:39:58 +00:00
Edwin Gao d4c5ae9916 Bug 1544961 - comment on gtests that are disabled, disable ThreadUtils.IdleRunnableMethod and Timers.FindExpirationTime for windows10-aarch64 r=jmaher,gbrown,dmajor
Changes:
- added comments for tests being disabled
- disabled two additional tests in order to green the run

Differential Revision: https://phabricator.services.mozilla.com/D28085
2019-04-23 00:21:37 +00:00
Narcis Beleuzu 7057c2dfba Backed out changeset 497561b76737 (bug 1052579) for bustages on mozjemalloc_types.h . CLOSED TREE 2019-04-22 19:00:58 +03:00
Chris Martin 1d9c76e6ea 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
Edwin Gao 6d4f1359dc Bug 1544961 - disable tests that cause gtest harness to crash on windows10-aarch64 r=jmaher,gbrown
Changes:
- most tests are skipped using `moz.build` configuration file.
- `MultiWriterQueue` had to be skipped with `define` clauses in the test file due to build bustages when its `moz.build` file was used.

Differential Revision: https://phabricator.services.mozilla.com/D27944
2019-04-17 23:12:19 +00:00
Gian-Carlo Pascutto d273f33640 Bug 1542290 - Decommit unused base_page allocations. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D26327
2019-04-16 11:04:21 +00:00
Sylvestre Ledru 72e7e7d7e7 Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D27245
2019-04-12 13:14:25 +00:00
Geoff Brown d8d21be522 Bug 1318091 - Skip jemalloc gtests on android; r=bc
The jemalloc tests leave behind minidumps. Disable for now, for a green run.

Differential Revision: https://phabricator.services.mozilla.com/D27014
2019-04-11 10:57:50 +00:00
Petr Sumbera c83d577ebd Bug 1542758 - mozjemalloc.cpp should use posix_madvise on Solaris r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D26529
2019-04-09 08:20:48 +00:00
Sylvestre Ledru 1666e92b07 Bug 1542146 - Apply the change with the option StatementMacros from clang-format-8 r=andi
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D26280
2019-04-05 21:42:17 +00:00
Csoregi Natalia 2ded4ab36d Backed out changeset 4ad80127f89f (bug 1519636) for bustage on MarkupMap.h and nsAccessibilityService.cpp. CLOSED TREE 2019-04-05 09:48:19 +03:00
Sylvestre Ledru ebe9c62d30 Bug 1519636 - clang-format-8: Reformat recent changes to the Google coding style r=Ehsan
clang-format-8 upstream had some improvements wrt macros
See: https://reviews.llvm.org/D33440
This is why the diff is bigger than usual

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D26098
2019-04-04 21:36:16 +00:00
Narcis Beleuzu 6b9ce2a82b Backed out changeset 389b6bbd76db (bug 1519636) for bustages on MarkupMap.h . CLOSED TREE 2019-04-05 00:27:56 +03:00
Sylvestre Ledru 194039a8d9 Bug 1519636 - clang-format-8: Reformat recent changes to the Google coding style r=Ehsan
clang-format-8 upstream had some improvements wrt macros
See: https://reviews.llvm.org/D33440
This is why the diff is bigger than usual

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D26098
2019-04-04 20:12:23 +00:00
Nicholas Nethercote eb80622e74 Bug 1533240 - Replace DMD's custom TLS code with use of mozilla/ThreadLocal.h. r=erahm
Differential Revision: https://phabricator.services.mozilla.com/D22448
2019-03-22 20:07:30 +00:00
Gian-Carlo Pascutto bc8f0fa4c8 Bug 1529922 - Add guard pages following huge allocations. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D23292
2019-03-20 10:45:15 +00:00
Edwin Gao 8ff7f226f8 Bug 1536250 - disable test_dmd.js r=jmaher
Disable this test which intermittently fails in xpcshell.

Differential Revision: https://phabricator.services.mozilla.com/D23956
2019-03-19 01:12:08 +00:00
Gurzau Raul 9411dbf44f Backed out changeset 46f6705f9c0c (bug 1533240) for xpcshell failures at /test/test_dmd.js on a CLOSED TREE. 2019-03-14 07:03:38 +02:00
Nicholas Nethercote e1cf97e010 Bug 1533240 - Replace DMD's custom TLS code with use of mozilla/ThreadLocal.h. r=erahm
Differential Revision: https://phabricator.services.mozilla.com/D22448
2019-03-14 01:05:15 +00:00
David Major f6b8b7cf85 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: https://github.com/llvm/llvm-project/blob/7219c7e9af7718f026ac5e3ea72249d037898e5b/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
2019-03-13 20:19:08 +00:00
Ryan Hunt 399e0bbe0e Bug 1523969 part 16 - Move method definition inline comments to new line in 'memory/'. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D21117
2019-02-25 16:10:15 -06:00
Nicholas Nethercote 7d4a7f57fe Bug 1531027 - Add an explicit copy constructor to StackTrace. r=ehsan
This only copies the first `mLength` elements in `mPcs`.

Differential Revision: https://phabricator.services.mozilla.com/D21488
2019-02-28 11:00:14 +11:00
Nicholas Nethercote 1e9d475b50 Bug 1531029 - Fix incorrect sizeof expression. r=ehsan
This doesn't change behaviour because `sizeof(uintptr_t)` equals
`sizeof(uintptr_t*)`, but it's good to make things more obviously correct.

Differential Revision: https://phabricator.services.mozilla.com/D21487
2019-02-28 11:05:34 +11:00
Ehsan Akhgari caf8292488 Bug 1531027 - Make InfallibleAllocPolicy::new_ accept its argument as a reference; r=njn
Differential Revision: https://phabricator.services.mozilla.com/D21486
2019-02-28 06:41:09 +00:00
Mike Hommey f40da68d54 Bug 1530562 - Set SmokeDMD compiler flags depending on compiler type rather than target OS. r=mshal
Differential Revision: https://phabricator.services.mozilla.com/D21161
2019-02-26 22:06:37 +00:00
Nicholas Nethercote 5945f22a43 Bug 1529452 - Fix a silly bug. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D20772
2019-02-22 10:52:03 +00:00
Jeff Gilbert 9b5867cbad Bug 1349064 - Wrap std::regex_error for GCC. r=glandium 2019-02-21 11:23:59 -08:00