All of lore.kernel.org
 help / color / mirror / Atom feed
* [Powertop] [PATCH] Fix string null termination and SIGABRT from glibc
@ 2012-09-26  9:04 Mikko Rapeli
  0 siblings, 0 replies; 3+ messages in thread
From: Mikko Rapeli @ 2012-09-26  9:04 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 15748 bytes --]

According to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=682388
the string is not null terminated when too much data is read.

This patch fixes the crashes for me. My traces:

PowerTOP 2.1      Overview   Idle stats   Frequency stats   Device stats   Tunab

          Package   |            CPU 0
POLL        0.0%    | POLL        0.0%    0.0 ms
C1          0.0%    | C1          0.0%    0.0 ms
C2          3.8%    | C2          5.4%    0.2 ms
C3         12.4%    | C3         20.9%    1.7 ms

                    |            CPU 1
                    | POLL        0.0%    0.0 ms
                    | C1          0.0%    0.2 ms
                    | C2          2.2%    0.2 ms
                    | C3          3.8%    0.9 ms

*** stack smashing detected ***: /usr/local/sbin/powertop terminated
                                                                    ======= Backtrace: =========
                /lib/i386-linux-gnu/i686/cmov/libc.so.6(__fortify_fail+0x50)[0xb7d7be70]
        /lib/i386-linux-gnu/i686/cmov/libc.so.6(+0xe4e1a)[0xb7d7be1a]
                                                                     /usr/local/sbin/powertop[0x8067a01]
