Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Issue 165011: Linux: don't use GOT patching to intercept localtime(_r) (Closed)

Created:
11 years, 4 months ago by agl
Modified:
9 years, 7 months ago
Reviewers:
Evan Martin
CC:
chromium-reviews_googlegroups.com, Markus (顧孟勤)
Visibility:
Public.

Description

Linux: don't use GOT patching to intercept localtime(_r) Our current GOT patching code is platform specific and fails to work when V8 is built as a library. Instead we define global functions for those functions which we wish to override. Since we will be first in the dynamic resolution order, the dynamic linker will point callers to our versions of these functions. However, we have the same binary for both the browser and the renderers, which means that our overrides will apply in the browser too. The global |global_am_zygote_or_renderer| is true iff we are in a zygote or renderer process. It's set in ZygoteMain and inherited by the renderers when they fork. (This means that it'll be incorrect for global constructor functions and before ZygoteMain is called - beware). Our replacement functions can check this global and either proxy the call to the browser over the sandbox IPC (http://code.google.com/p/chromium/wiki/LinuxSandboxIPC) or they can use dlsym with RTLD_NEXT to resolve the symbol, ignoring any symbols in the current module. TEST=Run javascript:alert(new Date().getTimezoneOffset()). It shouldn't return 0 unless you're actually in GMT. BUG=16800

Patch Set 1 #

Patch Set 2 : ... #

Patch Set 3 : ... #

Total comments: 4

Patch Set 4 : ... #

Unified diffs Side-by-side diffs Delta from patch set Stats (+70 lines, -57 lines) Patch
M chrome/browser/zygote_main_linux.cc View 1 2 3 5 chunks +70 lines, -57 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
agl
11 years, 4 months ago (2009-08-05 22:29:03 UTC) #1
Evan Martin
LGTM, style stuff follows http://codereview.chromium.org/165011/diff/1004/3 File chrome/browser/zygote_main_linux.cc (right): http://codereview.chromium.org/165011/diff/1004/3#newcode246 Line 246: static bool global_am_zygote_or_renderer = ...
11 years, 4 months ago (2009-08-05 22:34:47 UTC) #2
agl
11 years, 4 months ago (2009-08-05 22:54:01 UTC) #3
(have fixed the other style issues. Will commit tomorrow.)

http://codereview.chromium.org/165011/diff/1004/3
File chrome/browser/zygote_main_linux.cc (right):

http://codereview.chromium.org/165011/diff/1004/3#newcode287
Line 287: static char timezone_string[64];
On 2009/08/05 22:34:47, Evan Martin wrote:
> Does this need to be static?

Sadly, yes. localtime isn't a threadsafe function and returns a pointer to
static data.

Powered by Google App Engine
This is Rietveld 408576698