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

Issue 12793004: [Mac] Do not unload base::NativeLibary-ies if they contain ObjC segments. (Closed)

Created:
7 years, 9 months ago by Robert Sesek
Modified:
7 years, 9 months ago
CC:
chromium-reviews, erikwright+watch_chromium.org, sail+watch_chromium.org
Visibility:
Public.

Description

[Mac] Do not unload base::NativeLibrary-ies if they contain ObjC segments. Once an ObjC image is loaded into a process, the runtime will place unloadable data into its caches. If the bundle is unloaded, then ObjC calls could result in dereferencing memory in an unloaded module. CFBundle and NSBundle explicitly say to not unload executable bundles containing ObjC, but we were doing so anyways (oops!). BUG=172319 TEST=Verify that fixupSelectorsInMethodList crash does not happen anymore. Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=188356

Patch Set 1 #

Total comments: 31

Patch Set 2 : Address comments #

Total comments: 3

Patch Set 3 : Assume true #

Patch Set 4 : Revert Scott #

Patch Set 5 : Use _dyld functions #

Patch Set 6 : dladdr #

Total comments: 6

Patch Set 7 : fin #

Total comments: 2

Patch Set 8 : The never ending review! #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+61 lines, -17 lines) Patch
M base/native_library.h View 1 2 3 4 5 1 chunk +6 lines, -0 lines 0 comments Download
M base/native_library_mac.mm View 1 2 3 4 5 6 7 5 chunks +55 lines, -7 lines 3 comments Download
M content/ppapi_plugin/ppapi_thread.cc View 1 2 3 1 chunk +0 lines, -10 lines 0 comments Download

Messages

