New issue
Advanced search Search tips

Issue 666535 link

Starred by 2 users

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug

Blocking:
issue 641096



Sign in to add a comment

mktime() does not work under Linux sandbox

Project Member Reported by eroman@chromium.org, Nov 17 2016

Issue description

It looks like mktime() is effectively behaving the same as timegm() when run within a renderer process (it behaves as if your local timezone is GMT).

This is affecting FTP directory listing, as that code calls base::FromLocalExploded() from within a (sandboxed) renderer process.

FromLocalExploded() calls SysTimeFromTimeStruct() with local=true: https://cs.chromium.org/chromium/src/base/time/time_posix.cc?q=SysTimeFromTimeStruct&sq=package:chromium&dr=CSs&l=65

In my experiment when parsing dates, I get a different value on Linux depending on whether run with --no-sandbox or not.
 

Comment 1 by eroman@chromium.org, Nov 17 2016

Blocking: 641096

Comment 2 by eroman@chromium.org, Nov 30 2016

Cc: rsesek@chromium.org
+rsesek because he knows things.
I think this is because the renderer blocks all filesystem access, and mktime needs to open /etc/localtime.

% cat test.c
#include <sys/time.h>
#include <time.h>

int main() {
  struct tm t;
  mktime(&t);
}
% gcc test.c
% strace ./a.out
[snip]
open("/etc/localtime", O_RDONLY|O_CLOEXEC) = 3
[snip]

I don't know what a good solution here is. Maybe the TimeZoneMonitor in the browser should open /etc/localtime and send the fd to the renderer, so when glibc tries to open it, it gets the already-open fd?

Sign in to add a comment