pmem / ndctl

A "device memory" enabling project encompassing tools and libraries for CXL, NVDIMMs, DAX, memory tiering and other platform memory device topics.
Other
270 stars 139 forks source link

ndctl test suite security.sh failed #231

Closed yizhanglinux closed 1 year ago

yizhanglinux commented 1 year ago

Hello Recently CKI reports the security.sh failure and here is the log, could anyone pls help check it, thanks.

version: 6.2.0-0.rc4.6e50979a9c87.32.test.eln.x86_64 ndctl-75-2.eln125.x86_64


=================================== 22/22 ====================================
test:         ndctl:ndctl / nfit-security.sh
start time:   01:24:03
duration:     1.48s
result:       exit status 1
command:      DAXCTL=/root/ndctl/build/daxctl/daxctl LD_LIBRARY_PATH=/root/ndctl/build/daxctl/lib:/root/ndctl/build/ndctl/lib:/root/ndctl/build/cxl/lib NDCTL=/root/ndctl/build/ndctl/ndctl DATA_PATH=/root/ndctl/test TEST_PATH=/root/ndctl/build/test MALLOC_PERTURB_=242 /root/ndctl/test/nfit-security.sh
----------------------------------- stdout -----------------------------------
1000059314
1 links removed
720099648
1 links removed
139647742
10319860
Test 1, security setup and remove
Test 2, security setup, update, and remove
Test 3, security setup and erase
Test 4, unlock dimm
Incorrect security state: unlocked expected: locked
test/security.sh: failed at line 38
----------------------------------- stderr -----------------------------------
++ dirname /root/ndctl/test/nfit-security.sh
+ /root/ndctl/test/security.sh nfit
+ rc=77
+ dev=
+ id=
+ keypath=/etc/ndctl/keys
+ masterkey=nvdimm-master
+ masterpath=/etc/ndctl/keys/nvdimm-master.blob
+ backup_key=0
+ backup_handle=0
++ dirname /root/ndctl/test/security.sh
+ . /root/ndctl/test/common
++ '[' -z /root/ndctl/build/ndctl/ndctl ']'
++ '[' -z /root/ndctl/build/daxctl/daxctl ']'
++ '[' -z ']'
++ '[' -f ../cxl/cxl ']'
++ '[' -f ./cxl/cxl ']'
++ '[' -x ./cxl/cxl ']'
++ export CXL=./cxl/cxl
++ CXL=./cxl/cxl
++ '[' -z /root/ndctl/build/test ']'
++ NFIT_TEST_BUS0=nfit_test.0
++ NFIT_TEST_BUS1=nfit_test.1
++ CXL_TEST_BUS=cxl_test
++ ACPI_BUS=ACPI.NFIT
++ E820_BUS=e820
+ trap 'err $LINENO' ERR
+ '[' nfit = nfit ']'
++ dirname /root/ndctl/test/security.sh
+ . /root/ndctl/test/nfit-security
+ TEST_BUS=nfit_test.0
+ check_min_kver 5.0
+ local ver=5.0
++ uname -r
+ : 6.2.0-0.rc4.6e50979a9c87.32.test.eln.x86_64
+ '[' -n 5.0 ']'
++ echo -e '5.0\n6.2.0-0.rc4.6e50979a9c87.32.test.eln.x86_64'
++ sort -V
++ head -1
+ [[ 5.0 == \5\.\0 ]]
+ KMOD_TEST=nfit_test
++ keyctl show
++ grep -Eo '_uid.[0-9]+'
++ head -1
++ cut -d. -f2-
+ uid=0
+ '[' 0 -ne 0 ']'
+ modprobe nfit_test
+ setup
+ /root/ndctl/build/ndctl/ndctl disable-region -b nfit_test.0 all
disabled 2 regions
+ check_prereq keyctl
+ command -v keyctl
+ rc=1
+ detect
++ /root/ndctl/build/ndctl/ndctl list -b nfit_test.0 -D
++ jq -r '.[0].dev'
+ dev=nmem1
+ '[' -n nmem1 ']'
++ /root/ndctl/build/ndctl/ndctl list -b nfit_test.0 -D
++ jq -r '.[0].id'
+ id=cdab-0a-07e0-feffffff
+ '[' -n cdab-0a-07e0-feffffff ']'
+ test_cleanup
+ keyctl search @u encrypted nvdimm:cdab-0a-07e0-feffffff
++ keyctl search @u encrypted nvdimm:cdab-0a-07e0-feffffff
+ keyctl unlink 1000059314
+ keyctl search @u user nvdimm-master
++ keyctl search @u user nvdimm-master
+ keyctl unlink 720099648
++ hostname
+ '[' -f /etc/ndctl/keys/nvdimm_cdab-0a-07e0-feffffff_storageqe-62.rhts.eng.pek2.redhat.com.blob ']'
++ hostname
+ rm -f /etc/ndctl/keys/nvdimm_cdab-0a-07e0-feffffff_storageqe-62.rhts.eng.pek2.redhat.com.blob
+ setup_keys
+ '[' '!' -d /etc/ndctl/keys ']'
+ '[' -f /etc/ndctl/keys/nvdimm-master.blob ']'
+ mv /etc/ndctl/keys/nvdimm-master.blob /etc/ndctl/keys/nvdimm-master.blob.bak
+ backup_key=1
+ '[' -f /etc/ndctl/keys/tpm.handle ']'
+ keyctl new_session
+ keyctl link @u @s
+ dd if=/dev/urandom bs=1 count=32
+ keyctl padd user nvdimm-master @u
++ keyctl search @u user nvdimm-master
+ keyctl pipe 10319860
+ echo 'Test 1, security setup and remove'
+ test_1_security_setup_and_remove
+ setup_passphrase
+ /root/ndctl/build/ndctl/ndctl setup-passphrase nmem1 -k user:nvdimm-master
passphrase enabled for 1 nmem.
++ get_security_state
++ /root/ndctl/build/ndctl/ndctl list -i -b nfit_test.0 -d nmem1
++ jq -r '.[].dimms[0].security'
+ sstate=unlocked
+ '[' unlocked '!=' unlocked ']'
+ remove_passphrase
+ /root/ndctl/build/ndctl/ndctl remove-passphrase nmem1
passphrase removed for 1 nmem.
++ get_security_state
++ /root/ndctl/build/ndctl/ndctl list -i -b nfit_test.0 -d nmem1
++ jq -r '.[].dimms[0].security'
+ sstate=disabled
+ '[' disabled '!=' disabled ']'
+ echo 'Test 2, security setup, update, and remove'
+ test_2_security_setup_and_update
+ setup_passphrase
+ /root/ndctl/build/ndctl/ndctl setup-passphrase nmem1 -k user:nvdimm-master
passphrase enabled for 1 nmem.
++ get_security_state
++ /root/ndctl/build/ndctl/ndctl list -i -b nfit_test.0 -d nmem1
++ jq -r '.[].dimms[0].security'
+ sstate=unlocked
+ '[' unlocked '!=' unlocked ']'
+ update_security
+ /root/ndctl/build/ndctl/ndctl update-passphrase nmem1
passphrase updated for 1 nmem.
++ get_security_state
++ /root/ndctl/build/ndctl/ndctl list -i -b nfit_test.0 -d nmem1
++ jq -r '.[].dimms[0].security'
+ sstate=unlocked
+ '[' unlocked '!=' unlocked ']'
+ remove_passphrase
+ /root/ndctl/build/ndctl/ndctl remove-passphrase nmem1
passphrase removed for 1 nmem.
++ get_security_state
++ /root/ndctl/build/ndctl/ndctl list -i -b nfit_test.0 -d nmem1
++ jq -r '.[].dimms[0].security'
+ sstate=disabled
+ '[' disabled '!=' disabled ']'
+ echo 'Test 3, security setup and erase'
+ test_3_security_setup_and_erase
+ setup_passphrase
+ /root/ndctl/build/ndctl/ndctl setup-passphrase nmem1 -k user:nvdimm-master
passphrase enabled for 1 nmem.
++ get_security_state
++ /root/ndctl/build/ndctl/ndctl list -i -b nfit_test.0 -d nmem1
++ jq -r '.[].dimms[0].security'
+ sstate=unlocked
+ '[' unlocked '!=' unlocked ']'
+ erase_security
+ /root/ndctl/build/ndctl/ndctl sanitize-dimm -c nmem1
sanitized 1 nmem.
++ get_security_state
++ /root/ndctl/build/ndctl/ndctl list -i -b nfit_test.0 -d nmem1
++ jq -r '.[].dimms[0].security'
+ sstate=disabled
+ '[' disabled '!=' disabled ']'
+ echo 'Test 4, unlock dimm'
+ test_4_security_unlock
+ setup_passphrase
+ /root/ndctl/build/ndctl/ndctl setup-passphrase nmem1 -k user:nvdimm-master
passphrase enabled for 1 nmem.
++ get_security_state
++ /root/ndctl/build/ndctl/ndctl list -i -b nfit_test.0 -d nmem1
++ jq -r '.[].dimms[0].security'
+ sstate=unlocked
+ '[' unlocked '!=' unlocked ']'
+ lock_dimm
+ /root/ndctl/build/ndctl/ndctl disable-dimm nmem1
disabled 1 nmem
++ /root/ndctl/build/ndctl/ndctl list -b nfit_test.0 -d nmem1 -i
++ jq -r '.[].dimms[0].handle'
+ handle=1
+ test_dimm_path=
+ for test_dimm in /sys/devices/platform/"$NFIT_TEST_BUS0"/nfit_test_dimm/test_dimm*
+ td_handle_file=/sys/devices/platform/nfit_test.0/nfit_test_dimm/test_dimm0/handle
+ test -e /sys/devices/platform/nfit_test.0/nfit_test_dimm/test_dimm0/handle
++ cat /sys/devices/platform/nfit_test.0/nfit_test_dimm/test_dimm0/handle
+ td_handle=0x0
+ [[ 0x0 -eq 1 ]]
+ for test_dimm in /sys/devices/platform/"$NFIT_TEST_BUS0"/nfit_test_dimm/test_dimm*
+ td_handle_file=/sys/devices/platform/nfit_test.0/nfit_test_dimm/test_dimm1/handle
+ test -e /sys/devices/platform/nfit_test.0/nfit_test_dimm/test_dimm1/handle
++ cat /sys/devices/platform/nfit_test.0/nfit_test_dimm/test_dimm1/handle
+ td_handle=0x1
+ [[ 0x1 -eq 1 ]]
+ test_dimm_path=/sys/devices/platform/nfit_test.0/nfit_test_dimm/test_dimm1
+ break
+ test -d /sys/devices/platform/nfit_test.0/nfit_test_dimm/test_dimm1
+ echo 1
++ get_security_state
++ /root/ndctl/build/ndctl/ndctl list -i -b nfit_test.0 -d nmem1
++ jq -r '.[].dimms[0].security'
+ sstate=unlocked
+ '[' unlocked '!=' locked ']'
+ echo 'Incorrect security state: unlocked expected: locked'
+ err 38
++ basename /root/ndctl/test/security.sh
+ echo test/security.sh: failed at line 38
+ '[' -n '' ']'
+ exit 1
==============================================================================

Summary of Failures:

22/22 ndctl:ndctl / nfit-security.sh       FAIL             1.48s   exit status 1

Ok:                 20  
Expected Fail:      0   
Fail:               1   
Unexpected Pass:    0   
Skipped:            1   
Timeout:            0   ```