<ESC> Exit |            /usr/local/sbin/powertop[0x8067ce7]
                                                           /usr/local/sbin/powertop[0x806b727]
              /usr/local/sbin/powertop[0x8070d62]
                                                 /usr/local/sbin/powertop[0x806c2e6]
    /usr/local/sbin/powertop[0x8089ecf]
                                       /usr/local/sbin/powertop[0x804df42]
                                                                          /lib/i386-linux-gnu/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0xb7cade46]
                                                                     /usr/local/sbin/powertop[0x804e0f1]
                        ======= Memory map: ========
                                                    08048000-080af000 r-xp 00000000 08:02 2336756    /usr/local/sbin/powertop
                                             080af000-080b0000 rw-p 00067000 08:02 2336756    /usr/local/sbin/powertop
                                      080b0000-1022a000 rw-p 00000000 00:00 0          [heap]
             b68c6000-b69c7000 rw-p 00000000 00:00 0
                                                     b6aaa000-b6acb000 rw-p 00000000 00:00 0
             b6acb000-b6b4c000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
     b6b4c000-b6bcd000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                                                                             b6bcd000-b6c4e000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                                                                     b6c4e000-b6ccf000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                                                             b6ccf000-b6d50000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                                                     b6d50000-b6dd1000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                                             b6dd1000-b6e52000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                                     b6e52000-b6ed3000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                             b6ed3000-b6f54000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                     b6f54000-b6fd5000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
             b6fd5000-b7056000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
     b7056000-b70d7000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                                                                             b70d7000-b7158000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                                                                     b7158000-b71d9000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                                                             b71d9000-b725a000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                                                     b725a000-b72db000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                                             b72db000-b735c000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                                     b735c000-b73dd000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                             b73dd000-b745e000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                     b745e000-b74df000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
             b74df000-b7560000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
     b7560000-b75e1000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                                                                             b75e1000-b7662000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                                                                     b7662000-b76e3000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                                                             b76e3000-b7764000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                                                     b7764000-b77e5000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                                             b77e5000-b7866000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                                     b7866000-b78e7000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                             b78e7000-b7968000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                     b7968000-b79e9000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
             b79e9000-b7a6a000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
     b7a6a000-b7aeb000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
                                                                             b7aeb000-b7c62000 r--p 00000000 08:02 2621607    /usr/lib/locale/locale-archive
                                                                            b7c62000-b7c65000 rw-p 00000000 00:00 0
                                    b7c65000-b7c67000 r-xp 00000000 08:02 632012     /lib/i386-linux-gnu/i686/cmov/libdl-2.13.so
                                                b7c67000-b7c68000 r--p 00001000 08:02 632012     /lib/i386-linux-gnu/i686/cmov/libdl-2.13.so
                                                            b7c68000-b7c69000 rw-p 00002000 08:02 632012     /lib/i386-linux-gnu/i686/cmov/libdl-2.13.so
                                                                        b7c69000-b7c6a000 rw-p 00000000 00:00 0
                                b7c6a000-b7c7a000 r-xp 00000000 08:02 632036     /lib/i386-linux-gnu/i686/cmov/libresolv-2.13.so
                                                b7c7a000-b7c7b000 r--p 00010000 08:02 632036     /lib/i386-linux-gnu/i686/cmov/libresolv-2.13.so
                                                                b7c7b000-b7c7c000 rw-p 00011000 08:02 632036     /lib/i386-linux-gnu/i686/cmov/libresolv-2.13.so
                                                                                b7c7c000-b7c7e000 rw-p 00000000 00:00 0
                                        b7c7e000-b7c95000 r-xp 00000000 08:02 632038     /lib/i386-linux-gnu/libz.so.1.2.7
                                          b7c95000-b7c96000 r--p 00016000 08:02 632038     /lib/i386-linux-gnu/libz.so.1.2.7
                                            b7c96000-b7c97000 rw-p 00017000 08:02 632038     /lib/i386-linux-gnu/libz.so.1.2.7
                                              b7c97000-b7ded000 r-xp 00000000 08:02 632108     /lib/i386-linux-gnu/i686/cmov/libc-2.13.so
                                                         b7ded000-b7dee000 ---p 00156000 08:02 632108     /lib/i386-linux-gnu/i686/cmov/libc-2.13.so
                                                                    b7dee000-b7df0000 r--p 00156000 08:02 632108     /lib/i386-linux-gnu/i686/cmov/libc-2.13.so
                                                                               b7df0000-b7df1000 rw-p 00158000 08:02 632108     /lib/i386-linux-gnu/i686/cmov/libc-2.13.so
          b7df1000-b7df4000 rw-p 00000000 00:00 0
                                                  b7df4000-b7e10000 r-xp 00000000 08:02 630810     /lib/i386-linux-gnu/libgcc_s.so.1
                                                    b7e10000-b7e11000 rw-p 0001b000 08:02 630810     /lib/i386-linux-gnu/libgcc_s.so.1
                                                      b7e11000-b7e35000 r-xp 00000000 08:02 632046     /lib/i386-linux-gnu/i686/cmov/libm-2.13.so
                                                                 b7e35000-b7e36000 r--p 00023000 08:02 632046     /lib/i386-linux-gnu/i686/cmov/libm-2.13.so
                                                                            b7e36000-b7e37000 rw-p 00024000 08:02 632046     /lib/i386-linux-gnu/i686/cmov/libm-2.13.so
       b7e37000-b7e38000 rw-p 00000000 00:00 0
                                               b7e38000-b7f18000 r-xp 00000000 08:02 2514966    /usr/lib/i386-linux-gnu/libstdc++.so.6.0.17
                                                           b7f18000-b7f1c000 r--p 000e0000 08:02 2514966    /usr/lib/i386-linux-gnu/libstdc++.so.6.0.17
                                                                       b7f1c000-b7f1d000 rw-p 000e4000 08:02 2514966    /usr/lib/i386-linux-gnu/libstdc++.so.6.0.17
   b7f1d000-b7f24000 rw-p 00000000 00:00 0
                                           b7f24000-b7f41000 r-xp 00000000 08:02 630823     /lib/i386-linux-gnu/libtinfo.so.5.9
                                               b7f41000-b7f43000 r--p 0001c000 08:02 630823     /lib/i386-linux-gnu/libtinfo.so.5.9
                                                   b7f43000-b7f44000 rw-p 0001e000 08:02 630823     /lib/i386-linux-gnu/libtinfo.so.5.9
                                                       b7f44000-b7f75000 r-xp 00000000 08:02 630988     /lib/i386-linux-gnu/libncursesw.so.5.9
                                                              b7f75000-b7f76000 r--p 00030000 08:02 630988     /lib/i386-linux-gnu/libncursesw.so.5.9
                                                                     b7f76000-b7f77000 rw-p 00031000 08:02 630988     /lib/i386-linux-gnu/libncursesw.so.5.9
                                                                            b7f77000-b7f8c000 r-xp 00000000 08:02 631069     /lib/i386-linux-gnu/i686/cmov/libpthread-2.13.so
             b7f8c000-b7f8d000 r--p 00014000 08:02 631069     /lib/i386-linux-gnu/i686/cmov/libpthread-2.13.so
                              b7f8d000-b7f8e000 rw-p 00015000 08:02 631069     /lib/i386-linux-gnu/i686/cmov/libpthread-2.13.so
                                               b7f8e000-b7f90000 rw-p 00000000 00:00 0
       b7f90000-b7fa7000 r-xp 00000000 08:02 630877     /lib/i386-linux-gnu/libnl-3.so.200.5.2
              b7fa7000-b7fa8000 r--p 00017000 08:02 630877     /lib/i386-linux-gnu/libnl-3.so.200.5.2
                     b7fa8000-b7fa9000 rw-p 00018000 08:02 630877     /lib/i386-linux-gnu/libnl-3.so.200.5.2
                            b7fa9000-b7faa000 rw-p 00000000 00:00 0
                                                                    b7faa000-b7fae000 r-xp 00000000 08:02 630867     /lib/i386-linux-gnu/libnl-genl-3.so.200.5.2
                                                                                b7fae000-b7faf000 r--p 00003000 08:02 630867     /lib/i386-linux-gnu/libnl-genl-3.so.200.5.2
            b7faf000-b7fb0000 rw-p 00004000 08:02 630867     /lib/i386-linux-gnu/libnl-genl-3.so.200.5.2
                        b7fb0000-b7fbb000 r-xp 00000000 08:02 630812     /lib/i386-linux-gnu/libpci.so.3.1.9
                            b7fbb000-b7fbc000 r--p 0000a000 08:02 630812     /lib/i386-linux-gnu/libpci.so.3.1.9
                                b7fbc000-b7fbd000 rw-p 0000b000 08:02 630812     /lib/i386-linux-gnu/libpci.so.3.1.9
                                    b7fd6000-b7fdd000 r--s 00000000 08:02 2518433    /usr/lib/i386-linux-gnu/gconv/gconv-modules.cache
                                                      b7fdd000-b7fdf000 r--p 00000000 08:02 2892068    /usr/local/share/locale/en_US/LC_MESSAGES/powertop.mo
                                                                            b7fdf000-b7fe1000 rw-p 00000000 00:00 0
                                    b7fe1000-b7fe2000 r-xp 00000000 00:00 0          [vdso]
           b7fe2000-b7ffe000 r-xp 00000000 08:02 630935     /lib/i386-linux
