0

Linux sandbox: fix logging in SandboxBPF::DisableIBSpec()

Some of the logging in SandboxBPF::DisableIBSpec() is causing
debug-build test failures because the sandbox test code expects
no output for many tests.

This CL removes an unnecessary LOG(INFO) and changes one to a VLOG(1).

Bug: 1171027, 1206746
Change-Id: I8e255805e7aa53033205a28231ee366e03069edf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2880845
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#881297}
This commit is contained in:
Matthew Denton
2021-05-10 23:11:25 +00:00
committed by Chromium LUCI CQ
parent 2dde4571c8
commit 657d3ce7b0

@ -293,31 +293,21 @@ void SandboxBPF::DisableIBSpec() {
// misfeature will fail.
const int rv =
prctl(PR_GET_SPECULATION_CTRL, PR_SPEC_INDIRECT_BRANCH, 0, 0, 0);
// Kernel control of the speculation misfeature is not supported.
if (rv < 0) {
// Kernel control of the speculation misfeature is not supported or the
// misfeature is already force disabled.
if (rv < 0 || (rv & PR_SPEC_FORCE_DISABLE)) {
return;
}
if (!(rv & PR_SPEC_PRCTL)) {
// TODO(crbug.com/1171027): Revert https://crrev.com/c/2677242 to re-enable this
// DCHECK on CrOS. See go/chrome-dcheck-on-cros or http://crbug.com/1113456 for
// more details.
#if !(defined(OS_CHROMEOS) && DCHECK_IS_ON())
DLOG(INFO) << "Indirect branch speculation can not be controled by prctl."
<< rv;
#endif
return;
}
if (rv & PR_SPEC_FORCE_DISABLE) {
DLOG(INFO) << "Indirect branch speculation is already force disabled."
<< rv;
DVLOG(1) << "Indirect branch speculation can not be controled by prctl. "
<< rv;
return;
}
if (prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_INDIRECT_BRANCH,
PR_SPEC_FORCE_DISABLE, 0, 0)) {
DPLOG(INFO) << "Kernel failed to force disable indirect branch speculation";
PLOG(ERROR) << "Kernel failed to force disable indirect branch speculation";
}
}