Bug 961238
Summary: | LD_DEBUG=all crashes | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Jan Safranek <jsafrane> |
Component: | glibc | Assignee: | Siddhesh Poyarekar <spoyarek> |
Status: | CLOSED RAWHIDE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | high | Docs Contact: | |
Priority: | unspecified | ||
Version: | rawhide | CC: | codonell, fweimer, jakub, law, mnewsome, pfrankli, schwab, spoyarek |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | glibc-2.17-9.fc20 | Doc Type: | Bug Fix |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2013-05-14 16:53:14 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Jan Safranek
2013-05-09 08:18:20 UTC
Crashes also with glibc-2.17-8.fc20.x86_64 Pegasus merges the commandline: (gdb) list 707 void ConfigManager::mergeCommandLine(int& argc, char**& argv) 708 { 709 // Remove the command name from the command line 710 if (argc > 0) 711 { 712 memmove(&argv[0], &argv[1], (argc) * sizeof(char*)); 713 argc--; 714 } 715 The result of this is that once it does this enough number of times, the program name (argv[0]) ends up being NULL, resulting in this crash. That doesn't seem like a very nice thing to do. I guess in the dynamic linker we could simply write "<main program>" if argv[0] is NULL, but I wonder if such behaviour is allowed at all. Carlos, what do you think? You obviously have more experience with these bits than I. (In reply to comment #2) > Pegasus merges the commandline: > > (gdb) list > 707 void ConfigManager::mergeCommandLine(int& argc, char**& argv) > 708 { > 709 // Remove the command name from the command line > 710 if (argc > 0) > 711 { > 712 memmove(&argv[0], &argv[1], (argc) * sizeof(char*)); > 713 argc--; > 714 } > 715 > > The result of this is that once it does this enough number of times, the > program name (argv[0]) ends up being NULL, resulting in this crash. > > That doesn't seem like a very nice thing to do. I guess in the dynamic > linker we could simply write "<main program>" if argv[0] is NULL, but I > wonder if such behaviour is allowed at all. > > Carlos, what do you think? You obviously have more experience with these > bits than I. It's allowed by the ISO C standard. The only guarantees are (from the standard): * The value of argc shall be nonnegative. * The value argv[argc] shall be a null pointer. * If the value of argc is greater than zero, the array members argv[0] through argv[argc-1] inclusive shall contain pointers to strings, which are given implementation-defined values by the host environment prior to program start up. * If the value of argc is greater than zero, the string pointed to by argv[0] represents the program name; argv[0][0] shall be the null character if the program name is not available from the host environment. The dynamic loader should not crash, we should print something informative, but what to print is the tricky question. Printing "NULL" is not informative to users. Printing "<No program name provided>" is probably most useful. OK, thanks. Parts of the dynamic linker already writes "<main program>", so I think I'll use that. I posted the patch upstream: http://sourceware.org/ml/libc-alpha/2013-05/msg00444.html It has cleared a peer review, so I'll push it upstream once other architecture maintainers also test the changes. I've pushed the patch into rawhide for now. Please clone the bug if you need backport into any other active Fedora branches. |