Backed out 3 changesets (bug 1832284) for making a failure line appear in treeherder for hazard builds. CLOSED TREE

Backed out changeset 4a6677357f72 (bug 1832284)
Backed out changeset 121223207989 (bug 1832284)
Backed out changeset 467f78dfb259 (bug 1832284)
This commit is contained in:
Iulian Moraru 2023-05-31 11:03:51 +03:00
parent 4845d0d88a
commit 4e24b562b1
5 changed files with 102 additions and 58 deletions

View File

@ -0,0 +1,79 @@
# -*- Mode: makefile -*-
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# This Makefile is used to kick off a static rooting analysis. This Makefile is
# NOT intended for use as part of the standard Mozilla build. Instead, this
# Makefile will use $PATH to subvert compiler invocations to add in the sixgill
# plugin, and then do a regular build of whatever portion of the tree you are
# analyzing. The plugins will dump out several xdb database files. Various
# analysis scripts, written in JS, will run over those database files to
# produce the final analysis output.
include $(topsrcdir)/config/config.mk
# Tree to build and analyze, defaulting to the current tree
TARGET_JSOBJDIR ?= $(TOPOBJDIR)
# Path to a JS binary to use to run the analysis. You really want this to be an
# optimized build.
JS ?= $(DIST)/bin/js
# Path to an xgill checkout containing the GCC plugin, xdb-processing binaries,
# and compiler wrapper scripts used to automatically integrate into an existing
# build system.
SIXGILL ?= @SIXGILL_PATH@
# Path to the JS scripts that will perform the analysis, defaulting to the same
# place as this Makefile.in, which is probably what you want.
ANALYSIS_SCRIPT_DIR ?= $(srcdir)
# Number of simultanous analyzeRoots.js scripts to run.
JOBS ?= 6
all : rootingHazards.txt allFunctions.txt
CALL_JS := time env PATH=$$PATH:$(SIXGILL)/bin XDB=$(SIXGILL)/bin/xdb.so $(JS)
src_body.xdb src_comp.xdb: run_complete
@echo Started compilation at $$(date)
$(ANALYSIS_SCRIPT_DIR)/run_complete --foreground --build-root=$(TARGET_JSOBJDIR) --work-dir=work -b $(SIXGILL)/bin $(CURDIR)
@echo Finished compilation at $$(date)
callgraph.txt: src_body.xdb src_comp.xdb computeCallgraph.js
@echo Started computation of $@ at $$(date)
$(CALL_JS) $(ANALYSIS_SCRIPT_DIR)/computeCallgraph.js > $@.tmp
mv $@.tmp $@
@echo Finished computation of $@ at $$(date)
gcFunctions.txt: callgraph.txt computeGCFunctions.js annotations.js
@echo Started computation of $@ at $$(date)
$(CALL_JS) $(ANALYSIS_SCRIPT_DIR)/computeGCFunctions.js ./callgraph.txt > $@.tmp
mv $@.tmp $@
@echo Finished computation of $@ at $$(date)
gcFunctions.lst: gcFunctions.txt
perl -lne 'print $$1 if /^GC Function: (.*)/' gcFunctions.txt > $@
suppressedFunctions.lst: gcFunctions.txt
perl -lne 'print $$1 if /^Suppressed Function: (.*)/' gcFunctions.txt > $@
gcTypes.txt: src_comp.xdb computeGCTypes.js annotations.js
@echo Started computation of $@ at $$(date)
$(CALL_JS) $(ANALYSIS_SCRIPT_DIR)/computeGCTypes.js > $@.tmp
mv $@.tmp $@
@echo Finished computation of $@ at $$(date)
allFunctions.txt: src_body.xdb
@echo Started computation of $@ at $$(date)
time $(SIXGILL)/bin/xdbkeys $^ > $@.tmp
mv $@.tmp $@
@echo Finished computation of $@ at $$(date)
rootingHazards.txt: gcFunctions.lst suppressedFunctions.lst gcTypes.txt analyzeRoots.js annotations.js gen-hazards.sh
@echo Started computation of $@ at $$(date)
time env JS=$(JS) ANALYZE='$(ANALYSIS_SCRIPT_DIR)/analyzeRoots.js' SIXGILL='$(SIXGILL)' '$(ANALYSIS_SCRIPT_DIR)/gen-hazards.sh' $(JOBS) > $@.tmp
mv $@.tmp $@
@echo Finished computation of $@ at $$(date)

View File

