Commit Graph
80 Commits
Author SHA1 Message Date
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
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
Masatoshi Kimura 88805f267f Bug 1528651 - Fix some trivial warnings and re-enable warnings-as-errors on Windows in some directories. r=dmajor 2019-02-19 20:42:11 +09:00
Ehsan Akhgari 498e2df734 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
# ignore-this-changeset
2019-01-18 10:16:18 +01:00
Sylvestre Ledru e5a134f73a Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset
2018-11-30 11:46:48 +01:00
Chris Martin c33ce9539b 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
2018-11-21 01:52:26 +00:00
arthur.iakab 030300b503 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 5bf1f9e2d5 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
2018-11-05 00:27:31 +00:00
Randell Jesup 71f5e279f4 Bug 1480430: Modify jemalloc to allow dynamic replacement r=glandium 2018-10-09 22:28:37 -04:00
Tom Ritter 8fc9977b2c Bug 1480457-Correct typedef so it matches an earlier typedef r=aklotz 2018-08-30 23:05:59 +03:00
Masatoshi Kimura 9e78698153 Bug 1090497 - Re-enable warnings as errors on clang-cl. r=froydnj 2018-07-31 22:10:07 +09:00
Sylvestre Ledru a9c291ac34 Bug 1464869 - Fix flake8/pep8 issue by hand in memory/ r=njn
MozReview-Commit-ID: 8bkhAB4g6rv
2018-05-25 23:27:02 -07:00
Sylvestre Ledru fca21b5bcc Bug 1464869 - Run autopep8 on memory/ r=njn
MozReview-Commit-ID: GzFGXZ8WLX5
2018-05-25 23:16:07 -07:00
Mike Hommey e16bc5652a Bug 1442468 - Remove workaround for http://code.google.com/p/android/issues/detail?id=23203. r=froydnj
That NDK bug has been fixed since r8c, and we now require something more
recent than that. This effectively reverts the changes from bug 720621
and bug 734832.
2018-03-01 15:15:02 +09:00
Marco Castelluccio 8e12fabce0 Bug 1403005 - Don't run memory/replace/logalloc/replay in coverage builds. r=glandium 2018-01-16 15:45:40 +01:00
Mike Hommey 023abf4b35 Bug 1423000 - Run clang-format in memory/replace/logalloc. r=njn 2017-12-05 08:28:32 +09:00
Mike Hommey 67ba1da5be Bug 1423000 - Always log allocator function calls. r=njn
So far, logalloc has avoided logging calls that e.g. return null
pointers, but both to make the code more generic and to enable logging
of error conditions, we now log every call.
2017-11-30 07:55:12 +09:00
Mike Hommey 64f33bed35 Bug 1423000 - Don't use a separate replace-malloc library for the minimal-logalloc test. r=njn
Instead, only register a minimal set of functions when an environment
variable is set.
2017-12-03 13:59:16 +09:00
Mike Hommey d85897af48 Bug 1423000 - Use mozjemalloc mutexes in logalloc. r=njn
Instead of the chromium one, which required some tricks.
2017-12-03 14:23:23 +09:00
Mike Hommey afa5810ac9 Bug 1423000 - Reject some more invalid logalloc replay logs. r=njn
For functions with no result, such as free, it's invalid for some string
to appear after the closing parenthesis.
2017-11-30 10:33:18 +09:00
Mike Hommey c53a246fe2 Bug 1423000 - Move MemSlot lookup for replay results into the Replay methods. r=njn
This allows all methods to have the same signature.
2017-11-30 10:31:25 +09:00
Mike Hommey beed19bc62 Bug 1423000 - Count jemalloc_stats as an operation. r=njn
While jemalloc_stats is not actively doing anything, it can be
cumbersome to not have it count as an operation, because the operation
count shown on jemalloc_stats doesn't match the line number in the input
replay log, and the offset grows as the number of jemalloc_stats
operations grows.

While here, also update a comment about the replay log format.
2017-11-30 10:18:39 +09:00
Mike Hommey ad730700b9 Bug 1423000 - Remove Replay::Commit. r=njn
It adds an uncompressible and noticeable time overhead to replaying
logs, even when one is not interested in measuring RSS. This has caused
me to clear the method body on multiple occasions.

If necessary, it is possible to enable zero or junk at the allocator
level for the same effect.
2017-11-30 10:48:41 +09:00
Mike Hommey 6841c321d6 Bug 1420355 - Statically link DMD. r=njn 2017-11-28 08:10:48 +09:00
Mike Hommey f6ac2c4758 Bug 1420355 - Allow to statically link replace-malloc libraries. r=njn
And statically link logalloc.

