Repository navigation
Fix defects found during local CI host qualification [#346] #368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -186,12 +186,33 @@ def executeInside(lane, jobs): | |
| command(["ccache", "--show-stats"]) | ||
|
|
||
|
|
||
| def mmapRandomBits(samples=96): | ||
| """Estimate vm.mmap_rnd_bits from the address span of fresh processes (the kernel file is root-only, mode 0600). | ||
| The borrow of the base address subtraction makes the span exceed the configured bits by exactly one.""" | ||
| code = "import mmap,ctypes;m=mmap.mmap(-1,4096);print(ctypes.addressof(ctypes.c_char.from_buffer(m)))" | ||
| addresses = [int(command([sys.executable, "-c", code], capture_output=True, text=True).stdout) for _ in range(samples)] | ||
| spread = 0 | ||
| for address in addresses: | ||
| spread |= address ^ addresses[0] | ||
| return spread.bit_length() - 12 - 1 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Supprimer la correction d’un bit dans le calcul de l’entropie. Si 28 bits aléatoires occupent les bits 12 à 39 et que le bit 40 reste constant,
|
||
|
|
||
|
|
||
| def hostSysctl(key): | ||
| try: | ||
| return command(["sysctl", "-n", key], capture_output=True, text=True).stdout.strip() | ||
| except subprocess.CalledProcessError: | ||
| if key != "vm.mmap_rnd_bits": | ||
| raise | ||
| # An unprivileged account cannot read it: measure the effective entropy instead. | ||
| return str(mmapRandomBits()) | ||
|
|
||
|
|
||
| def runLane(args, matrix): | ||
| lane = next(row for row in matrix["lanes"] if row["id"] == args.lane) | ||
| if not lane["runtime"].startswith("container:"): | ||
| raise ValueError("Native lanes are not implemented in delivery step 2") | ||
| for key, expected in lane.get("host_requirements", {}).get("sysctl", {}).items(): | ||
| actual = command(["sysctl", "-n", key], capture_output=True, text=True).stdout.strip() | ||
| actual = hostSysctl(key) | ||
| if actual != expected: | ||
| raise ValueError(f"Host requires {key}={expected}; found {actual}. Ask its owner to configure it.") | ||
| manifest = json.loads((ROOT / "dependencies/kit.json").read_text()) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixer un délai pour chaque processus d’échantillonnage.
Si une invocation de
sys.executablereste bloquée,commandattend sanstimeout. Le worker peut alors rester bloqué avant Docker, sans appliquerargs.timeout. Fixez un délai par échantillon et traitezsubprocess.TimeoutExpiredcomme un échec du contrôle préalable. Based on learnings: les appels Python àsubprocess.run()sanstimeoutpeuvent bloquer indéfiniment.Source: Learnings