lewisje / address-sanitizer

Automatically exported from code.google.com/p/address-sanitizer
0 stars 0 forks source link

kMaxNumberOfAddressRanges can be too small on OS X when loading code at runtime with NSLinkModule #368

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When sanitizers are creating a list of loaded modules and their address ranges, 
we have a limit of ranges per module in sanitizer_common.h:

  static const uptr kMaxNumberOfAddressRanges = 6;

and when we reach this limit, we crash. On OS X, there is a NSLinkModule API 
that can be used to dynamically add a module in runtime, and since such a 
module is not backed by a file on disk, you can specify the name of this 
module. If you specify the same name for several modules, it is treated by the 
sanitizer memory mapper as a single module, and you can then reach the limit.

Although NSLinkModule and associated APIs are deprecated, they are still being 
used by other code, namely by OpenCL to compile and load OpenCL image kernels 
at runtime.

Attaching a test case to reproduce this.

Original issue reported on code.google.com by kuba.brecka@gmail.com on 8 Jan 2015 at 5:24

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Kuba,

Thanks for reporting. Could you check if r225469 fixes this problem?

Original comment by samso...@google.com on 8 Jan 2015 at 10:05

GoogleCodeExporter commented 9 years ago
Yes it does. I added the regression test in r225484.

Original comment by kuba.brecka@gmail.com on 9 Jan 2015 at 12:28

GoogleCodeExporter commented 9 years ago

Original comment by samso...@google.com on 9 Jan 2015 at 12:29

GoogleCodeExporter commented 9 years ago
Adding Project:AddressSanitizer as part of GitHub migration.

Original comment by ramosian.glider@gmail.com on 30 Jul 2015 at 9:14