Program received signal SIGABRT, Aborted.
0xb7fe1424 in __kernel_vsyscall ()
(gdb) bt full
No symbol table info available.
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
        resultvar = <optimized out>
        pid = -1210122252
        selftid = 22773
        act = {__sigaction_handler = {
            sa_handler = 0xb7fff4e4 <_rtld_global+1220>,
            sa_sigaction = 0xb7fff4e4 <_rtld_global+1220>}, sa_mask = {
            __val = {1835008, 134937032, 134519608, 3221208440, 4319,
              3221208408, 134515384, 134515200, 3221208252, 4, 3221208336,
              3084252763, 134937032, 3083678964, 3084845044, 11, 3221209724,
              3221208456, 3084371588, 55, 3221208336, 4, 0, 3221208432, 0, 2,
              3084702268, 3084702264, 3084697743, 3084697808, 230,
              3221208336}}, sa_flags = -1073758888, sa_restorer = 0xb7dce616}
        sigs = {__val = {32, 0 <repeats 31 times>}}
    fmt=0xb7dce588 "*** %s ***: %s terminated\n")
    at ../sysdeps/unix/sysv/linux/libc_fatal.c:189
        ap = <optimized out>
        fd = -1073758600
---Type <return> to continue, or q <return> to quit---
        on_2 = <optimized out>
        list = <optimized out>
        nlist = <optimized out>
        cp = <optimized out>
        written = false
    at fortify_fail.c:32
No locals.
No locals.
No symbol table info available.
No symbol table info available.
No symbol table info available.
No symbol table info available.
No symbol table info available.
No symbol table info available.
---Type <return> to continue, or q <return> to quit---
No symbol table info available.
    ubp_av=0xbffff7f4, init=0x80954e0, fini=0x80954d0, rtld_fini=0xb7ff0590,
    stack_end=0xbffff7ec) at libc-start.c:228
        result = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {-1210122252, 0, 0,
                -1073743928, 766793170, 1206313922}, mask_was_saved = 0}},
          priv = {pad = {0x0, 0x0, 0x1, 0x804e0d0}, data = {prev = 0x0,
              cleanup = 0x0, canceltype = 1}}}
        not_first_call = <optimized out>
