/
githubmirror
/
ndctl
Обзор
Документация
Войти
/
githubmirror
/
ndctl
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/nfit-security
40 строк
1 KB
Dave Jiang
ndctl/test: Add CXL test for security
05 янв 2023, 00:31
05 янв 2023, 00:31
eee80f4
Код
Авторство
О чём код?
# SPDX-License-Identifier: GPL-2.0 # Copyright (C) 2022, Intel Corp. All rights reserved. detect() { dev="$($NDCTL list -b "$NFIT_TEST_BUS0" -D | jq -r .[0].dev)" [ -n "$dev" ] || err "$LINENO" id="$($NDCTL list -b "$NFIT_TEST_BUS0" -D | jq -r .[0].id)" [ -n "$id" ] || err "$LINENO" } lock_dimm() { $NDCTL disable-dimm "$dev" # convert nmemX --> test_dimmY # For now this is the only user of such a conversion so we can leave it # inline. Once a subsequent user arrives we can refactor this to a # helper in test/common: # get_test_dimm_path "nfit_test.0" "nmem3" handle="$($NDCTL list -b "$NFIT_TEST_BUS0" -d "$dev" -i | jq -r .[].dimms[0].handle)" test_dimm_path="" for test_dimm in /sys/devices/platform/"$NFIT_TEST_BUS0"/nfit_test_dimm/test_dimm*; do td_handle_file="$test_dimm/handle" test -e "$td_handle_file" || continue td_handle="$(cat "$td_handle_file")" if [[ "$td_handle" -eq "$handle" ]]; then test_dimm_path="$test_dimm" break fi done test -d "$test_dimm_path" # now lock the dimm echo 1 > "${test_dimm_path}/lock_dimm" sstate="$(get_security_state)" if [ "$sstate" != "locked" ]; then echo "Incorrect security state: $sstate expected: locked" err "$LINENO" fi }