Statically linking is the default, except when building with
--enable-project=memory, allowing to use the generated libraries from
such builds with Firefox.
2017-11-23 17:24:19 +09:00
Mike Hommey 1777dd3cd4 Bug 1420355 - Don't initialize logalloc if MALLOC_LOG is not given. r=njn
Now that replace_init can opt-out of registering the replace-malloc
functions, don't do so when MALLOC_LOG was not set in the environment.

While one would normally set MALLOC_LOG alongside one of the environment
variable necessary to load the replace-malloc library, we're also going,
in a subsequent change, to allow statically linking replace-malloc
libraries, taking full advantage of this change.
2017-11-23 13:54:16 +09:00
Mike Hommey 9895b39cb5 Bug 1420355 - Don't declare replace_* functions in replace_malloc.h. r=njn
The original purpose of those declarations was to avoid the function
definitions being wrong, as well as forcing them being exported
properly (as extern "C", as weak symbols when necessary, etc.), but:

- The implementations being C++, function overloads simply allowed
  functions with the same name to have a different signature.

- As of bug 1420353, the functions don't need to be exported anymore,
  nor do we care whether their symbols are mangled. Furthermore, they're
  now being assigned to function table fields, meaning there is type
  checking in place, now.

So all in all, these declarations can be removed.