Total messages: 43 (0 generated)
Robert Sesek
7 years, 9 months ago (2013-03-12 19:02:20 UTC) #1
Mark Mentovai
https://codereview.chromium.org/12793004/diff/1/base/native_library.h File base/native_library.h (right): https://codereview.chromium.org/12793004/diff/1/base/native_library.h#newcode1 base/native_library.h:1: // Copyright (c) 2011 The Chromium Authors. All rights ...
7 years, 9 months ago (2013-03-12 19:19:31 UTC) #2
Robert Sesek
https://codereview.chromium.org/12793004/diff/1/base/native_library.h File base/native_library.h (right): https://codereview.chromium.org/12793004/diff/1/base/native_library.h#newcode1 base/native_library.h:1: // Copyright (c) 2011 The Chromium Authors. All rights ...
7 years, 9 months ago (2013-03-12 20:02:10 UTC) #3
Mark Mentovai
LGTM
7 years, 9 months ago (2013-03-12 20:06:53 UTC) #4
Scott Hess - ex-Googler
I agree with the notion of just having cleaner 32-bit and 64-bit versions rather than ...
7 years, 9 months ago (2013-03-12 20:10:38 UTC) #5
Robert Sesek
https://codereview.chromium.org/12793004/diff/1/base/native_library_mac.mm File base/native_library_mac.mm (right): https://codereview.chromium.org/12793004/diff/1/base/native_library_mac.mm#newcode72 base/native_library_mac.mm:72: return false; On 2013/03/12 20:10:38, shess wrote: > AFAICT, ...
7 years, 9 months ago (2013-03-12 20:19:43 UTC) #6
Scott Hess - ex-Googler
https://codereview.chromium.org/12793004/diff/1/base/native_library_mac.mm File base/native_library_mac.mm (right): https://codereview.chromium.org/12793004/diff/1/base/native_library_mac.mm#newcode72 base/native_library_mac.mm:72: return false; On 2013/03/12 20:19:43, rsesek wrote: > On ...
7 years, 9 months ago (2013-03-12 20:43:53 UTC) #7
Mark Mentovai
https://codereview.chromium.org/12793004/diff/4001/base/native_library_mac.mm File base/native_library_mac.mm (right): https://codereview.chromium.org/12793004/diff/4001/base/native_library_mac.mm#newcode27 base/native_library_mac.mm:27: task_dyld_info_data_t task_dyld_info; shess wrote: > I'm having a mental-model ...
7 years, 9 months ago (2013-03-12 20:51:02 UTC) #8
Scott Hess - ex-Googler
https://codereview.chromium.org/12793004/diff/4001/base/native_library_mac.mm File base/native_library_mac.mm (right): https://codereview.chromium.org/12793004/diff/4001/base/native_library_mac.mm#newcode27 base/native_library_mac.mm:27: task_dyld_info_data_t task_dyld_info; On 2013/03/12 20:51:03, Mark Mentovai wrote: > ...
7 years, 9 months ago (2013-03-12 20:55:00 UTC) #9
Robert Sesek
On 2013/03/12 20:43:53, shess wrote: > https://codereview.chromium.org/12793004/diff/1/base/native_library_mac.mm > File base/native_library_mac.mm (right): > > https://codereview.chromium.org/12793004/diff/1/base/native_library_mac.mm#newcode72 > ...
7 years, 9 months ago (2013-03-12 20:56:44 UTC) #10
Mark Mentovai
No, it’s not thread-safe at all.
7 years, 9 months ago (2013-03-12 20:57:18 UTC) #11
Robert Sesek
+avi for content/ to revert Scott's change
7 years, 9 months ago (2013-03-13 16:24:27 UTC) #12
Avi (use Gerrit)
lgtm okey dokey
7 years, 9 months ago (2013-03-13 16:30:24 UTC) #13
Robert Sesek
On 2013/03/13 16:30:24, Avi wrote: > lgtm > > okey dokey Thanks. Scott: am I ...
7 years, 9 months ago (2013-03-13 16:32:22 UTC) #14
Scott Hess - ex-Googler
LGTM, since Mark seemed nonchalant about the thread-safety issue...
7 years, 9 months ago (2013-03-13 16:37:48 UTC) #15
Mark Mentovai
Well, the other thing you could do is find the mach_header directly from a void* ...
7 years, 9 months ago (2013-03-13 16:45:40 UTC) #16
Scott Hess - ex-Googler
On 2013/03/13 16:45:40, Mark Mentovai wrote: > Well, the other thing you could do is ...
7 years, 9 months ago (2013-03-13 17:22:27 UTC) #17
Mark Mentovai
Here’s what it’s gonna take. 1. Instead of asking the kernel for dyld info, you ...
7 years, 9 months ago (2013-03-13 18:45:22 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/rsesek@chromium.org/12793004/16001
7 years, 9 months ago (2013-03-13 19:05:47 UTC) #19
Robert Sesek
I don't know why the CQ waited so long to pick this up… On 2013/03/13 ...
7 years, 9 months ago (2013-03-13 19:10:29 UTC) #20
Scott Hess - ex-Googler
On 2013/03/13 18:45:22, Mark Mentovai wrote: > What do you wanna do about this? I'm ...
7 years, 9 months ago (2013-03-13 19:13:22 UTC) #21
Mark Mentovai
shess@chromium.org wrote: > I'm already curled up under my desk crying. > That’s what I ...
7 years, 9 months ago (2013-03-13 19:45:12 UTC) #22
Scott Hess - ex-Googler
Well, objc-load.mm says: * objc_loadModule. * * NOTE: Loading isn't really thread safe. awesome. I'm ...
7 years, 9 months ago (2013-03-13 20:05:51 UTC) #23
Scott Hess - ex-Googler
On 2013/03/13 20:05:51, shess wrote: > Well, objc-load.mm says: > * objc_loadModule. > * > ...
7 years, 9 months ago (2013-03-13 21:20:02 UTC) #24
Robert Sesek
I've switched to the _dyld functions to avoid the system call (your #1). Thinking about, ...
7 years, 9 months ago (2013-03-14 14:07:45 UTC) #25
Mark Mentovai
I’m answering the thread-safety question that was asked. I’m not advocating any particular solution. Although ...
7 years, 9 months ago (2013-03-14 14:33:42 UTC) #26
Mark Mentovai
Patch set 5 LGTM as a non-thread-safe solution. For a thread-safe solution, of all of ...
7 years, 9 months ago (2013-03-14 14:41:33 UTC) #27
Robert Sesek
On 2013/03/14 14:41:33, Mark Mentovai wrote: > Patch set 5 LGTM as a non-thread-safe solution. ...
7 years, 9 months ago (2013-03-14 15:04:36 UTC) #28
Mark Mentovai
rsesek@chromium.org wrote: > Understood about the array stability of dyld's module list. And just > ...
7 years, 9 months ago (2013-03-14 16:09:22 UTC) #29
Robert Sesek
On 2013/03/14 16:09:22, Mark Mentovai wrote: > unless we assumed that all libraries had ObjC ...
7 years, 9 months ago (2013-03-14 17:40:33 UTC) #30
Robert Sesek
I don't like checking in known thread-unsafe things. Let's just do the dladdr thing now. ...
7 years, 9 months ago (2013-03-14 18:18:41 UTC) #31
Mark Mentovai
LGTM https://codereview.chromium.org/12793004/diff/46001/base/native_library_mac.mm File base/native_library_mac.mm (right): https://codereview.chromium.org/12793004/diff/46001/base/native_library_mac.mm#newcode85 base/native_library_mac.mm:85: "Not unloading NativeLibrary because it contains an ObjC ...
7 years, 9 months ago (2013-03-14 18:22:36 UTC) #32
Robert Sesek
https://codereview.chromium.org/12793004/diff/46001/base/native_library_mac.mm File base/native_library_mac.mm (right): https://codereview.chromium.org/12793004/diff/46001/base/native_library_mac.mm#newcode85 base/native_library_mac.mm:85: "Not unloading NativeLibrary because it contains an ObjC segment."; ...
7 years, 9 months ago (2013-03-14 18:27:38 UTC) #33
Scott Hess - ex-Googler
I like this better, and it doesn't feel any more crazy. The other approach was ...
7 years, 9 months ago (2013-03-14 18:30:39 UTC) #34
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/rsesek@chromium.org/12793004/50001
7 years, 9 months ago (2013-03-14 18:30:58 UTC) #35
Mark Mentovai
https://chromiumcodereview.appspot.com/12793004/diff/50001/base/native_library_mac.mm File base/native_library_mac.mm (right): https://chromiumcodereview.appspot.com/12793004/diff/50001/base/native_library_mac.mm#newcode85 base/native_library_mac.mm:85: << "segment. library->objc_status = " << library->objc_status; Remove the ...
7 years, 9 months ago (2013-03-14 18:32:43 UTC) #36
Robert Sesek
This review is the gift that keeps on giving. Speak now or forever hold your ...
7 years, 9 months ago (2013-03-14 20:41:25 UTC) #37
Mark Mentovai
rsesek@chromium.org wrote: > This review is the gift that keeps on giving. Speak now or ...
7 years, 9 months ago (2013-03-14 20:51:11 UTC) #38
Scott Hess - ex-Googler
lgtm Tests? :-). LGTM. https://chromiumcodereview.appspot.com/12793004/diff/64001/base/native_library_mac.mm File base/native_library_mac.mm (right): https://chromiumcodereview.appspot.com/12793004/diff/64001/base/native_library_mac.mm#newcode21 base/native_library_mac.mm:21: const void* function_pointer) { Is ...
7 years, 9 months ago (2013-03-14 21:12:53 UTC) #39
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/rsesek@chromium.org/12793004/64001
7 years, 9 months ago (2013-03-14 21:15:38 UTC) #40
Mark Mentovai
https://chromiumcodereview.appspot.com/12793004/diff/64001/base/native_library_mac.mm File base/native_library_mac.mm (right): https://chromiumcodereview.appspot.com/12793004/diff/64001/base/native_library_mac.mm#newcode21 base/native_library_mac.mm:21: const void* function_pointer) { shess wrote: > Is void* ...
7 years, 9 months ago (2013-03-14 21:17:55 UTC) #41
Scott Hess - ex-Googler
On 2013/03/14 21:17:55, Mark Mentovai wrote: > https://chromiumcodereview.appspot.com/12793004/diff/64001/base/native_library_mac.mm > File base/native_library_mac.mm (right): > > https://chromiumcodereview.appspot.com/12793004/diff/64001/base/native_library_mac.mm#newcode21 ...
7 years, 9 months ago (2013-03-14 21:26:31 UTC) #42
commit-bot: I haz the power
7 years, 9 months ago (2013-03-15 12:10:59 UTC) #43
Message was sent while issue was closed.
Change committed as 188356

Powered by Google App Engine
This is Rietveld 408576698