No symbol table info available.
---
 src/process/process.cpp |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/process/process.cpp b/src/process/process.cpp
index 71f81b6..34dc68d 100644
--- a/src/process/process.cpp
+++ b/src/process/process.cpp
@@ -86,7 +86,7 @@ static void cmdline_to_string(char *str)
 
 process::process(const char *_comm, int _pid, int _tid) : power_consumer()
 {
-	char line[4096];
+	char line[4097];
 	ifstream file;
 
 	strcpy(comm, _comm);
@@ -103,6 +103,7 @@ process::process(const char *_comm, int _pid, int _tid) : power_consumer()
 		file.open(line);
 		while (file) {
 			file.getline(line, 4096);
+			line[4096] = '\0';
 			if (strstr(line, "Tgid")) {
 				char *c;
 				c = strchr(line, ':');
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Powertop] [PATCH] Fix string null termination and SIGABRT from glibc
@ 2012-09-26 13:40 Sergey Senozhatsky
  0 siblings, 0 replies; 3+ messages in thread
From: Sergey Senozhatsky @ 2012-09-26 13:40 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 16688 bytes --]

On (09/26/12 12:04), Mikko Rapeli wrote:
> Date: Wed, 26 Sep 2012 12:04:01 +0300
> From: Mikko Rapeli <mikko.rapeli(a)iki.fi>
> To: powertop(a)lists.01.org
> Cc: 682388(a)bugs.debian.org
> Subject: [Powertop] [PATCH] Fix string null termination and SIGABRT from
>  glibc
> 
> According to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=682388
> the string is not null terminated when too much data is read.
> 
> This patch fixes the crashes for me. My traces:
> 
> PowerTOP 2.1      Overview   Idle stats   Frequency stats   Device stats   Tunab
> 
>           Package   |            CPU 0
> POLL        0.0%    | POLL        0.0%    0.0 ms
> C1          0.0%    | C1          0.0%    0.0 ms
> C2          3.8%    | C2          5.4%    0.2 ms
> C3         12.4%    | C3         20.9%    1.7 ms
> 
>                     |            CPU 1
>                     | POLL        0.0%    0.0 ms
>                     | C1          0.0%    0.2 ms
>                     | C2          2.2%    0.2 ms
>                     | C3          3.8%    0.9 ms
> 
> *** stack smashing detected ***: /usr/local/sbin/powertop terminated
>                                                                     ======= Backtrace: =========
>                 /lib/i386-linux-gnu/i686/cmov/libc.so.6(__fortify_fail+0x50)[0xb7d7be70]
>         /lib/i386-linux-gnu/i686/cmov/libc.so.6(+0xe4e1a)[0xb7d7be1a]
>                                                                      /usr/local/sbin/powertop[0x8067a01]
> <ESC> Exit |            /usr/local/sbin/powertop[0x8067ce7]
>                                                            /usr/local/sbin/powertop[0x806b727]
>               /usr/local/sbin/powertop[0x8070d62]
>                                                  /usr/local/sbin/powertop[0x806c2e6]
>     /usr/local/sbin/powertop[0x8089ecf]
>                                        /usr/local/sbin/powertop[0x804df42]
>                                                                           /lib/i386-linux-gnu/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0xb7cade46]
>                                                                      /usr/local/sbin/powertop[0x804e0f1]
>                         ======= Memory map: ========
>                                                     08048000-080af000 r-xp 00000000 08:02 2336756    /usr/local/sbin/powertop
>                                              080af000-080b0000 rw-p 00067000 08:02 2336756    /usr/local/sbin/powertop
>                                       080b0000-1022a000 rw-p 00000000 00:00 0          [heap]
>              b68c6000-b69c7000 rw-p 00000000 00:00 0
>                                                      b6aaa000-b6acb000 rw-p 00000000 00:00 0
>              b6acb000-b6b4c000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>      b6b4c000-b6bcd000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                                                                              b6bcd000-b6c4e000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                                                                      b6c4e000-b6ccf000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                                                              b6ccf000-b6d50000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                                                      b6d50000-b6dd1000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                                              b6dd1000-b6e52000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                                      b6e52000-b6ed3000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                              b6ed3000-b6f54000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                      b6f54000-b6fd5000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>              b6fd5000-b7056000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>      b7056000-b70d7000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                                                                              b70d7000-b7158000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                                                                      b7158000-b71d9000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                                                              b71d9000-b725a000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                                                      b725a000-b72db000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                                              b72db000-b735c000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                                      b735c000-b73dd000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                              b73dd000-b745e000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                      b745e000-b74df000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>              b74df000-b7560000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>      b7560000-b75e1000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                                                                              b75e1000-b7662000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                                                                      b7662000-b76e3000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                                                              b76e3000-b7764000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                                                      b7764000-b77e5000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                                              b77e5000-b7866000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                                      b7866000-b78e7000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                              b78e7000-b7968000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                      b7968000-b79e9000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>              b79e9000-b7a6a000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>      b7a6a000-b7aeb000 rw-s 00000000 00:09 5025       anon_inode:[perf_event]
>                                                                              b7aeb000-b7c62000 r--p 00000000 08:02 2621607    /usr/lib/locale/locale-archive
>                                                                             b7c62000-b7c65000 rw-p 00000000 00:00 0
>                                     b7c65000-b7c67000 r-xp 00000000 08:02 632012     /lib/i386-linux-gnu/i686/cmov/libdl-2.13.so
>                                                 b7c67000-b7c68000 r--p 00001000 08:02 632012     /lib/i386-linux-gnu/i686/cmov/libdl-2.13.so
>                                                             b7c68000-b7c69000 rw-p 00002000 08:02 632012     /lib/i386-linux-gnu/i686/cmov/libdl-2.13.so
>                                                                         b7c69000-b7c6a000 rw-p 00000000 00:00 0
>                                 b7c6a000-b7c7a000 r-xp 00000000 08:02 632036     /lib/i386-linux-gnu/i686/cmov/libresolv-2.13.so
>                                                 b7c7a000-b7c7b000 r--p 00010000 08:02 632036     /lib/i386-linux-gnu/i686/cmov/libresolv-2.13.so
>                                                                 b7c7b000-b7c7c000 rw-p 00011000 08:02 632036     /lib/i386-linux-gnu/i686/cmov/libresolv-2.13.so
>                                                                                 b7c7c000-b7c7e000 rw-p 00000000 00:00 0
>                                         b7c7e000-b7c95000 r-xp 00000000 08:02 632038     /lib/i386-linux-gnu/libz.so.1.2.7
>                                           b7c95000-b7c96000 r--p 00016000 08:02 632038     /lib/i386-linux-gnu/libz.so.1.2.7
>                                             b7c96000-b7c97000 rw-p 00017000 08:02 632038     /lib/i386-linux-gnu/libz.so.1.2.7
>                                               b7c97000-b7ded000 r-xp 00000000 08:02 632108     /lib/i386-linux-gnu/i686/cmov/libc-2.13.so
>                                                          b7ded000-b7dee000 ---p 00156000 08:02 632108     /lib/i386-linux-gnu/i686/cmov/libc-2.13.so
>                                                                     b7dee000-b7df0000 r--p 00156000 08:02 632108     /lib/i386-linux-gnu/i686/cmov/libc-2.13.so
>                                                                                b7df0000-b7df1000 rw-p 00158000 08:02 632108     /lib/i386-linux-gnu/i686/cmov/libc-2.13.so
>           b7df1000-b7df4000 rw-p 00000000 00:00 0
>                                                   b7df4000-b7e10000 r-xp 00000000 08:02 630810     /lib/i386-linux-gnu/libgcc_s.so.1
>                                                     b7e10000-b7e11000 rw-p 0001b000 08:02 630810     /lib/i386-linux-gnu/libgcc_s.so.1
>                                                       b7e11000-b7e35000 r-xp 00000000 08:02 632046     /lib/i386-linux-gnu/i686/cmov/libm-2.13.so
>                                                                  b7e35000-b7e36000 r--p 00023000 08:02 632046     /lib/i386-linux-gnu/i686/cmov/libm-2.13.so
>                                                                             b7e36000-b7e37000 rw-p 00024000 08:02 632046     /lib/i386-linux-gnu/i686/cmov/libm-2.13.so
>        b7e37000-b7e38000 rw-p 00000000 00:00 0
>                                                b7e38000-b7f18000 r-xp 00000000 08:02 2514966    /usr/lib/i386-linux-gnu/libstdc++.so.6.0.17
>                                                            b7f18000-b7f1c000 r--p 000e0000 08:02 2514966    /usr/lib/i386-linux-gnu/libstdc++.so.6.0.17
>                                                                        b7f1c000-b7f1d000 rw-p 000e4000 08:02 2514966    /usr/lib/i386-linux-gnu/libstdc++.so.6.0.17
>    b7f1d000-b7f24000 rw-p 00000000 00:00 0
>                                            b7f24000-b7f41000 r-xp 00000000 08:02 630823     /lib/i386-linux-gnu/libtinfo.so.5.9
>                                                b7f41000-b7f43000 r--p 0001c000 08:02 630823     /lib/i386-linux-gnu/libtinfo.so.5.9
>                                                    b7f43000-b7f44000 rw-p 0001e000 08:02 630823     /lib/i386-linux-gnu/libtinfo.so.5.9
>                                                        b7f44000-b7f75000 r-xp 00000000 08:02 630988     /lib/i386-linux-gnu/libncursesw.so.5.9
>                                                               b7f75000-b7f76000 r--p 00030000 08:02 630988     /lib/i386-linux-gnu/libncursesw.so.5.9
>                                                                      b7f76000-b7f77000 rw-p 00031000 08:02 630988     /lib/i386-linux-gnu/libncursesw.so.5.9
>                                                                             b7f77000-b7f8c000 r-xp 00000000 08:02 631069     /lib/i386-linux-gnu/i686/cmov/libpthread-2.13.so
>              b7f8c000-b7f8d000 r--p 00014000 08:02 631069     /lib/i386-linux-gnu/i686/cmov/libpthread-2.13.so
>                               b7f8d000-b7f8e000 rw-p 00015000 08:02 631069     /lib/i386-linux-gnu/i686/cmov/libpthread-2.13.so
>                                                b7f8e000-b7f90000 rw-p 00000000 00:00 0
>        b7f90000-b7fa7000 r-xp 00000000 08:02 630877     /lib/i386-linux-gnu/libnl-3.so.200.5.2
>               b7fa7000-b7fa8000 r--p 00017000 08:02 630877     /lib/i386-linux-gnu/libnl-3.so.200.5.2
>                      b7fa8000-b7fa9000 rw-p 00018000 08:02 630877     /lib/i386-linux-gnu/libnl-3.so.200.5.2
>                             b7fa9000-b7faa000 rw-p 00000000 00:00 0
>                                                                     b7faa000-b7fae000 r-xp 00000000 08:02 630867     /lib/i386-linux-gnu/libnl-genl-3.so.200.5.2
>                                                                                 b7fae000-b7faf000 r--p 00003000 08:02 630867     /lib/i386-linux-gnu/libnl-genl-3.so.200.5.2
>             b7faf000-b7fb0000 rw-p 00004000 08:02 630867     /lib/i386-linux-gnu/libnl-genl-3.so.200.5.2
>                         b7fb0000-b7fbb000 r-xp 00000000 08:02 630812     /lib/i386-linux-gnu/libpci.so.3.1.9
>                             b7fbb000-b7fbc000 r--p 0000a000 08:02 630812     /lib/i386-linux-gnu/libpci.so.3.1.9
>                                 b7fbc000-b7fbd000 rw-p 0000b000 08:02 630812     /lib/i386-linux-gnu/libpci.so.3.1.9
>                                     b7fd6000-b7fdd000 r--s 00000000 08:02 2518433    /usr/lib/i386-linux-gnu/gconv/gconv-modules.cache
>                                                       b7fdd000-b7fdf000 r--p 00000000 08:02 2892068    /usr/local/share/locale/en_US/LC_MESSAGES/powertop.mo
>                                                                             b7fdf000-b7fe1000 rw-p 00000000 00:00 0
>                                     b7fe1000-b7fe2000 r-xp 00000000 00:00 0          [vdso]
>            b7fe2000-b7ffe000 r-xp 00000000 08:02 630935     /lib/i386-linux
> Program received signal SIGABRT, Aborted.
> 0xb7fe1424 in __kernel_vsyscall ()
> (gdb) bt full
> No symbol table info available.
>     at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
>         resultvar = <optimized out>
>         pid = -1210122252
>         selftid = 22773
>         act = {__sigaction_handler = {
>             sa_handler = 0xb7fff4e4 <_rtld_global+1220>,
>             sa_sigaction = 0xb7fff4e4 <_rtld_global+1220>}, sa_mask = {
>             __val = {1835008, 134937032, 134519608, 3221208440, 4319,
>               3221208408, 134515384, 134515200, 3221208252, 4, 3221208336,
>               3084252763, 134937032, 3083678964, 3084845044, 11, 3221209724,
>               3221208456, 3084371588, 55, 3221208336, 4, 0, 3221208432, 0, 2,
>               3084702268, 3084702264, 3084697743, 3084697808, 230,
>               3221208336}}, sa_flags = -1073758888, sa_restorer = 0xb7dce616}
>         sigs = {__val = {32, 0 <repeats 31 times>}}
>     fmt=0xb7dce588 "*** %s ***: %s terminated\n")
>     at ../sysdeps/unix/sysv/linux/libc_fatal.c:189
>         ap = <optimized out>
>         fd = -1073758600
> ---Type <return> to continue, or q <return> to quit---
>         on_2 = <optimized out>
>         list = <optimized out>
>         nlist = <optimized out>
>         cp = <optimized out>
>         written = false
>     at fortify_fail.c:32
> No locals.
> No locals.
> No symbol table info available.
> No symbol table info available.
> No symbol table info available.
> No symbol table info available.
> No symbol table info available.
> No symbol table info available.
> ---Type <return> to continue, or q <return> to quit---
> No symbol table info available.
>     ubp_av=0xbffff7f4, init=0x80954e0, fini=0x80954d0, rtld_fini=0xb7ff0590,
>     stack_end=0xbffff7ec) at libc-start.c:228
>         result = <optimized out>
>         unwind_buf = {cancel_jmp_buf = {{jmp_buf = {-1210122252, 0, 0,
>                 -1073743928, 766793170, 1206313922}, mask_was_saved = 0}},
>           priv = {pad = {0x0, 0x0, 0x1, 0x804e0d0}, data = {prev = 0x0,
>               cleanup = 0x0, canceltype = 1}}}
>         not_first_call = <optimized out>
> No symbol table info available.
> ---
>  src/process/process.cpp |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/process/process.cpp b/src/process/process.cpp
> index 71f81b6..34dc68d 100644
> --- a/src/process/process.cpp
> +++ b/src/process/process.cpp
> @@ -86,7 +86,7 @@ static void cmdline_to_string(char *str)
>


