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

2166 Коммитов

Автор SHA1 Сообщение Дата
Mark Banner 11bfa90d06 Bug 1602940 - Automated replacements to use Services.uuid. r=Gijs,necko-reviewers,preferences-reviewers,kershaw
Depends on D124391

Differential Revision: https://phabricator.services.mozilla.com/D124392
2021-09-06 09:53:52 +00:00
Dzmitry Malyshau c196398803 Bug 1726628 - Switch cargo resolver to 2 r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D123157
2021-09-01 21:11:33 +00:00
Gabriele Svelto 3e1f486e5c Bug 1724928 - Catch EXC_CRASH exceptions on macOS r=KrisWright
EXC_CRASH exceptions wrap some of the other exceptions under certain
conditions. They are delivered to the exception handler when the wrapped
exception has not been caught by a previous handler. They carry no data
of their own but pack the data of the original exception instead, see:

2ff845c2e0/bsd/kern/kern_exit.c (L1056-L1066)

We match Crashpad behavior to not store these exceptions directly in the
minidump but rather unpack the original exception and store it instead.
Because of that I haven't added functionality to print them out.

Additionally it seems that they can also wrap uncaught signals and deliver
those instead of a mach exception. While extracting the original signal is
a trivial operation I was unable to actually generate one in the first
place. As such I've added no specific functionality to deal with those either.
This also matches crashpad behavior.

Differential Revision: https://phabricator.services.mozilla.com/D123532
2021-08-31 09:18:50 +00:00
Andi-Bogdan Postelnicu 2fc4f70e9b Bug 1725145 - Preparation for the hybrid build env. r=necko-reviewers,firefox-build-system-reviewers,valentin,glandium
Automatically generated path that adds flag `REQUIRES_UNIFIED_BUILD = True` to `moz.build`
when the module governed by the build config file is not buildable outside on the unified environment.

This needs to be done in order to have a hybrid build system that adds the possibility of combing
unified build components with ones that are built outside of the unified eco system.

Differential Revision: https://phabricator.services.mozilla.com/D122345
2021-08-25 10:46:17 +00:00
Gabriele Svelto c2cb64620b Bug 1724388 - Add support for catching and processing EXC_GUARD exceptions on macOS r=KrisWright
Besides adding EXC_GUARD to the list of exceptions the exception handler
listens to and modifying the minidump processor to interpret the exception
correctly this patch introduces a unit-test that crashes with an EXC_RESOURCE
exception.

Information about the exception itself is available here:

https://github.com/apple/darwin-xnu/blob/main/osfmk/kern/exc_guard.h

Additional flavors for the exception are documented here:

https://github.com/apple/darwin-xnu/osfmk/mach/port.h
https://github.com/apple/darwin-xnu/osfmk/mach/vm_statistics.h

Last but not least the undocumented API that generates these exceptions and
which we use in the unit-test was inferred from this header:

https://github.com/apple/darwin-xnu/blob/main/bsd/sys/guarded.h

Depends on D122229

Differential Revision: https://phabricator.services.mozilla.com/D122374
2021-08-20 08:06:00 +00:00
Gabriele Svelto ca709edb9a Bug 1724368 - Add support for catching and processing EXC_RESOURCE exceptions on macOS r=KrisWright
This introduces a few changes to the crash reporting machinery:

* The macOS exception handler now registers itself for catching EXC_RESOURCE
  exceptions, those are thrown when the process exceeds a pre-set resource
  limit (memory, CPU usage, I/O, etc...)
* The minidump writer has been updated to correctly store the subcode from the
  EXC_RESOURCE exceptions, this involves widening to 64-bits the code and
  subcode passed to the writer. The upper 32 bits of the code are now set in
  the minidump's exception_flags field (vs the lower 32 bits for all other
  exceptions). Additionally the exception type, code and subcode are now
  stored in the exception_information array like Crashpad does. This preserves
  the entirety of the data that came with the exception.
* The stackwalker has been modified to print out these type of exceptions as
  well as the resource type and flavor.

Differential Revision: https://phabricator.services.mozilla.com/D122229
2021-08-20 08:06:00 +00:00
Gabriele Svelto 7d44a564ad Bug 1725154 - Import breakpad patches that had been applied to Socorro's stackwalker r=KrisWright
Differential Revision: https://phabricator.services.mozilla.com/D122351
2021-08-20 08:05:59 +00:00
Steve Fink b7d27dc0cd Bug 1618669 - Display tid of crashing thread in minidump_stackwalk output. r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D119468
2021-08-19 18:46:31 +00:00
Alexandru Michis 327cfa51bb Backed out 3 changesets (bug 1724368, bug 1725154, bug 1724388) for causing bustages in minidump_processor.cc
CLOSED TREE

Backed out changeset 8be159457667 (bug 1724388)
Backed out changeset fd5d00822477 (bug 1724368)
Backed out changeset 092785e2a7f8 (bug 1725154)
2021-08-19 19:18:02 +03:00
Gabriele Svelto fdb82a0878 Bug 1724388 - Add support for catching and processing EXC_GUARD exceptions on macOS r=KrisWright
Besides adding EXC_GUARD to the list of exceptions the exception handler
listens to and modifying the minidump processor to interpret the exception
correctly this patch introduces a unit-test that crashes with an EXC_RESOURCE
exception.

Information about the exception itself is available here:

https://github.com/apple/darwin-xnu/blob/main/osfmk/kern/exc_guard.h

Additional flavors for the exception are documented here:

https://github.com/apple/darwin-xnu/osfmk/mach/port.h
https://github.com/apple/darwin-xnu/osfmk/mach/vm_statistics.h

Last but not least the undocumented API that generates these exceptions and
which we use in the unit-test was inferred from this header:

https://github.com/apple/darwin-xnu/blob/main/bsd/sys/guarded.h

Depends on D122229

Differential Revision: https://phabricator.services.mozilla.com/D122374
2021-08-19 09:46:53 +00:00
Gabriele Svelto 0ddb39acff Bug 1724368 - Add support for catching and processing EXC_RESOURCE exceptions on macOS r=KrisWright
This introduces a few changes to the crash reporting machinery:

* The macOS exception handler now registers itself for catching EXC_RESOURCE
  exceptions, those are thrown when the process exceeds a pre-set resource
  limit (memory, CPU usage, I/O, etc...)
* The minidump writer has been updated to correctly store the subcode from the
  EXC_RESOURCE exceptions, this involves widening to 64-bits the code and
  subcode passed to the writer. The upper 32 bits of the code are now set in
  the minidump's exception_flags field (vs the lower 32 bits for all other
  exceptions). Additionally the exception type, code and subcode are now
  stored in the exception_information array like Crashpad does. This preserves
  the entirety of the data that came with the exception.
* The stackwalker has been modified to print out these type of exceptions as
  well as the resource type and flavor.

