Login
Log in using an SSO provider:
Fedora Account System
Red Hat Associate
Red Hat Customer
Login using a Red Hat Bugzilla account
Forgot Password
Create an Account
Red Hat Bugzilla – Attachment 1190498 Details for
Bug 1366730
dyninst: TLS access crashes if process is single-threaded
Home
New
Search
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh90 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
[?]
This site requires JavaScript to be enabled to function correctly, please enable it.
dyninst-single-thread.cpp
dyninst-single-thread.cpp (text/plain), 1.94 KB, created by
Florian Weimer
on 2016-08-12 16:09:36 UTC
(
hide
)
Description:
dyninst-single-thread.cpp
Filename:
MIME Type:
Creator:
Florian Weimer
Created:
2016-08-12 16:09:36 UTC
Size:
1.94 KB
patch
obsolete
>#include <dyninst/PCProcess.h> >#include <dyninst/Symtab.h> >#include <dyninst/Variable.h> > >#include <stdlib.h> >#include <err.h> >#include <stdio.h> > >int >main(int argc, char **argv) >{ > if (argc != 2) { > fprintf(stderr, "usage: %s PID\n", argv[0]); > return 1; > } > > int pid = atoi(argv[1]); > if (pid <= 0) { > fprintf(stderr, "error: invalid PID: %s\n", argv[1]); > return 2; > } > > Dyninst::ProcControlAPI::Process::ptr proc > {Dyninst::ProcControlAPI::Process::attachProcess(pid)}; > for (const auto library : proc->libraries()) { > printf("Library: %s\n", library->getName().c_str()); > > // Obtain the TLS variable offset. > Dyninst::Offset tls_offset{}; > { > Dyninst::SymtabAPI::Symtab *symtab; > if (!Dyninst::SymtabAPI::Symtab::openFile > (symtab, library->getAbsoluteName())) { > errx(1, "could not open %s", argv[0]); > } > std::vector<Dyninst::SymtabAPI::Variable *> vars; > if (!symtab->findVariablesByName(vars, "__libc_tsd_MALLOC") > || vars.empty()) { > if (!symtab->findVariablesByName(vars, "thread_arena") > || vars.empty()) { > continue; > } > } > bool found = false; > for (auto var : vars) { > if (var->getFirstSymbol()->getType() == Dyninst::SymtabAPI::Symbol::ST_TLS) { > tls_offset = var->getOffset(); > found = true; > break; > } > } > if (!found) { > errx(1, "TLS variable not found (2)"); > } > } > printf(" TLS variable offset: %llx\n", (unsigned long long) tls_offset); > > for (const auto thread : proc->threads()) { > printf("Thread %llx: %d\n", (unsigned long long)thread->getTID(), > thread->isRunning()); > uintptr_t tls_value{}; > if (!thread->readThreadLocalMemory > (&tls_value, library, tls_offset, sizeof(tls_value))) { > errx(1, "could not read TLS variable\n"); > } > printf(" variable: %llx\n", (unsigned long long) tls_value); > } > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1366730
: 1190498