-
Notifications
You must be signed in to change notification settings - Fork 33
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
top on Fedora error #1567
Comments
Here is the implementation called on Fedora: 23│ int 24│ ___sprintf_chk (char *s, int flag, size_t slen, const char *format, ...) 25│ { 26│ /* For flag > 0 (i.e. __USE_FORTIFY_LEVEL > 1) request that %n 27│ can only come from read-only format strings. */ 28│ unsigned int mode = (flag > 0) ? PRINTF_FORTIFY : 0; 29│ va_list ap; 30│ int ret; 31│ 32│ /* Regardless of the value of flag, let __vsprintf_internal know that 33│ this is a call from *printf_chk. */ 34│ mode |= PRINTF_CHK; 35│ 36│ if (slen == 0) 37│ __chk_fail (); 38│ 39| va_start (ap, format); 40│├─> ret = __vsprintf_internal (s, slen, format, ap, mode); 41│ va_end (ap); 42│ 43│ return ret; 44│ } Fixes criblio#1567
- add minimial nsterm example which reflects the issue with `top` Ref: criblio#1567
The problematic code resides in `_nc_read_entry2`. ``` char filename[PATH_MAX] ... _nc_SPRINTF(filename, _nc_SLIMIT(PATH_MAX) "%.*s", PATH_MAX - 1, name); ``` The variable `name` above is set to "xterm". In the absence of libscope.so, the aforementioned function assigns the value "xterm" to the filename variable. However, when libscope.so is loaded, the function assigns "xter" to filename. In the Fedora environment, the invocation of `__sprintf_chk` leads to the execution of `__vsprintf_internal`: ``` va_start (ap, format); ret = __vsprintf_internal(s, slen, format, ap, mode); va_end (ap); ``` On the other hand, AppScope utilizes the following call: ``` va_start(ap, format); rc = vsnprintf(str, strlen, format, ap); va_end(ap); ``` It should be noted that the implementations of `vsnprintf` and `__vsprintf_internal` differ in standard library. This commit replaces the `vsnprintf` call with `vsprintf` to address the discrepancy. Fixes criblio#1567
- add minimial nsterm example which reflects the issue with `top` Ref: criblio#1567
The problematic code resides in `_nc_read_entry2`. ``` char filename[PATH_MAX] ... _nc_SPRINTF(filename, _nc_SLIMIT(PATH_MAX) "%.*s", PATH_MAX - 1, name); ``` The variable `name` above is set to "xterm". In the absence of libscope.so, the aforementioned function assigns the value "xterm" to the filename variable. However, when libscope.so is loaded, the function assigns "xter" to filename. In the Fedora environment, the invocation of `__sprintf_chk` leads to the execution of `__vsprintf_internal`: ``` va_start (ap, format); ret = __vsprintf_internal(s, slen, format, ap, mode); va_end (ap); ``` On the other hand, AppScope utilizes the following call: ``` va_start(ap, format); rc = vsnprintf(str, strlen, format, ap); va_end(ap); ``` It should be noted that the implementations of `vsnprintf` and `__vsprintf_internal` differ in standard library. This commit replaces the `vsnprintf` call with `vsprintf` to address the discrepancy. Fixes criblio#1567
The #1572 address the issue. The root cause: The problematic code resides in
The variable In the absence of libscope.so, the aforementioned function assigns In the Fedora environment, the invocation of
On the other hand, AppScope utilizes the following call:
It should be noted that the implementations of The easiest way to test it is to try to scope |
- add minimial nsterm example which reflects the issue with `top` Ref: #1567
The problematic code resides in `_nc_read_entry2`. ``` char filename[PATH_MAX] ... _nc_SPRINTF(filename, _nc_SLIMIT(PATH_MAX) "%.*s", PATH_MAX - 1, name); ``` The variable `name` above is set to "xterm". In the absence of libscope.so, the aforementioned function assigns the value "xterm" to the filename variable. However, when libscope.so is loaded, the function assigns "xter" to filename. In the Fedora environment, the invocation of `__sprintf_chk` leads to the execution of `__vsprintf_internal`: ``` va_start (ap, format); ret = __vsprintf_internal(s, slen, format, ap, mode); va_end (ap); ``` On the other hand, AppScope utilizes the following call: ``` va_start(ap, format); rc = vsnprintf(str, strlen, format, ap); va_end(ap); ``` It should be noted that the implementations of `vsnprintf` and `__vsprintf_internal` differ in standard library. This commit replaces the `vsnprintf` call with `vsprintf` to address the discrepancy. Fixes #1567
On Fedora desktop
LD_PRELOAD=/usr/lib/appscope/libscope.so top
results in:
unknown terminal type
top does not start
The text was updated successfully, but these errors were encountered: