Closed tmbrbr closed 2 years ago
After digging around, it seems like this (and a lot of the taint test failures) is actually due to deduplication of strings in the Garbage Collector.
When moving String to Tenured memory:
https://github.com/SAP/project-foxhound/blob/main/js/src/gc/Tenuring.cpp#L691
The GC tries to deduplicate them first. As the taint is not used to compare strings, the GC was finding a match for the single char l
and deduplicating it so that both objects point to the same content, in this case the tainted version of the string.
The fix for this is to prevent deduplication of tainted Strings.
Foxhound contains a small number of regression tests for SpiderMonkey to make sure tainting is still working:
While trying to debug these tests, I noticed something strange was going on while running the atom tests:
https://github.com/SAP/project-foxhound/blob/main/js/src/tests/taint/atoms.js
When splitting a string into an array of chars, there was some confusion between tainted and untainted strings, e.g.:
So the char
l
is actually tainted in both arrays. Note that this only occurs after a number of iterations of the test function, not immediately.