Also, as further down the line we're going to statically link the
replace-malloc libraries, avoid symbol conflicts by making those
functions static.
2017-11-28 07:18:15 +09:00
Mike Hommey d56b7aa0dc Bug 1420355 - Don't link logalloc against the static runtime on Windows. r=njn
This was never strictly required (for instance, DMD doesn't do that),
and would make things harder with the subsequent changes.
2017-11-28 17:11:40 +09:00
Csoregi Natalia e4966430b1 Backed out 7 changesets (bug 1420355) for mass failures on OS X and Android. r=backout on a CLOSED TREE
Backed out changeset a7ed89e13a4c (bug 1420355)
Backed out changeset fd6702e6e0a0 (bug 1420355)
Backed out changeset 0479dda078a2 (bug 1420355)
Backed out changeset e69357ccca9e (bug 1420355)
Backed out changeset 3742a4b69ba2 (bug 1420355)
Backed out changeset 451cd087922f (bug 1420355)
Backed out changeset d80b5c4e1dd0 (bug 1420355)
2017-11-29 03:08:46 +02:00
Mike Hommey 0a7b28a47e Bug 1420355 - Statically link DMD. r=njn 2017-11-28 08:10:48 +09:00
Mike Hommey 6172c3f450 Bug 1420355 - Allow to statically link replace-malloc libraries. r=njn
And statically link logalloc.

Statically linking is the default, except when building with
--enable-project=memory, allowing to use the generated libraries from
such builds with Firefox.
2017-11-23 17:24:19 +09:00
Mike Hommey 04e85c2655 Bug 1420355 - Don't initialize logalloc if MALLOC_LOG is not given. r=njn
Now that replace_init can opt-out of registering the replace-malloc
functions, don't do so when MALLOC_LOG was not set in the environment.

While one would normally set MALLOC_LOG alongside one of the environment
variable necessary to load the replace-malloc library, we're also going,
in a subsequent change, to allow statically linking replace-malloc
libraries, taking full advantage of this change.
2017-11-23 13:54:16 +09:00
Mike Hommey 1cb0b4da51 Bug 1420355 - Don't declare replace_* functions in replace_malloc.h. r=njn
The original purpose of those declarations was to avoid the function
definitions being wrong, as well as forcing them being exported
properly (as extern "C", as weak symbols when necessary, etc.), but:

- The implementations being C++, function overloads simply allowed
  functions with the same name to have a different signature.

- As of bug 1420353, the functions don't need to be exported anymore,
  nor do we care whether their symbols are mangled. Furthermore, they're
  now being assigned to function table fields, meaning there is type
  checking in place, now.

So all in all, these declarations can be removed.

Also, as further down the line we're going to statically link the
replace-malloc libraries, avoid symbol conflicts by making those
functions static.
2017-11-28 07:18:15 +09:00
Mike Hommey c3de8455e7 Bug 1420355 - Don't link logalloc against the static runtime on Windows. r=njn
This was never strictly required (for instance, DMD doesn't do that),
and would make things harder with the subsequent changes.
2017-11-28 17:11:40 +09:00
Mike Hommey c2552aaaea Bug 1420353 - Change how replace-malloc initializes, part 2. r=njn
Because one entry point is simpler than two, we make replace_init fulfil
both the roles of replace_init and replace_get_bridge.

Note this should be binary compatible with older replace-malloc
libraries, albeit not detecting their bridge (and with the
previous change, they do not register anyways). So loading older
replace-malloc libraries should do nothing, but not crash in awful ways.
2017-11-24 16:02:05 +09:00
Mike Hommey db02ee9925 Bug 1420353 - Change how replace-malloc initializes, part 1. r=njn
The allocator API is a moving target, and every time we change it, the
surface for replace-malloc libraries grows. This causes some build
system problems, because of the tricks in replace_malloc.mk, which
require the full list of symbols.

Considering the above and the goal of moving some of the replace-malloc
libraries into mozglue, it becomes simpler to reduce the replace-malloc
exposure to the initialization functions.

So instead of the allocator poking into replace-malloc libraries for all
the functions, we expect their replace_init function to alter the table
of allocator functions it's passed to register its own functions.

This means replace-malloc implementations now need to copy the original
table, which is not a bad thing, as it allows function calls with one
level of indirection less. It also replace_init functions to not
actually register the replace-malloc functions in some cases, which will
be useful when linking some replace-malloc libraries into mozglue.

Note this is binary compatible with previously built replace-malloc
libraries, but because those libraries wouldn't update the function
table, they would stay disabled.
2017-11-22 17:24:29 +09:00
Mike Hommey 730ff37447 Bug 1417234 - Use SRWLock as Mutex for mozjemalloc on Windows. r=njn
SRWLock is more lightweight than CriticalSection, but is only available
on Windows Vista and more. So until we actually dropped support Windows
XP, we had to use CriticalSection.

Now that all supported Windows versions do have SRWLock, this is a
switch we can make, and not only because SRWLock is more lightweight,
but because it can be statically initialized like on other platforms,
allowing to use the same initialization code as on other platforms,
and removing the requirement for a DllMain, which in turn can allow
to statically link mozjemalloc in some cases, instead of requiring a
shared library (DllMain only works on shared libraries), or manually
call the initialization function soon enough.

There is a downside, though: SRWLock, as opposed to CriticalSection, is
not fair, meaning it can have thread scheduling implications, and can
theoretically increase latency on some threads. However, it is the
default used by Rust Mutex, meaning it's at least good enough there.
Let's see how things go with this.
2017-11-14 12:58:33 +09:00
Mike Hommey 4b8a14d828 Bug 1229384 - Make pages_commit fallible. r=njn
This will make allocation operations return nullptr in the face of OOM,
allowing callers to either handle the allocation error or for the normal
OOM machinery, which also records the requested size, to kick in.
2017-10-27 10:31:50 +09:00
Mike Hommey 8df4ff9d68 Bug 1399350 - Remove jemalloc_*_impl macros. r=njn
Those macros are one more thing that needs to be added when the
mozjemalloc API surface is increased, but after bug 1399350, nothing
actually needs them, so remove them.
2017-09-13 14:25:21 +09:00
Sebastian Hengst eb7fbf0906 merge mozilla-central to mozilla-inbound. r=merge a=merge 2017-09-12 11:37:58 +02:00
Mike Hommey f591c25a4d No bug - Remove the TODO item that was implemented in bug 1300948. r=me 2017-09-12 16:34:43 +09:00
Chris Manchester 67a3d90503 Bug 1386876 - Replace all uses of DISABLE_STL_WRAPPING with a template, remove DISABLE_STL_WRAPPING. r=glandium
MozReview-Commit-ID: FMEtb5PY7iP
2017-09-11 11:33:26 -07:00
David Major 2f8a0aa015 Bug 1391420: Set NO_PGO on a bunch of binaries that we don't ship. r=ted 2017-08-23 15:05:40 -04:00
Sebastian Hengst cd3a8b86af Backed out changeset 109e89a7d561 (bug 1391420) for busting Linux pgo builds. r=backout on a CLOSED TREE 2017-08-23 18:12:46 +02:00
David Major 0aace12760 Bug 1391420: Set NO_PGO on a bunch of binaries that we don't ship. r=ted 2017-08-23 11:10:39 -04:00
Mike Hommey d3ca146523 Bug 1368932 - Add a testcase for a replace-malloc library that doesn't implement all functions. r=njn 2017-05-31 15:04:32 +09:00
Mike Hommey 1f354dbf2a Bug 1363992 - Remove support for making jemalloc4 the default. r=njn 2017-05-11 13:16:00 +09:00
Emanuel Hoogeveen ba1459c85c Bug 1338574 - Part 1: Add MOZ_CRASH_UNSAFE_OOL and MOZ_CRASH_UNSAFE_PRINTF to crash with a runtime generated explanation string. r=froydnj 2017-02-21 18:01:41 +01:00
Sylvestre Ledru c86cd0927f Bug 1338086 - Remove useless else blocks in order to reduce complexity in memory/ r=njn
MozReview-Commit-ID: G7jBKlDHshQ
2017-02-09 11:24:39 +01:00
Mike Hommey 605fdf3ce8 Bug 1321093 - Avoid logalloc-replay make check failure when libstdc++ allocates memory in some static initializer. r=njn 2016-11-30 07:22:20 +09:00