Page MenuHomePhabricator

Bug 1957749 - Detach Linux sandbox broker threads if needed to avoid memory leak.
ClosedPublic

Authored by jld on Apr 3 2025, 5:24 AM.
Referenced Files
Unknown Object (File)
Wed, Oct 15, 7:26 AM
Unknown Object (File)
Mon, Oct 13, 11:14 AM
Unknown Object (File)
Sep 14 2025, 9:40 PM
Unknown Object (File)
Aug 6 2025, 7:37 AM
Unknown Object (File)
Aug 6 2025, 7:37 AM
Unknown Object (File)
Aug 2 2025, 9:50 AM
Unknown Object (File)
Aug 2 2025, 9:50 AM
Unknown Object (File)
Jul 29 2025, 10:32 AM
Subscribers
None

Diff Detail

Event Timeline

phab-bot published this revision for review.Apr 3 2025, 5:24 AM
phab-bot changed the visibility from "Custom Policy" to "Public (No Login Required)".
phab-bot changed the edit policy from "Custom Policy" to "Restricted Project (Project)".
phab-bot removed a project: secure-revision.
gerard-majax added inline comments.
security/sandbox/linux/gtest/TestBroker.cpp
687

maybe we dont need to force terminate now? and just rely on broker = nullptr as below

720

is this enough? above we had to broker->Terminate()

This revision is now accepted and ready to land.Apr 3 2025, 5:37 AM

This revision requires a Testing Policy Project Tag to be set before landing. Please apply one of testing-approved, testing-exception-unchanged, testing-exception-ui, testing-exception-elsewhere, testing-exception-other. Tip: this Firefox add-on makes it easy!

security/sandbox/linux/gtest/TestBroker.cpp
720

That is a very good point. If I don't Terminate(), this could intermittently fail because too many threads didn't exit yet. But if I do Terminate(), then that will pthread_join the threads and the test won't be useful because it won't provoke the bug.

Maybe it wouldn't actually fail that way in practice, and maybe those earlier failures of the fd leak test were because of this memory leak and not because all of those threads were still running… but in theory it could start most or all of those 16k threads before any of them are ever scheduled.

I can't think of a good way to fix this right now, so I think I'll just disable the test and file a followup bug.

jld marked 2 inline comments as done.