Differential Revision: https://phabricator.services.mozilla.com/D122229
2021-08-19 09:46:53 +00:00
Gabriele Svelto ccc8e312fd Bug 1725154 - Import breakpad patches that had been applied to Socorro's stackwalker r=KrisWright
Differential Revision: https://phabricator.services.mozilla.com/D122351
2021-08-19 09:46:52 +00:00
Sebastian Hengst 2fc5ede43e Bug 1726309 - don't skip tests on macOS 11 which actually pass. r=jmaher
Differential Revision: https://phabricator.services.mozilla.com/D122938
2021-08-18 13:40:32 +00:00
Marian-Vasile Laza b50f0ce625 Backed out changeset 65f8b0434e1e (bug 1708580) for causing Btime failures. CLOSED TREE 2021-08-14 00:44:48 +03:00
Aaron Klotz d8a5c41db0 Bug 1708580: When the "quit-application" event fires in GeckoView, annotate the GeckoThread.State and force crash on nightly and early beta; r=agi
AFAICT, all roads lead though [`nsAppStartup::Quit`](https://searchfox.org/mozilla-central/rev/0fec57c05d3996cc00c55a66f20dd5793a9bfb5d/toolkit/components/startup/nsAppStartup.cpp#448),
which is responsible for firing the `"quit-application"` observer notification
and then posting the `nsAppExitEvent` that causes the `nsAppShell` to break out
of its event loop and proceed with shutdown.

If we trigger a native crash in the observer, we should be able to capture a
symbolicated stack of whatever called `Quit`. We might as well force-crash
anyway, since AC is going to throw an exception regardless...

Before we crash, we annotate the current `GeckoThread` state to enable us to
find out whether we were fully initialized at the time of the shutdown.

Differential Revision: https://phabricator.services.mozilla.com/D122256
2021-08-13 15:45:37 +00:00
Dorel Luca c5bcb28b25 Backed out changeset 27e6d1f6f6c1 (bug 1708580) on Dev's request. CLOSED TREE 2021-08-12 22:30:34 +03:00
Aaron Klotz 9daf72aa1f Bug 1708580: When the "quit-application" event fires in GeckoView, annotate the GeckoThread.State and force crash on nightly and early beta; r=agi
AFAICT, all roads lead though [`nsAppStartup::Quit`](https://searchfox.org/mozilla-central/rev/0fec57c05d3996cc00c55a66f20dd5793a9bfb5d/toolkit/components/startup/nsAppStartup.cpp#448),
which is responsible for firing the `"quit-application"` observer notification
and then posting the `nsAppExitEvent` that causes the `nsAppShell` to break out
of its event loop and proceed with shutdown.

If we trigger a native crash in the observer, we should be able to capture a
symbolicated stack of whatever called `Quit`. We might as well force-crash
anyway, since AC is going to throw an exception regardless...

Before we crash, we annotate the current `GeckoThread` state to enable us to
find out whether we were fully initialized at the time of the shutdown.

Differential Revision: https://phabricator.services.mozilla.com/D122256
2021-08-12 19:12:49 +00:00
Haik Aftandilian 4c3aebfa63 Bug 1714382 - Patch 2 - Correct description of MacMemoryPressureSysctl r=jrmuizel DONTBUILD
Correct the description of the MacMemoryPressureSysctl crash annotation to indicate 1 is the value for normal memory pressure.

The integer values are from the XNU kernel event.h header file and observable with `$ sysctl kern.memorystatus_vm_pressure_level`.

Differential Revision: https://phabricator.services.mozilla.com/D122032
2021-08-10 15:08:36 +00:00
Gabriele Svelto 65f2ae5b03 Bug 1723934 - Remove old and useless crash annotations r=KrisWright
Differential Revision: https://phabricator.services.mozilla.com/D121709
2021-08-09 20:08:17 +00:00
Gabriele Svelto ba4eb56216 Bug 1723941 - Fix several issues in macOS minidump generation which can lead to hangs & crashes r=KrisWright
Differential Revision: https://phabricator.services.mozilla.com/D121725
2021-08-05 13:05:39 +00:00
Christoph Kerschbaumer 4a6250387f Bug 1719272: Annotate failing browser/ tests to potentially enable https-first mode in Nightly r=webcompat-reviewers,denschub,webdriver-reviewers,preferences-reviewers,Gijs,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D119177
2021-07-28 19:16:16 +00:00
Sandor Molnar 68cdec0548 Backed out changeset 7eb8945dd8e3 (bug 1719272) for causing bustages in gecko decision task. CLOSED TREE 2021-07-28 19:47:06 +03:00
Christoph Kerschbaumer bb716f0701 Bug 1719272: Annotate failing browser/ tests to potentially enable https-first mode in Nightly r=webcompat-reviewers,denschub,webdriver-reviewers,preferences-reviewers,Gijs,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D119177
2021-07-28 16:08:07 +00:00
Haik Aftandilian 66b55bf012 Bug 1714382 - Include the Mac memory pressure state in crash reports r=spohl,KrisWright
Subscribe to memory pressure events on macOS and add crash report annotations to parent and content process crash reports that can be used to determine if the system was under memory pressure at the time of the crash.

Include the memory pressure level reported via the DISPATCH_SOURCE_TYPE_MEMORYPRESSURE dispatch with timestamps of transitions, the memory pressure level as read from the kern.memorystatus_vm_pressure_level sysctl, and a measurement of the percentage of available memory in the system read from the kern.memorystatus_level sysctl.

Differential Revision: https://phabricator.services.mozilla.com/D116725
2021-07-27 16:17:43 +00:00
Iulian Moraru ee9e1dd7c0 Backed out changeset 4f0fe70a0e34 (bug 1714382) for causing assertion failures on nsCycleCollector.cpp. CLOSED TREE 2021-07-27 02:48:53 +03:00
Haik Aftandilian b00b0d585c Bug 1714382 - Include the Mac memory pressure state in crash reports r=spohl,KrisWright
Subscribe to memory pressure events on macOS and add crash report annotations to parent and content process crash reports that can be used to determine if the system was under memory pressure at the time of the crash.

Include the memory pressure level reported via the DISPATCH_SOURCE_TYPE_MEMORYPRESSURE dispatch with timestamps of transitions, the memory pressure level as read from the kern.memorystatus_vm_pressure_level sysctl, and a measurement of the percentage of available memory in the system read from the kern.memorystatus_level sysctl.

Differential Revision: https://phabricator.services.mozilla.com/D116725
2021-07-26 22:52:33 +00:00
Kris Maglione 3ee95f8b32 Bug 1716849: Add crash annotation for error when aborting for failed module import. r=mccr8
There are a number of modules that we import from C++ and can't continue
running without. We have a number of crashes for some of those failed loads. A
lot of them are from OOMs or corruption, but we're not sure about the rest.

This patch adds a crash annotation with the details of the error wherever we
abort for failing to load a module.

Differential Revision: https://phabricator.services.mozilla.com/D120290
2021-07-22 16:58:02 +00:00
Butkovits Atila f1369e39ea Backed out changeset ef812b3d914d (bug 1716849) for causing assertion failures at nsImportModule.cpp. CLOSED TREE 2021-07-22 06:49:23 +03:00
Kris Maglione f69238e72d Bug 1716849: Add crash annotation for error when aborting for failed module import. r=mccr8
There are a number of modules that we import from C++ and can't continue
running without. We have a number of crashes for some of those failed loads. A
lot of them are from OOMs or corruption, but we're not sure about the rest.

This patch adds a crash annotation with the details of the error wherever we
abort for failing to load a module.

Differential Revision: https://phabricator.services.mozilla.com/D120290
2021-07-22 01:28:22 +00:00
Gabriele Svelto a0fd5f1159 Bug 1658831 - Implement a writer for the thread names' minidump stream on macOS r=Gankra
Also adds basic parsing and printing support for the stream.

Differential Revision: https://phabricator.services.mozilla.com/D118927
2021-07-06 17:04:08 +00:00
Gabriele Svelto c0b016ad02 Bug 1718226 - Only capture crash reports for fatal exceptions intercepted via WER r=KrisWright
Our Windows Error Reporting runtime module seems to be notified of all
sorts of non-fatal exceptions. Since there is no documentation clarifying
how to tell them apart from actual crashes we'll try using the bIsFatal
field in the WER_RUNTIME_EXCEPTION_INFORMATION structure for this
purpose. There is no documentation describing the contents of the field
so we can only assume that what its name implies is what we're looking
for.

Differential Revision: https://phabricator.services.mozilla.com/D118813
2021-07-06 17:03:11 +00:00
Emilio Cobos Álvarez e150976c0e Bug 1719146 - Use size_t in breakpad's Linux exception handler. r=gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D119083
2021-07-05 11:59:34 +00:00
Gabriele Svelto c61f6033ff Bug 1035892 - Handle 64-bit addresses for EXC_BAD_ACCESS exceptions on Mac r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D24356
2021-06-22 10:31:22 +00:00
Valentin Gosu daedfd16fa Bug 1716543 - Annotate nsStandardURL::SanityCheck with URL offsets r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D117894
2021-06-17 11:14:17 +00:00
Christoph Kerschbaumer 54389c7bbb Bug 1716556: Remove unused crash annotation for loadinfo in nsIOService r=valentin DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D117902
2021-06-15 14:53:21 +00:00
Mitchell Hentges e389cc4cc4 Bug 1714684: Remove usages of vendored "mock" library r=perftest-reviewers,ahal,sparky
Python 3 has access to `unittest.mock` in the standard library.

Differential Revision: https://phabricator.services.mozilla.com/D117073
2021-06-14 15:34:46 +00:00
Gabriele Svelto 7cf5a3af6f Bug 1711418 - Record the OOM allocation size in WER crashes r=KrisWright
This patch adds a new field to the structures that WER reads from a
crashed process. This field contains a pointer to the global variable
that records the size of the last failed annotation.

When WER intercepts a crash it will use this address to read the
variable. If it's not zero it will add the corresponding annotation
to the crash report.

Depends on D116449

Differential Revision: https://phabricator.services.mozilla.com/D116450
2021-06-11 09:59:51 +00:00
Gabriele Svelto 910fd19b94 Bug 1711418 - Factorize the code that reads/writes memory to/from other processes r=KrisWright
Depends on D116017

Differential Revision: https://phabricator.services.mozilla.com/D116449
2021-06-11 09:59:50 +00:00
Gabriele Svelto 4bdb354ea7 Bug 1703761 - Flag crash reports intercepted by WER with a special annotation r=KrisWright
Since this added the new flag to the crash ping I also took the time to update
the crash ping documentation with all the flags that have been added and
removed over the last few versions of Firefox.

Depends on D115380

Differential Revision: https://phabricator.services.mozilla.com/D116017
2021-06-11 09:59:50 +00:00
Gabriele Svelto 74d553df16 Bug 1682518 - Add minidump generation for child processes in the WER module r=KrisWright
This also notifies the main process after the minidump has been generated.
I refactored the code a bit so the patch is probably larger than it should be
but the code should be a bit more readable overall.

With this change the minidump generation flow works like this:
- When the callback gets invoked in the WER process we read the structure that
  is stored in every process' to figure out if it's the main process or a child
  one. This is done by reading said process' memory, the pointer has been
  passed to the runtime exception module when it was registered.
- If the main process crashed everything works like it used to.
- If it was a child process then we first capture a minidump of it.
- Then we read the structure representing it in the main process:
  WindowsErrorReportingData. The address of this structure was passed into the
  child process' command-line so we need to parse that first, then we read it
  from the main process memory.
- We fill the structure and write it back into the main process memory.
- At this point if everything went fine we create a new thread in the main
  process just to execute the WerNotifyProc function that will inform the main
  process to the presence of the new minidump.

There's one important tidbit that's worth keeping in mind: the synchronization
between the main process and the WER process is implicit. The
WindowsErrorReportingData structure in the main process is kept alive until the
child process dies, the main process will destroy it only after that point. As
long as we're in the runtime exception module the crashed process is kept alive
so this will prevent the main process from touching that structure.
We explicitly terminate the crashed process **after** we're done with the
structure so nothing bad could happen... unless someone makes a change to
Gecko that breaks the previous assumption.

Another important thing to keep in mind: we wait for the newly created thread
to inform the main process but only for 5 seconds. We don't want to wait
indefinitely because the function that we're calling is taking a lock and if
it blocks for some reason WER will get stuck waiting for it, so it will never
kill the crashed process which in turn will prevent the main process from
moving ahead. In principle this should never happen but better be safe than
sorry.

Depends on D115379

Differential Revision: https://phabricator.services.mozilla.com/D115380
2021-06-11 09:59:50 +00:00
Gabriele Svelto a7c337103a Bug 1697895 - Register the WER runtime exception module in child processes r=KrisWright
This patch sets up a few different things that will be used by the WER runtime
exception module when it needs to notify the main process of a child process
crash.

For every child process we allocate a structure in the main process called
WindowsErrorReportingData that contains three things:
- The address of the function used to notify the main process that there's a
  pending minidump for a given child process
- The PID of said child process
- The name of the minidump that has been generated

The first field is filled up by the main process and will be read by the WER
process when running the runtime exception module, the second and third fields
on the other hand start empty and will be written into by the runtime exception
module after it has generated a minidump.

I know this sounds scary. It is. But bear with me please.

When we register the runtime exception module we can pass it a single
pointer-sized parameter but we need to pass it at least another pointer that
includes data coming from the child process itself (this one is called
InProcessWindowsErrorReportingData). This data currently includes only the
process type but will also include certain annotations in the future
(e.g. bug 1711418). So here's what we do: we store a pointer to the parent
data structure in the child process command-line (cringe) and we read it
from the runtime exception module by reading the crashed process command-line
arguments and parsing them (double-cringe).

Armed with this information the WER runtime exception module can populate
the info for the generated minidump and then push it into the main process
by calling CreateRemoteThread() (which creates a new thread in the main
process, triple-cringe at this point).

Differential Revision: https://phabricator.services.mozilla.com/D115379
2021-06-11 09:59:49 +00:00
Iulian Moraru d5be2d4af2 Backed out 5 changesets (bug 1682518, bug 1703761, bug 1711418, bug 1697895) for causing build bustages on nsEmbedFunctions.cpp. CLOSED TREE
Backed out changeset d747dd950198 (bug 1711418)
Backed out changeset 58092e594233 (bug 1711418)
Backed out changeset d9b5dd9f7307 (bug 1703761)
Backed out changeset 345c36d8e46b (bug 1682518)
Backed out changeset a9be55acfd91 (bug 1697895)
2021-06-11 07:08:38 +03:00
Gabriele Svelto eba562c428 Bug 1711418 - Record the OOM allocation size in WER crashes r=KrisWright
This patch adds a new field to the structures that WER reads from a
crashed process. This field contains a pointer to the global variable
that records the size of the last failed annotation.

When WER intercepts a crash it will use this address to read the
variable. If it's not zero it will add the corresponding annotation
to the crash report.

Depends on D116449

Differential Revision: https://phabricator.services.mozilla.com/D116450
2021-06-10 22:01:33 +00:00
Gabriele Svelto 1c333668d4 Bug 1711418 - Factorize the code that reads/writes memory to/from other processes r=KrisWright
Depends on D116017

Differential Revision: https://phabricator.services.mozilla.com/D116449
2021-06-10 22:01:33 +00:00
Gabriele Svelto 1ed394a645 Bug 1703761 - Flag crash reports intercepted by WER with a special annotation r=KrisWright
Since this added the new flag to the crash ping I also took the time to update
the crash ping documentation with all the flags that have been added and
removed over the last few versions of Firefox.

Depends on D115380

Differential Revision: https://phabricator.services.mozilla.com/D116017
2021-06-10 22:01:33 +00:00
Gabriele Svelto 896f9b03cb Bug 1682518 - Add minidump generation for child processes in the WER module r=KrisWright
This also notifies the main process after the minidump has been generated.
I refactored the code a bit so the patch is probably larger than it should be
but the code should be a bit more readable overall.

With this change the minidump generation flow works like this:
- When the callback gets invoked in the WER process we read the structure that
  is stored in every process' to figure out if it's the main process or a child
  one. This is done by reading said process' memory, the pointer has been
  passed to the runtime exception module when it was registered.
- If the main process crashed everything works like it used to.
- If it was a child process then we first capture a minidump of it.
- Then we read the structure representing it in the main process:
  WindowsErrorReportingData. The address of this structure was passed into the
  child process' command-line so we need to parse that first, then we read it
  from the main process memory.
- We fill the structure and write it back into the main process memory.
- At this point if everything went fine we create a new thread in the main
  process just to execute the WerNotifyProc function that will inform the main
  process to the presence of the new minidump.

There's one important tidbit that's worth keeping in mind: the synchronization
between the main process and the WER process is implicit. The
WindowsErrorReportingData structure in the main process is kept alive until the
child process dies, the main process will destroy it only after that point. As
long as we're in the runtime exception module the crashed process is kept alive
so this will prevent the main process from touching that structure.
We explicitly terminate the crashed process **after** we're done with the
structure so nothing bad could happen... unless someone makes a change to
Gecko that breaks the previous assumption.

Another important thing to keep in mind: we wait for the newly created thread
to inform the main process but only for 5 seconds. We don't want to wait
indefinitely because the function that we're calling is taking a lock and if
it blocks for some reason WER will get stuck waiting for it, so it will never
kill the crashed process which in turn will prevent the main process from
moving ahead. In principle this should never happen but better be safe than
sorry.

Depends on D115379

Differential Revision: https://phabricator.services.mozilla.com/D115380
2021-06-10 22:01:32 +00:00
Gabriele Svelto 1a86d1dee4 Bug 1697895 - Register the WER runtime exception module in child processes r=KrisWright
This patch sets up a few different things that will be used by the WER runtime
exception module when it needs to notify the main process of a child process
crash.

For every child process we allocate a structure in the main process called
WindowsErrorReportingData that contains three things:
- The address of the function used to notify the main process that there's a
  pending minidump for a given child process
- The PID of said child process
- The name of the minidump that has been generated

The first field is filled up by the main process and will be read by the WER
process when running the runtime exception module, the second and third fields
on the other hand start empty and will be written into by the runtime exception
module after it has generated a minidump.

I know this sounds scary. It is. But bear with me please.

When we register the runtime exception module we can pass it a single
pointer-sized parameter but we need to pass it at least another pointer that
includes data coming from the child process itself (this one is called
InProcessWindowsErrorReportingData). This data currently includes only the
process type but will also include certain annotations in the future
(e.g. bug 1711418). So here's what we do: we store a pointer to the parent
data structure in the child process command-line (cringe) and we read it
from the runtime exception module by reading the crashed process command-line
arguments and parsing them (double-cringe).

Armed with this information the WER runtime exception module can populate
the info for the generated minidump and then push it into the main process
by calling CreateRemoteThread() (which creates a new thread in the main
process, triple-cringe at this point).

Differential Revision: https://phabricator.services.mozilla.com/D115379
2021-06-10 22:01:32 +00:00
surajeet310 6ea83c8ef9 Bug 1714788 - Fixed more Sphinx warnings in 'mach doc' r=sylvestre DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D117419
2021-06-10 19:33:53 +00:00
Brindusan Cristian df90ffe9bc Backed out 5 changesets (bug 1697895, bug 1682518, bug 1703761, bug 1711418) for causing Windows 2012 x64 asan buid bustages.
CLOSED TREE

Backed out changeset 4cc2cb3653f2 (bug 1711418)
Backed out changeset 02cf2dc4c3c8 (bug 1711418)
Backed out changeset ca35e73d9445 (bug 1703761)
Backed out changeset 43c12d3f5c4f (bug 1682518)
Backed out changeset d75aef90ac53 (bug 1697895)
2021-06-10 16:30:44 +03:00
Gabriele Svelto 99cd0eae3d Bug 1711418 - Record the OOM allocation size in WER crashes r=KrisWright
This patch adds a new field to the structures that WER reads from a
crashed process. This field contains a pointer to the global variable
that records the size of the last failed annotation.

When WER intercepts a crash it will use this address to read the
variable. If it's not zero it will add the corresponding annotation
to the crash report.

Depends on D116449

Differential Revision: https://phabricator.services.mozilla.com/D116450
2021-06-10 11:58:38 +00:00