@ -12,52 +12,14 @@ from html import escape
SRCDIR = pathlib.Path(__file__).parent.parent.parent.absolute()
parser = argparse.ArgumentParser(
description="Convert the JSON output of the hazard analysis into various text files describing the results.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
parser.add_argument("--verbose", type=bool, default=False, help="verbose output")
inputs = parser.add_argument_group("Input")
inputs.add_argument(
"rootingHazards",
nargs="?",
default="rootingHazards.json",
help="JSON input file describing the output of the hazard analysis",
)
outputs = parser.add_argument_group("Output")
outputs.add_argument(
"gcFunctions",
nargs="?",
default="gcFunctions.txt",
help="file containing a list of functions that can GC",
)
outputs.add_argument(
"hazards",
nargs="?",
default="hazards.txt",
help="file containing the rooting hazards found",
)
outputs.add_argument(
"extra",
nargs="?",
default="unnecessary.txt",
help="file containing unnecessary roots",
)
outputs.add_argument(
"refs",
nargs="?",
default="refs.txt",
help="file containing a list of unsafe references to unrooted values",
)
outputs.add_argument(
"html",
nargs="?",
default="hazards.html",
help="HTML-formatted file with the hazards found",
)
parser = argparse.ArgumentParser(description="Process some integers.")
parser.add_argument("--verbose", type=bool, default=False)
parser.add_argument("rootingHazards", nargs="?", default="rootingHazards.txt")
parser.add_argument("gcFunctions", nargs="?", default="gcFunctions.txt")
parser.add_argument("hazards", nargs="?", default="hazards.txt")
parser.add_argument("extra", nargs="?", default="unnecessary.txt")
parser.add_argument("refs", nargs="?", default="refs.txt")
parser.add_argument("html", nargs="?", default="hazards.html")
args = parser.parse_args()

View File

@ -89,6 +89,9 @@ if CONFIG["FUZZING_JS_FUZZILLI"]:
# trace-pc instrumentation.
include("/tools/fuzzing/libfuzzer-config.mozbuild")
CONFIGURE_SUBST_FILES += [
"devtools/rootAnalysis/Makefile",
]
CONFIGURE_DEFINE_FILES += [
"js-confdefs.h",
]

View File

@ -1375,16 +1375,6 @@ void JSObject::swap(JSContext* cx, HandleObject a, HandleObject b,
}
}
// Restore original unique IDs.
if ((aid || bid) && (na || nb)) {
if ((aid && !gc::SetOrUpdateUniqueId(cx, a, aid)) ||
(bid && !gc::SetOrUpdateUniqueId(cx, b, bid))) {
oomUnsafe.crash("Failed to set unique ID after swap");
}
}
MOZ_ASSERT_IF(aid, gc::GetUniqueIdInfallible(a) == aid);
MOZ_ASSERT_IF(bid, gc::GetUniqueIdInfallible(b) == bid);
// Preserve the IsUsedAsPrototype flag on the objects.
if (aIsUsedAsPrototype) {
if (!JSObject::setIsUsedAsPrototype(cx, a)) {
@ -1397,6 +1387,16 @@ void JSObject::swap(JSContext* cx, HandleObject a, HandleObject b,
}
}
// Restore original unique IDs.
if ((aid || bid) && (na || nb)) {
if ((aid && !gc::SetOrUpdateUniqueId(cx, a, aid)) ||
(bid && !gc::SetOrUpdateUniqueId(cx, b, bid))) {
oomUnsafe.crash("Failed to set unique ID after swap");
}
}
MOZ_ASSERT_IF(aid, gc::GetUniqueIdInfallible(a) == aid);
MOZ_ASSERT_IF(bid, gc::GetUniqueIdInfallible(b) == bid);
/*
* We need a write barrier here. If |a| was marked and |b| was not, then
* after the swap, |b|'s guts would never be marked. The write barrier

View File

@ -121,12 +121,12 @@ function grab_artifacts () {
function check_hazards () {
(
set +e
NUM_HAZARDS=$(grep -c 'Function.*has unrooted.*live across GC call' "$1"/hazards.txt)
NUM_HAZARDS=$(grep -c 'Function.*has unrooted.*live across GC call' "$1"/rootingHazards.txt)
NUM_UNSAFE=$(grep -c '^Function.*takes unsafe address of unrooted' "$1"/refs.txt)
NUM_UNNECESSARY=$(grep -c '^Function.* has unnecessary root' "$1"/unnecessary.txt)
NUM_DROPPED=$(grep -c '^Dropped CFG' "$1"/build_xgill.log)
NUM_WRITE_HAZARDS=$(perl -lne 'print $1 if m!found (\d+)/\d+ allowed errors!' "$1"/heapWriteHazards.txt)
NUM_MISSING=$(grep -c '^Function.*expected hazard.*but none were found' "$1"/hazards.txt)
NUM_MISSING=$(grep -c '^Function.*expected hazard.*but none were found' "$1"/rootingHazards.txt)
set +x
echo "TinderboxPrint: rooting hazards<br/>$NUM_HAZARDS"