Project

General

Profile

Actions

Bug #13716

closed

pcieadm save-cfgspace -a can't open files

Added by Robert Mustacchi 25 days ago. Updated 22 days ago.

Status:
Closed
Priority:
Normal
Category:
cmd - userland programs
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

When refactoring pcieadm for privilege awareness, I inadvertently broke pcieadm save-cfgspace -a. I've added a regression test for this to stop this from happening again, while fixing it in the process, which is a missed privilege bracketing.

Actions #1

Updated by Electric Monk 25 days ago

  • Gerrit CR set to 1413
Actions #2

Updated by Robert Mustacchi 22 days ago

This was tested with the pcieadm test suites and new tests designed to catch this case explicitly:

rm@beowulf:~$ /opt/util-tests/tests/pcieadmtest ; pfexec /opt/util-tests/tests/pcieadm-priv ; pfexec /opt/util-tests/bin/utiltest 
TEST PASSED: invalid arguments 
TEST PASSED: invalid arguments -d
TEST PASSED: invalid arguments foobar
TEST PASSED: invalid arguments save-cfgspace
TEST PASSED: invalid arguments save-cfgspace -a
TEST PASSED: invalid arguments save-cfgspace -d
TEST PASSED: invalid arguments save-cfgspace -d final
TEST PASSED: invalid arguments save-cfgspace -a -d fantasy
TEST PASSED: invalid arguments show-devs -h
TEST PASSED: invalid arguments show-devs -p
TEST PASSED: invalid arguments show-devs -s -o
TEST PASSED: invalid arguments show-cfgspace
TEST PASSED: invalid arguments show-cfgspace -d -H
TEST PASSED: invalid arguments show-cfgspace -d
TEST PASSED: invalid arguments show-cfgspace -f
TEST PASSED: invalid arguments show-cfgspace -h
TEST PASSED: invalid arguments show-cfgspace -L
TEST PASSED: invalid arguments show-cfgspace -L -n -f /opt/util-tests/tests/pci/igb.pci
TEST PASSED: invalid arguments show-cfgspace -L -p -f /opt/util-tests/tests/pci/igb.pci
TEST PASSED: invalid arguments show-cfgspace -p -f /opt/util-tests/tests/pci/igb.pci
TEST PASSED: invalid arguments show-cfgspace -o foo -f /opt/util-tests/tests/pci/igb.pci
TEST PASSED: invalid arguments show-cfgspace -L -o foo -f /opt/util-tests/tests/pci/igb.pci
TEST PASSED: show-cfgspace -f /dev/stdin header0.vendor header0.device
TEST PASSED: show-cfgspace -L -f /dev/stdin header0.vendor header0.device
TEST PASSED: show-cfgspace -n -f /dev/stdin header0.vendor header0.device
TEST PASSED: show-cfgspace -L -H -f /dev/stdin header0.vendor header0.device
TEST PASSED: show-cfgspace -f /dev/stdin ltr
TEST PASSED: show-cfgspace -p -o short,value -f /dev/stdin ltr
TEST PASSED: show-cfgspace -p -o short,value -f /dev/stdin header0.vendor header0.device
TEST PASSED: show-cfgspace -f /dev/stdin ht
TEST PASSED: show-cfgspace -f /dev/stdin ht.msi
TEST PASSED: show-cfgspace -f /dev/stdin ht.msi.command
TEST PASSED: show-cfgspace -p -o value,short -f /dev/stdin ht
TEST PASSED: show-cfgspace -p -o value,short -f /dev/stdin ht.msi
TEST PASSED: show-cfgspace -p -o value,short -f /dev/stdin ht.msi.command
TEST PASSED: show-cfgspace -f /dev/stdin pcie.linksts atelier
TEST PASSED: show-cfgspace -p -o short,value -f /dev/stdin pcie.linksts atelier
All tests passed successfully!
successfully listed devices
TEST PASSED: show-devs 0/0/0
TEST PASSED: show-cfgspace -d 0/0/0
TEST PASSED: save-cfgspace -d 0/0/0
TEST PASSED: show-devs /pci@0,0/pci1849,1480@0
TEST PASSED: show-cfgspace -d /pci@0,0/pci1849,1480@0
TEST PASSED: save-cfgspace -d /pci@0,0/pci1849,1480@0
TEST PASSED: show-devs amdzen_stub0
TEST PASSED: show-cfgspace -d amdzen_stub0
TEST PASSED: save-cfgspace -d amdzen_stub0
TEST PASSED: save-cfgspace -a
All tests passed successfully!
Test: /opt/util-tests/tests/allowed-ips (run as root)             [00:00] [PASS]
Test: /opt/util-tests/tests/chown_test (run as root)              [00:00] [PASS]
Test: /opt/util-tests/tests/date_test (run as root)               [00:00] [PASS]
Test: /opt/util-tests/tests/find/findtest (run as root)           [00:00] [PASS]
Test: /opt/util-tests/tests/grep_test (run as root)               [00:03] [PASS]
Test: /opt/util-tests/tests/head/head_test (run as root)          [00:00] [PASS]
Test: /opt/util-tests/tests/libjedec_test (run as root)           [00:00] [PASS]
Test: /opt/util-tests/tests/libsff/libsff (run as root)           [00:00] [PASS]
Test: /opt/util-tests/tests/make_test (run as root)               [00:00] [PASS]
Test: /opt/util-tests/tests/mdb/mdbtest (run as root)             [00:00] [PASS]
Test: /opt/util-tests/tests/mergeq/mqt (run as root)              [00:00] [PASS]
Test: /opt/util-tests/tests/mergeq/wqt (run as root)              [00:00] [PASS]
Test: /opt/util-tests/tests/pcidbtest (run as root)               [00:01] [PASS]
Test: /opt/util-tests/tests/pcieadm-priv (run as root)            [00:03] [PASS]
Test: /opt/util-tests/tests/pcieadmtest (run as root)             [00:03] [PASS]
Test: /opt/util-tests/tests/printf_test (run as root)             [00:00] [PASS]
Test: /opt/util-tests/tests/set-linkprop (run as root)            [00:00] [PASS]
Test: /opt/util-tests/tests/sleep/sleeptest (run as root)         [00:23] [PASS]
Test: /opt/util-tests/tests/smbios (run as root)                  [00:00] [PASS]
Test: /opt/util-tests/tests/xargs_test (run as root)              [00:00] [PASS]
Test: /opt/util-tests/tests/awk/runtests.sh (run as nobody)       [02:57] [PASS]
Test: /opt/util-tests/tests/ctf/precheck (run as root)            [00:00] [PASS]
Test: /opt/util-tests/tests/ctf/ctftest (run as root)             [00:06] [PASS]
Test: /opt/util-tests/tests/demangle/afl-fast (run as root)       [00:01] [PASS]
Test: /opt/util-tests/tests/demangle/gcc-libstdc++ (run as root)  [00:00] [PASS]
Test: /opt/util-tests/tests/demangle/llvm-stdcxxabi (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libcustr/custr_remove (run as root)   [00:00] [PASS]
Test: /opt/util-tests/tests/libcustr/custr_trunc (run as root)    [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_00_blank (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_01_boolean (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_02_numbers (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_03_empty_arrays (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_04_number_arrays (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_05_strings (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_06_nested (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_07_nested_arrays (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/sed/sed_addr (run as root)            [00:00] [PASS]
Test: /opt/util-tests/tests/sed/multi_test (run as root)          [00:00] [PASS]

Results Summary
PASS      38

Running Time:   00:03:47
Percent passed: 100.0%
Log directory:  /var/tmp/test_results/20210415T090220
Actions #3

Updated by Electric Monk 22 days ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit 414dafc0a71bccb9c69d6801ed11ba1016a8082b

commit  414dafc0a71bccb9c69d6801ed11ba1016a8082b
Author: Robert Mustacchi <rm@fingolfin.org>
Date:   2021-04-15T20:44:29.000Z

    13714 pcieadm pci check misses renamed nodes
    13715 pcieadm save-cfgspace doesn't work with b/d/f
    13716 pcieadm save-cfgspace -a can't open files
    Reviewed by: C Fraire <cfraire@me.com>
    Reviewed by: Andy Fiddaman <andy@omnios.org>
    Approved by: Dan McDonald <danmcd@joyent.com>

Actions

Also available in: Atom PDF