Closed Bug 846471 Opened 11 years ago Closed 11 years ago

Poison NtWriteFile

Categories

(Core :: XPCOM, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla22

People

(Reporter: espindola, Assigned: espindola)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch patch (obsolete) — Splinter Review
Poisoning NtWriteFile itself is simple, but doing so causes the writing of the stacks to hit the poised NtWriteFile recursively.

To fix this, this patch generalizes the fd list we keep on OS X to be a list of "file IDs". On unix it is just the file descriptors and on windows it is now the HANDLE.
Attachment #719651 - Flags: review?(bgirard)
Attachment #719651 - Flags: review?(bgirard) → review+
Tests were failing on debug windows build since NtFileWrite is also called from printf.

https://tbpl.mozilla.org/?tree=Try&rev=2ca43e6644c9
Attachment #719651 - Attachment is obsolete: true
Attachment #720193 - Flags: review?(bgirard)
Comment on attachment 720193 [details] [diff] [review]
Also ignore stdout and stderr

Review of attachment 720193 [details] [diff] [review]:
-----------------------------------------------------------------

::: xpcom/build/mozPoisonWriteBase.cpp
@@ +275,5 @@
>  
>    PRLock *Lock;
>    {
> +    DebugFilesAutoLock lockedScope;
> +    delete &getDebugFileIDs();

This looks really nasty to me but perhaps because it's the first time I encounter code that does this. Perhaps getDebugFileIDs should return a pointer or I can just get use to this pattern.

::: xpcom/build/mozPoisonWriteWin.cpp
@@ +53,5 @@
> +
> +void AbortOnBadWrite(HANDLE aFile)
> +{
> +  static HANDLE stdoutHandle = reinterpret_cast<HANDLE>(_get_osfhandle(1));
> +  static HANDLE stderrHandle = reinterpret_cast<HANDLE>(_get_osfhandle(2));

can't we just permanently keep stdout/stderr in the debug fd?
Attachment #720193 - Flags: review?(bgirard) → review+
New try push to

https://tbpl.mozilla.org/?tree=Try&rev=77c4bb0421d0

Hopefully the tree is in good enough shape this time.
https://hg.mozilla.org/mozilla-central/rev/13f62f5274e7
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: