Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 312820 Details for
Bug 450011
should complain about shared objects that call exit() or _exit()
[?]
New
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.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
2nd draft
exit.patch (text/plain), 4.84 KB, created by
Ville Skyttä
on 2008-07-28 21:11:31 UTC
(
hide
)
Description:
2nd draft
Filename:
MIME Type:
Creator:
Ville Skyttä
Created:
2008-07-28 21:11:31 UTC
Size:
4.84 KB
patch
obsolete
>Index: BinariesCheck.py >=================================================================== >--- BinariesCheck.py (revision 1442) >+++ BinariesCheck.py (working copy) >@@ -34,8 +34,10 @@ > undef_regex=re.compile('^undefined symbol:\s+(\S+)') > unused_regex=re.compile('^\s+(\S+)') > debug_file_regex=re.compile('\.debug$') >+ exit_call_regex = re.compile('\s+FUNC\s+.*?\s+(_?exit(?:@\S+)?)(?:\s|$)') >+ fork_call_regex = re.compile('\s+FUNC\s+.*?\s+(fork(?:@\S+)?)(?:\s|$)') > >- def __init__(self, pkg, path, file, is_ar): >+ def __init__(self, pkg, path, file, is_ar, is_shlib): > self.had_error=0 > self.needed=[] > self.rpath=[] >@@ -46,10 +48,12 @@ > self.non_pic=1 > self.stack = 0 > self.exec_stack = 0 >+ self.exit_calls = [] >+ fork_called = 0 > > is_debug=BinaryInfo.debug_file_regex.search(path) > >- cmd = ['env', 'LC_ALL=C', 'readelf', '-W', '-S', '-l', '-d'] >+ cmd = ['env', 'LC_ALL=C', 'readelf', '-W', '-S', '-l', '-d', '-s'] > cmd.append(path) > res = Pkg.getstatusoutput(cmd) > if not res[0]: >@@ -87,8 +91,25 @@ > self.exec_stack = 1 > continue > >+ if is_shlib: >+ r = BinaryInfo.exit_call_regex.search(l) >+ if r: >+ self.exit_calls.append(r.group(1)) >+ continue >+ else: >+ r = BinaryInfo.fork_call_regex.search(l) >+ if r: >+ fork_called = 1 >+ > if self.non_pic: > self.non_pic=BinaryInfo.non_pic_regex.search(res[1]) >+ >+ # Ignore all exit() calls if fork() is being called. >+ # Does not have any context at all but without this kludge, the >+ # number of false positives would probably be intolerable. >+ if fork_called: >+ self.exit_calls = [] >+ > else: > self.had_error=1 > printWarning(pkg, 'binaryinfo-readelf-failed', >@@ -189,6 +210,7 @@ > is_ar = string.find(i[1], 'current ar archive') != -1 > is_ocaml_native = string.find(i[1], 'Objective caml native') != -1 > is_binary = is_elf or is_ar or is_ocaml_native >+ is_shlib = so_regex.search(i[0]) > > if is_binary: > binary=binary+1 >@@ -214,10 +236,10 @@ > printWarning(pkg, 'unstripped-binary-or-object', i[0]) > > # inspect binary file >- bin_info=BinaryInfo(pkg, pkg.dirName()+i[0], i[0], is_ar) >+ bin_info=BinaryInfo(pkg, pkg.dirName()+i[0], i[0], is_ar, is_shlib) > > # so name in library >- if so_regex.search(i[0]): >+ if is_shlib: > has_lib.append(i[0]) > if bin_info.had_error: > pass >@@ -254,6 +276,11 @@ > printError(pkg, 'binary-or-shlib-defines-rpath', i[0], bin_info.rpath) > break > >+ # shared lib calls exit() or _exit()? >+ if is_shlib and bin_info.exit_calls: >+ for ec in bin_info.exit_calls: >+ printWarning(pkg, 'shared-lib-calls-exit', i[0], ec) >+ > # statically linked ? > is_exec=executable_regex.search(i[1]) > if shared_object_regex.search(i[1]) or \ >@@ -291,7 +318,7 @@ > # It could be useful to check these for others than > # shared libs only, but that has potential to > # generate lots of false positives and noise. >- if so_regex.search(i[0]): >+ if is_shlib: > for s in bin_info.undef: > printWarning(pkg, 'undefined-non-weak-symbol', i[0], s) > for s in bin_info.unused: >@@ -441,6 +468,15 @@ > '''The binary lacks a PT_GNU_STACK section. This forces the dynamic linker to > make the stack executable. Usual suspects include use of a non-GNU linker or > an old GNU linker version.''', >+ >+'shared-lib-calls-exit', >+'''This library package calls exit() or _exit(), probably in a non-fork() >+context. Doing so from a library is strongly discouraged - when a library >+function calls exit(), it prevents the calling program from handling the >+error, reporting it to the user, closing files properly, and cleaning up any >+state that the program has. It is preferred for the library to return an >+actual error code and let the calling program decide how to handle the >+situation.''', > ) > > # BinariesCheck.py ends here
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 450011
:
308398
| 312820