Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort out the dl_iterate_phdr code on Linux. #72

Closed
ramosian-glider opened this issue Aug 31, 2015 · 4 comments
Closed

Sort out the dl_iterate_phdr code on Linux. #72

ramosian-glider opened this issue Aug 31, 2015 · 4 comments

Comments

@ramosian-glider
Copy link
Member

Originally reported on Google Code with ID 72

The implementation of AsanProcMaps::GetObjectNameAndOffset that uses dl_iterate_phdr
has been disabled some time ago and is not used on any configuration now.
We need to either fix the bug or remove this code.

The problem is that dl_iterate_phdr_callback assumes that the binaries are sorted by
their addresses, so the first binary that is loaded below the requested address is
taken regardless of whether the requested address falls into that binary:


237 static int dl_iterate_phdr_callback(struct dl_phdr_info *info,
238                                     size_t size, void *raw_data) {
239   DlIterateData *data = (DlIterateData*)raw_data;
240   int count = data->count++;
241   if (info->dlpi_addr > data->addr)
242     return 0;
243   if (count == 0) {
244     // The first item (the main executable) does not have a so name,
245     // but we can just read it from /proc/self/exe.
246     size_t path_len = readlink("/proc/self/exe",
247                                data->filename, data->filename_size - 1);
248     data->filename[path_len] = 0;
249   } else {
250     CHECK(info->dlpi_name);
251     REAL(strncpy)(data->filename, info->dlpi_name, data->filename_size);
252   }
253   data->offset = data->addr - info->dlpi_addr;
254   return 1;
255 }

Reported by ramosian.glider on 2012-05-22 12:06:21

@ramosian-glider
Copy link
Member Author

I vote to remove the code. 

Reported by konstantin.s.serebryany on 2012-05-22 12:08:10

@ramosian-glider
Copy link
Member Author

No sense keeping dead code. We have svn history for that.

Reported by eugenis@chromium.org on 2012-05-22 12:10:35

@ramosian-glider
Copy link
Member Author

nuked at r157250.

Reported by konstantin.s.serebryany on 2012-05-22 13:33:08

  • Status changed: Fixed

@ramosian-glider
Copy link
Member Author

Adding Project:AddressSanitizer as part of GitHub migration.

Reported by ramosian.glider on 2015-07-30 09:12:59

  • Labels added: ProjectAddressSanitizer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant