Reland "Skip stale filehandle in proc_util.cc"
This reverts commitebfd5a5979
. Reason for revert: Initializing the "uninitialized" variable Original change's description: > Revert "Skip stale filehandle in proc_util.cc" > > This reverts commitdc1fb3ffda
. > > Reason for revert: > LUCI Bisection has identified this change as the cause of a test failure. See the analysis: https://ci.chromium.org/ui/p/chromium/bisection/test-analysis/b/5091314988220416 > > Sample build with failed test: https://ci.chromium.org/b/8724836128577596785 > Affected test(s): > [ninja://chrome/test:browser_tests/OpticalCharacterRecognizerTest.PerformOCR_PdfMetrics/All.OCR_Enabled_Library_Available](https://ci.chromium.org/ui/test/chromium/ninja:%2F%2Fchrome%2Ftest:browser_tests%2FOpticalCharacterRecognizerTest.PerformOCR_PdfMetrics%2FAll.OCR_Enabled_Library_Available?q=VHash%3A15e8c90d55ca90bb) > > If this is a false positive, please report it at http://b.corp.google.com/createIssue?component=1199205&description=Analysis%3A+https%3A%2F%2Fci.chromium.org%2Fui%2Fp%2Fchromium%2Fbisection%2Ftest-analysis%2Fb%2F5091314988220416&format=PLAIN&priority=P3&title=Wrongly+blamed+https%3A%2F%2Fchromium-review.googlesource.com%2Fc%2Fchromium%2Fsrc%2F%2B%2F5973241&type=BUG > > Original change's description: > > Skip stale filehandle in proc_util.cc > > > > This fixes a crash in the sandbox when running tests in Cider. > > > > Also remove the is_cog() function from test_env.py, as it is no > > longer needed. > > > > Bug: 362595425, 347350045 > > Change-Id: I63d28d2f0fbf39ba0d22be7ac88e140768f33171 > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5973241 > > Reviewed-by: Ben Pastene <bpastene@chromium.org> > > Commit-Queue: Gary Tong <gatong@chromium.org> > > Reviewed-by: Matthew Denton <mpdenton@chromium.org> > > Cr-Commit-Position: refs/heads/main@{#1411004} > > > > Bug: 362595425, 347350045 > Change-Id: I2ef44348b968254882c258ced25a928a3cb5c85f > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6199173 > Reviewed-by: Ben Pastene <bpastene@chromium.org> > Commit-Queue: Gary Tong <gatong@chromium.org> > Reviewed-by: Matthew Denton <mpdenton@chromium.org> > Cr-Commit-Position: refs/heads/main@{#1411450} Bug: 362595425, 347350045 Change-Id: Idc480fb3b34c9637e26a458ced5dbac2175e2115 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6207410 Reviewed-by: Matthew Denton <mpdenton@chromium.org> Commit-Queue: Gregory Guterman <guterman@google.com> Reviewed-by: Ben Pastene <bpastene@chromium.org> Cr-Commit-Position: refs/heads/main@{#1412549}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
c5a4f0207f
commit
19268dbf59
@ -94,7 +94,19 @@ bool ProcUtil::HasOpenDirectory(int proc_fd) {
|
||||
|
||||
struct stat s;
|
||||
// It's OK to use proc_self_fd here, fstatat won't modify it.
|
||||
PCHECK(fstatat(proc_self_fd, de->d_name, &s, 0) == 0);
|
||||
int stat_res = fstatat(proc_self_fd, de->d_name, &s, 0);
|
||||
// Check for stale symlinks and skip them if they meet certain criteria.
|
||||
// See crbug.com/362595425
|
||||
char filename[PATH_MAX] = {}; // Initialize for robustness
|
||||
if (stat_res == -1 && errno == ESTALE && de->d_type == DT_LNK &&
|
||||
readlinkat(proc_self_fd, de->d_name, filename, sizeof(filename)) !=
|
||||
-1) {
|
||||
static constexpr std::string_view kStalePrefix = "/google/cog/";
|
||||
if (strncmp(filename, kStalePrefix.data(), kStalePrefix.size()) == 0) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
PCHECK(stat_res == 0);
|
||||
if (S_ISDIR(s.st_mode)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -38,16 +38,6 @@ def fix_python_path(cmd):
|
||||
return out
|
||||
|
||||
|
||||
# TODO: crbug.com/362595425 - Remove once Cog supports sandboxing. This is a
|
||||
# workaround to handle a crash caused by sandbox when running
|
||||
# content_browsertests in Cider.
|
||||
def is_sandboxed_on_cog(cmd):
|
||||
"""Checks the environment is cog."""
|
||||
return cmd.endswith('content_browsertests') and os.getcwd().startswith(
|
||||
'/google/cog/cloud')
|
||||
|
||||
|
||||
|
||||
def get_sanitizer_env(asan, lsan, msan, tsan, cfi_diag):
|
||||
"""Returns the environment flags needed for sanitizer tools."""
|
||||
|
||||
@ -389,7 +379,7 @@ def run_executable(cmd, env, stdoutfile=None, cwd=None):
|
||||
if asan or lsan or msan or tsan or cfi_diag:
|
||||
extra_env.update(get_sanitizer_env(asan, lsan, msan, tsan, cfi_diag))
|
||||
|
||||
if lsan or tsan or is_sandboxed_on_cog(cmd[0]):
|
||||
if lsan or tsan:
|
||||
# LSan and TSan are not sandbox-friendly.
|
||||
cmd.append('--no-sandbox')
|
||||
|
||||
|
Reference in New Issue
Block a user