Modify

Opened 5 years ago

Last modified 4 years ago

#12873 new defect

[packages] psmisc component prtstat fails, only prints null zeros

Reported by: technozen <vonlogic@…> Owned by: developers
Priority: normal Milestone: Barrier Breaker 14.07
Component: packages Version: Attitude Adjustment 12.09 Beta
Keywords: psmisc prtstat nulls zeros Cc:

Description

'prtstat' binary from 'psmisc' package doesn't work, only shows zeros. Looks like a pointer bug.

Other psmisc binaries 'fuser', 'killall', 'pstree' seem to be OK.

Keen to debug this further (would help tracking other issues), please let me know how

Symptoms:

  • prtstat only displays zeros (0) or nulls, in all fields
  • does access the proper /proc file (checked with strace)
  • does not detect runtime errors (successful exit, return code 0)

example with current shell PID

# echo $$; prtstat $$
2853
Process: (null)                 State:  (unknown)
  CPU#:  0              TTY: 0:0        Threads: 0
Process, Group and Session IDs
  Process ID: 2853                Parent ID: 0
    Group ID: 0          Session ID: 0
  T Group ID: 0

Page Faults
  This Process    (minor major):        0         0
  Child Processes (minor major):        0         0
CPU Times
  This Process    (user system guest blkio):   0.00   0.00   0.00   0.00
  Child processes (user system guest):         0.00   0.00   0.00
Memory
  Vsize:       0 B
  RSS:         0 B                       RSS Limit: 0 B
  Code Start:  0                         Code Stop:  0
  Stack Start: 0
  Stack Pointer (ESP):          0        Inst Pointer (EIP):          0
Scheduling
  Policy: normal
  Nice:   0              RT Priority: 1

similar failure with raw option

# echo $$; prtstat -r $$; echo $?
2853
         pid: 2853                                comm: (null)
       state:                                     ppid: 0
        pgrp: 0                                session: 0
      tty_nr: 0                                  tpgid: 0
       flags: 0                                 minflt: 0
     cminflt: 0                                 majflt: 0
     cmajflt: 0                                  utime: 0
       stime: 0                                 cutime: 0
      cstime: 0                               priority: 0
        nice: 0                            num_threads: 0
 itrealvalue: 0                              starttime: 0
       vsize: 0                                    rss: 0
      rsslim: 0                              startcode: 0
     endcode: 0                             startstack: 0
     kstkesp: 0                                kstkeip: 0
       wchan: 0                                  nswap: 0
      cnswap: 0                            exit_signal: 0
   processor: 0                            rt_priority: 0
      policy: 0                  delayaccr_blkio_ticks: 0
  guest_time: 0                            cguest_time: 0
0

Package information:

# pkginfo psmisc      # includes prtstat
Package: psmisc
Version: 22.16-1
Depends: libc, libncurses
Provides:
Status: install user installed
Section: utils
Architecture: ar71xx
Maintainer: OpenWrt Developers Team <openwrt-devel@openwrt.org>
MD5Sum: 6a5cd6f6615783e8fecd7a19a625419f
Size: 28525
Filename: psmisc_22.16-1_ar71xx.ipk
Source: feeds/packages/utils/psmisc
Description: psmisc is a set of additional small useful utilities that use 
 the proc filesystem: fuser, killall, pstree, and prtstat
Installed-Time: 1358799782

Attachments (0)

Change History (3)

comment:1 Changed 5 years ago by technozen <vonlogic@…>

strace of prtstat of hotplug2 (pid=655) (excerpt), reading /proc/655/stat

# cat /proc/655/stat
655 (hotplug2) S 1 467 467 0 -1 4194560 2558 12103133 0 0 2254 578 20401 27057 20 0 1 0 1290 9641984 2237 2147483647 4194304 4219500 2146435536 2146432344 1997091444 0 0 4100 180226 2268774400 0 0 18 0 0 0 0 0 0 4285036 4285925 11997184
#
# strace prtstat -r `pgrep hotplug2`
execve("/usr/bin/prtstat", ["prtstat", "-r", "655"], [/* 10 vars */]) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x4000000, -1, 0) = 0x773aa000
stat("/etc/ld.so.cache", 0x7fd8a200)    = -1 ENOENT (No such file or directory)
open("/lib/libgcc_s.so.1", O_RDONLY)    = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=76936, ...}) = 0
...
close(3)                                = 0
...
open("/proc/655/stat", O_RDONLY|O_LARGEFILE) = 3
ioctl(3, TIOCNXCL, 0x7fd890f0)          = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "655 (hotplug2) S 1 467 467 0 -1 "..., 4096) = 237
write(1, "         pid: 655            \t  "..., 61         pid: 655                              comm: (null)
) = 61
write(1, "       state: \0              \t  "..., 56       state:                                 ppid: 0
) = 56
write(1, "        pgrp: 0              \t  "..., 56        pgrp: 0                                     session: 0
) = 56
write(1, "      tty_nr: 0              \t  "..., 56      tty_nr: 0                                       tpgid: 0
) = 56
...

comment:2 Changed 5 years ago by technozen <vonlogic@…>

Update: also affects current trunk (not just AA 12.09)

Tested with latest 'psmisc_22.16-1_ar71xx.ipk' binary release, identical prtstat failure.

(wget http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/psmisc_22.16-1_ar71xx.ipk as of 2013-01-22, manually gunzip and untar in /tmp)

comment:3 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.