mktime() does not work under Linux sandbox |
||
Issue descriptionIt 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.
,
Nov 30 2016
+rsesek because he knows things.
,
Dec 2 2016
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 |
||
Comment 1 by eroman@chromium.org
, Nov 17 2016