Hi,
patch looks good to me, thanks. but please do something with commit description.

	-ss

  
>  process::process(const char *_comm, int _pid, int _tid) : power_consumer()
>  {
> -	char line[4096];
> +	char line[4097];
>  	ifstream file;
>  
>  	strcpy(comm, _comm);
> @@ -103,6 +103,7 @@ process::process(const char *_comm, int _pid, int _tid) : power_consumer()
>  		file.open(line);
>  		while (file) {
>  			file.getline(line, 4096);
> +			line[4096] = '\0';
>  			if (strstr(line, "Tgid")) {
>  				char *c;
>  				c = strchr(line, ':');
> -- 
> 1.7.10.4
> 
> _______________________________________________
> PowerTop mailing list
> PowerTop(a)lists.01.org
> https://lists.01.org/mailman/listinfo/powertop
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Powertop] [PATCH] Fix string null termination and SIGABRT from glibc
@ 2012-09-26 14:08 Mikko Rapeli
  0 siblings, 0 replies; 3+ messages in thread
From: Mikko Rapeli @ 2012-09-26 14:08 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 230 bytes --]

On Wed, Sep 26, 2012 at 06:40:40AM -0700, Sergey Senozhatsky wrote:
> patch looks good to me, thanks. but please do something with commit description.

Thanks. Just copied my error output as raw but I can remove it.

-Mikko

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-26 14:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-26 13:40 [Powertop] [PATCH] Fix string null termination and SIGABRT from glibc Sergey Senozhatsky
  -- strict thread matches above, loose matches on Subject: below --
2012-09-26 14:08 Mikko Rapeli
2012-09-26  9:04 Mikko Rapeli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.