Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
263 commits
Select commit Hold shift + click to select a range
4b27241
shared: fix strict aliasing in the address helpers
Oct 14, 2026
9e813f5
shared: use the scope of a link-local egress address
Oct 14, 2026
e8762d4
log: add a helper to read a log page without a length field
Oct 13, 2026
1c14a0d
nvme-print: fix the media unit status log
Oct 13, 2026
92254d1
libnvme: add a namespace WWID accessor
ooonea Oct 14, 2026
efa9903
daemon-util: add a pool of workers for blocking work
Oct 14, 2026
0ec54f7
discoverd: read discovery logs without blocking
Oct 14, 2026
bffe43b
nvme: make --human-readable increment the verbose level
dwsuse Oct 15, 2026
73c3918
argconfig: store OPT_LONG values as 64-bit integers
dwsuse Oct 15, 2026
06fdc4e
nvme: parse the set-property value as a 64-bit number
dwsuse Oct 15, 2026
3634319
fabrics: store the legacy --tls_key option in an int
dwsuse Oct 15, 2026
6ce750f
plugins/ocp: match the latency monitor option types to the fields
dwsuse Oct 15, 2026
f44ffbc
plugins/wdc: match the option types to the fields
dwsuse Oct 15, 2026
5efe1e6
plugins/sandisk: match the option types to the fields
dwsuse Oct 15, 2026
aa3e84f
plugins/fdp: parse the endurance group id as 16-bit value
dwsuse Oct 15, 2026
829439b
plugins/id: parse the 16-bit options with OPT_SHRT
dwsuse Oct 15, 2026
cd0d42f
plugins/log: match the option types to the fields
dwsuse Oct 15, 2026
a1837c9
plugins/resv: store the reservation flags in bools
dwsuse Oct 15, 2026
6c9e4d9
plugins/ibm: store the raw-binary flag in a bool
dwsuse Oct 15, 2026
67c1619
argconfig: don't end the option table for OPT_FLAG_JSON
dwsuse Oct 15, 2026
0e89d2a
plugins/feat: drop the unreachable short options of lba-range-type
dwsuse Oct 15, 2026
c25e0d3
plugins/samsung: store the vs-internal-log flags in bools
dwsuse Oct 15, 2026
31e3024
doc: document the --quiet and --set-options global options
dwsuse Oct 15, 2026
e9d9687
completions: update the shell completions
dwsuse Oct 15, 2026
6a53dbe
keysd: describe KMIP in the README
Oct 15, 2026
1c024db
nvme-print: limit the FDP events log to 63 entries
Oct 15, 2026
a3290d9
nvme-print: limit the changed zone list to 511 entries
Oct 15, 2026
74b9a00
nvme-print: use only bits 7:0 of the FDP events feature result
Oct 15, 2026
1b53ae8
ci: use a cached copy of checkpatch.pl
Oct 15, 2026
50c07a6
argconfig: check the type of option targets
dwsuse Oct 15, 2026
4d1fa75
argconfig: pass the option argument to the value parsers
dwsuse Oct 15, 2026
05c8c20
argconfig: provide the operands through an accessor
dwsuse Oct 15, 2026
300c477
tests: compare argconfig with a frozen copy of the getopt parser
dwsuse Oct 15, 2026
9fbe8f6
argconfig: parse the command line without getopt
dwsuse Oct 15, 2026
8f4a38b
libnvme: skip resets, rescans and Opal ioctls in dry-run mode
dwsuse Oct 15, 2026
09e28c0
fabrics: skip the connects and disconnects in dry-run mode
dwsuse Oct 15, 2026
f5a1439
NEWS: document the dry-run fixes
dwsuse Oct 15, 2026
a8106e5
shared: add shr_strsep()
dwsuse Oct 15, 2026
cf3dd72
argconfig: support a table of global options
dwsuse Oct 15, 2026
2cbf7f8
nvme: register the global options once
dwsuse Oct 15, 2026
1ecc7be
argconfig: accept --help and --version in the global parse
dwsuse Oct 15, 2026
a1861c0
nvme: check the output format in parse_args()
dwsuse Oct 15, 2026
1b39a78
treewide: drop the output format checks of the commands
dwsuse Oct 15, 2026
2ef5159
nvme: declare the output formats in struct command
dwsuse Oct 15, 2026
9d38ba9
nvme: move the global options to their own file
dwsuse Oct 15, 2026
1fd5e44
nvme: take the nvme-cli.conf keys from the global options
dwsuse Oct 15, 2026
e5cf015
completions: update the shell completions
dwsuse Oct 15, 2026
b70df42
NEWS: document the global options changes
dwsuse Oct 15, 2026
1135a9d
log: convert the LBA status log length from little endian
Oct 15, 2026
8a66c41
nvme-print: fix the streams directive printers
Oct 15, 2026
79cef16
fdp: convert the configurations log size from little endian
Oct 15, 2026
39a7ffb
tests: run the print test on big-endian hosts
Oct 15, 2026
af36d33
tests: keep the mock server running after a handler error
Oct 15, 2026
a7a68d9
ocp: name spec-defined Event IDs missing from the String Log
brgoing Oct 15, 2026
3d6ce3e
plugin: split handle_plugin() into small functions
dwsuse Oct 15, 2026
74e35e1
plugins: return the result of the option parsing unchanged
dwsuse Oct 15, 2026
40a5c31
argconfig: print the requested help to stdout and exit 0
dwsuse Oct 15, 2026
661e477
nvme: check the device operand of every command
dwsuse Oct 16, 2026
06e6b94
utils: report the device operand in the command metadata
dwsuse Oct 16, 2026
650dc95
plugins/virtium: take the device from the parsed operand
dwsuse Oct 16, 2026
202fb59
plugin: let help find the command like the dispatcher
dwsuse Oct 16, 2026
0b447fc
completions: update the shell completions
dwsuse Oct 16, 2026
d639139
NEWS: document the help, operand and completion changes
dwsuse Oct 16, 2026
406071d
scripts: drop line length warnings for the generated completions
dwsuse Oct 16, 2026
e6ac541
argconfig: look up a given option by its variable
dwsuse Oct 16, 2026
92987a2
treewide: ask whether an option was given by its variable
dwsuse Oct 16, 2026
50755e2
argconfig: drop argconfig_parse_seen()
dwsuse Oct 16, 2026
c057a58
argconfig: reject negative numbers for unsigned options
dwsuse Oct 16, 2026
ca5796c
nvme: accept names for the special namespace id and timeout values
dwsuse Oct 16, 2026
373c088
treewide: ask whether an option was given instead of sentinels
dwsuse Oct 16, 2026
5ec0dfb
argconfig: check the signedness of an option variable
dwsuse Oct 16, 2026
d4ce4cc
completions: update the shell completions
dwsuse Oct 16, 2026
f9b135b
NEWS: document the negative number and value name changes
dwsuse Oct 16, 2026
4283fd2
plugins/feat: keep the completion queue count in num-queues
dwsuse Oct 16, 2026
5297405
plugins/ocp: describe the --enable option of set-enable-ieee1667-silo
dwsuse Oct 16, 2026
d4321dc
completions: update the shell completions
dwsuse Oct 16, 2026
6d95baf
NEWS: document the num-queues fix
dwsuse Oct 16, 2026
501b623
argconfig: reject trailing text after a number
dwsuse Oct 16, 2026
4092b46
NEWS: document the rejected trailing text after numbers
dwsuse Oct 16, 2026
728d2da
nvme: run deprecated commands from a table
dwsuse Oct 16, 2026
51ddf32
nvme: check the operands of gen-dhchap-key and check-dhchap-key
dwsuse Oct 16, 2026
5bf2dd5
nvme: parse the options of tls-key with argconfig
dwsuse Oct 16, 2026
c18dcf8
plugins: declare the latency tracking options with OPT_FLAG()
dwsuse Oct 16, 2026
b613464
argconfig: drop the getopt header
dwsuse Oct 16, 2026
4b99182
completions: update the shell completions
dwsuse Oct 16, 2026
3726616
NEWS: document the tls-key and dhchap key command changes
dwsuse Oct 16, 2026
333675a
nvme-discoverd: tear down the host-name test target
Oct 16, 2026
b5e4320
nvme-discoverd: run connect-all for an unowned discovery controller
Oct 16, 2026
44a1b69
plugins: use the global verbose level instead of --human-readable
dwsuse Oct 16, 2026
9279afd
nvme: warn about the deprecated --human-readable
dwsuse Oct 16, 2026
d493e10
plugins: use the global --verbose instead of an own one
dwsuse Oct 16, 2026
62c35cb
plugins: drop the short names which global options use
dwsuse Oct 16, 2026
89049fe
argconfig: look up the global options first
dwsuse Oct 16, 2026
1b8eacd
tests: check that option names don't collide
dwsuse Oct 16, 2026
66b02aa
completions: update the shell completions
dwsuse Oct 16, 2026
bdc9abc
NEWS: document the global option name changes
dwsuse Oct 16, 2026
79dc640
argconfig: accept the old name of an option with a warning
dwsuse Oct 16, 2026
bc41280
argconfig: follow a usage error with the synopsis, not the help
dwsuse Oct 16, 2026
1c4e351
plugin: print the group titles in bold only on a terminal
dwsuse Oct 16, 2026
7ae54d3
argconfig: hide the deprecated options instead of a hidden flag
dwsuse Oct 16, 2026
ca9af7f
argconfig: color usage errors and warnings on a terminal
dwsuse Oct 16, 2026
32f59da
nvme: start the error messages with the name of the command
dwsuse Oct 16, 2026
f4d92a6
doc: a separate value of --persistent is an error
dwsuse Oct 16, 2026
504153b
plugin: point to the commands instead of printing the general help
dwsuse Oct 16, 2026
8f109ef
completions: update the shell completions
dwsuse Oct 16, 2026
fc8870d
NEWS: document the usage error and old option name changes
dwsuse Oct 16, 2026
b756540
utils: report deprecated commands and options in the command metadata
dwsuse Oct 16, 2026
6b4df5e
argconfig: add OPT_ENUM for an option which takes one of some names
dwsuse Oct 16, 2026
1049af0
nvme: take the ranking of show-topology as an enum
dwsuse Oct 16, 2026
edc53a8
plugins/memblaze: take the firmware select of select-download as an enum
dwsuse Oct 16, 2026
8959ee7
plugins/micron: take the fixed option values as enums
dwsuse Oct 16, 2026
293ae0e
plugins/ocp: take the telemetry type of internal-log as an enum
dwsuse Oct 16, 2026
0a99c9a
plugins/sandisk: take the telemetry type of vs-internal-log as an enum
dwsuse Oct 16, 2026
de02eea
plugins/wdc: take the telemetry type of vs-internal-log as an enum
dwsuse Oct 16, 2026
7ca9a5f
plugins/solidigm: take the log type of internal-log as an enum
dwsuse Oct 16, 2026
52e686b
nvme: define the fabrics and feature option tables directly
dwsuse Oct 16, 2026
d7bf995
nvme: define the option tables of the built-in commands directly
dwsuse Oct 16, 2026
0c2160d
plugins: define the option tables directly
dwsuse Oct 16, 2026
5ae5016
nvme: drop NVME_ARGS()
dwsuse Oct 16, 2026
29be039
completions: update the shell completions
dwsuse Oct 16, 2026
9a3f510
NEWS: document the option words and the deprecation metadata
dwsuse Oct 16, 2026
2018535
plugins/virtium: fix the length check of the log header strings
dwsuse Oct 16, 2026
b7085f1
argconfig: let an option table include another one
dwsuse Oct 16, 2026
120071c
argconfig: bind a template table to a struct
dwsuse Oct 16, 2026
802e6ae
fabrics: include the shared fabrics options as a table
dwsuse Oct 16, 2026
e08d50e
plugins/feat: include the feature options as a table
dwsuse Oct 16, 2026
ac15ca8
argconfig: drop the license text and update the copyright
dwsuse Oct 16, 2026
0df00bc
completions: update the shell completions
dwsuse Oct 16, 2026
14858c5
NEWS: document the fabrics and feature option headings
dwsuse Oct 16, 2026
4a1ce0b
shared: add strict parsers for whole numbers
dwsuse Oct 16, 2026
f55a0b8
shared: add a strict parser for floating point numbers
dwsuse Oct 16, 2026
fd3c777
shared: add shr_escape() for echoing strings from the user
dwsuse Oct 16, 2026
611eef7
argconfig: parse values strictly
dwsuse Oct 16, 2026
f0af13c
nvme: escape the user input which an error repeats
dwsuse Oct 16, 2026
358be1f
shared: harden the suffix parsers
dwsuse Oct 16, 2026
c074080
shared: parse the comma separated numbers strictly
dwsuse Oct 16, 2026
c9efce4
nvme: parse nvme-cli.conf numbers strictly and escape what is echoed
dwsuse Oct 16, 2026
320704b
nvme: free the nvme-cli.conf strings which a later key replaces
dwsuse Oct 16, 2026
23a5a9d
tests: fuzz the parsers of the command line and the config files
dwsuse Oct 16, 2026
4d06ff7
NEWS: document the stricter number parsing and the escaped echoes
dwsuse Oct 16, 2026
7f24af1
nvme-print-stdout: decode the reserved RPMB boot partition write prot…
dwsuse Oct 16, 2026
f9c512a
nvme-print: add nvme_log_nr_entries() to bound a log page entry count
dwsuse Oct 16, 2026
cbe9844
nvme-print: bound the FDP reclaim unit handle entries by the log length
dwsuse Oct 16, 2026
1aa2dd7
log: read the records of the host and AVE discovery and pull model logs
dwsuse Oct 16, 2026
4d4af26
nvme-print: pass the log length to the discovery and pull model printers
dwsuse Oct 16, 2026
d4bf8e3
nvme-print: walk the host discovery log records within the page
dwsuse Oct 16, 2026
50cf13a
nvme-print: walk the AVE discovery log records within the page
dwsuse Oct 16, 2026
c796add
nvme-print: bound the pull model DDC request OSP by the buffer
dwsuse Oct 16, 2026
228a733
nvme-print: bound the power histogram descriptors by the log size
dwsuse Oct 16, 2026
c025428
log: keep the log buffer when growing it fails
dwsuse Oct 16, 2026
122841b
log: walk the reachability descriptors at their offsets
dwsuse Oct 16, 2026
54cec1e
nvme-print: list all IDs of a reachability descriptor in JSON
dwsuse Oct 16, 2026
76d9df3
log: read the dispersed namespace participating NVM subsystems safely
dwsuse Oct 16, 2026
70ed3fe
nvme-print: bound the dispersed namespace participating NVM subsystems
dwsuse Oct 16, 2026
d254bbc
nvme-print-json: don't leak the entry after the last UUID
dwsuse Oct 16, 2026
7116af0
nvme-print-json: don't leak the LBA status objects of a short log
dwsuse Oct 16, 2026
3500115
mem: free a zero length huge allocation
dwsuse Oct 16, 2026
0d27854
log: reject a persistent event log too large to read
dwsuse Oct 16, 2026
e2c85f8
plugins/dera: don't index the status names with unknown values
dwsuse Oct 16, 2026
10cf313
plugins/dera: read the four byte counters as unsigned
dwsuse Oct 16, 2026
a6ce9d0
plugins/memblaze: have room for the new SMART log format
dwsuse Oct 16, 2026
59d88e7
plugins/seagate: read and print the SMART logs of vs-smart-add-log once
dwsuse Oct 16, 2026
aafcb22
plugins/seagate: free the JSON output of the temperature and PCIe stats
dwsuse Oct 16, 2026
34b3dd3
log: grow the buffer of a log read in parts geometrically
dwsuse Oct 16, 2026
c564e40
shared: grow the rows of a table by doubling
dwsuse Oct 16, 2026
cd2c990
nvme-print-json: don't leak the event list of a short persistent even…
dwsuse Oct 16, 2026
068120c
plugins/ibm: free the persistent event log and check its length
dwsuse Oct 16, 2026
947cfa3
plugins/solidigm: don't leak the JSON object of an empty SMART item
dwsuse Oct 16, 2026
2389c92
plugins/wdc: release the handle and the log of vs-hw-rev-log
dwsuse Oct 16, 2026
c0b9257
nvme-print-json: don't leak the list of a changed namespace list log
dwsuse Oct 16, 2026
d21f372
plugins/ocp: don't leak the event list of a short persistent event log
dwsuse Oct 16, 2026
1f0d2cf
plugins/solidigm: free the namespace of vs-drive-info
dwsuse Oct 16, 2026
f71f5f3
plugins/solidigm: compute the FTL unit size of vs-drive-info safely
dwsuse Oct 16, 2026
3f46045
NEWS: document the fixes for unexpected device data
dwsuse Oct 16, 2026
166acff
shared: add __shr_destructor
dwsuse Oct 16, 2026
83eae0a
nvme: release the plugins in a destructor
dwsuse Oct 16, 2026
3106ca9
nvme: move main() into a file of its own
dwsuse Oct 16, 2026
37f9b1f
tests/cli: transfer no data for a command without a buffer
dwsuse Oct 16, 2026
14529cc
tests/fuzz: write the crashing input without stdio
dwsuse Oct 16, 2026
dd3130d
tests/fuzz: count an input which hangs the target as a crash
dwsuse Oct 16, 2026
c60974b
tests/cli: answer the commands from a fuzz input
dwsuse Oct 16, 2026
3068da9
tests/fuzz: fuzz the data the device returns
dwsuse Oct 16, 2026
7845f61
tests/fuzz: build fabrics-conf only with the in-tree libnvme
dwsuse Oct 17, 2026
acb99d9
mem: allocate a page for a zero length
dwsuse Oct 17, 2026
c1c0c1c
argconfig: include the global options like a table
dwsuse Oct 17, 2026
6a4774e
sed: don't read an unfilled Level 0 Discovery buffer
dwsuse Oct 17, 2026
3549f7a
argconfig: give files and directories types of their own
dwsuse Oct 17, 2026
b44d806
argconfig: let unsigned options declare a range
dwsuse Oct 17, 2026
61fdbd7
nvme: accept the names of the Select values
dwsuse Oct 17, 2026
f427b54
utils: report the value type and range of an option
dwsuse Oct 17, 2026
0031e97
completions: complete by the type and range of an option
dwsuse Oct 17, 2026
6e33d9b
completions: update the shell completions
dwsuse Oct 17, 2026
c6fef10
NEWS: document the value types and ranges of the options
dwsuse Oct 17, 2026
2202cfb
argconfig: add options which take a list of names
dwsuse Oct 17, 2026
450bc5d
samsung: check the dump types while parsing the command line
dwsuse Oct 17, 2026
ec9e49c
completions: complete the names of a list after the last comma
dwsuse Oct 17, 2026
81f2629
completions: update the shell completions
dwsuse Oct 17, 2026
db7a0ca
NEWS: document the list of dump types of samsung vs-internal-log
dwsuse Oct 17, 2026
bea4b59
shared: reject numbers with a leading zero
dwsuse Oct 17, 2026
0b7e746
NEWS: document that numbers take no leading zero
dwsuse Oct 17, 2026
cd49411
shared: add bounded string copy and append helpers
dwsuse Oct 17, 2026
447b9ba
argconfig: use shr_snprintf_append()
dwsuse Oct 17, 2026
64813bf
shared: add shr_bin_to_hex()
dwsuse Oct 17, 2026
77f0ed2
huawei: bound the string buffers
dwsuse Oct 17, 2026
272216e
innogrit: bound the string buffers
dwsuse Oct 17, 2026
cd8e41f
intel: pass the size of the log file name buffer
dwsuse Oct 17, 2026
28b98cb
nbft: write the namespace identifier with shr_bin_to_hex()
dwsuse Oct 17, 2026
fcabeca
netapp: bound the string buffers
dwsuse Oct 17, 2026
608a59f
ocp: bound the string buffers
dwsuse Oct 17, 2026
dd92514
seagate: bound the string buffers
dwsuse Oct 17, 2026
d2ece3c
micron: bound the string buffers
dwsuse Oct 17, 2026
1ba4370
wdc: bound the string buffers
dwsuse Oct 17, 2026
575996d
sandisk: bound the string buffers
dwsuse Oct 17, 2026
aa5c2e6
rpmb: bound the string buffers
dwsuse Oct 17, 2026
f06c42a
ymtc: bound the sysfs path buffer
dwsuse Oct 17, 2026
d91ed81
memblaze: don't copy string literals into small buffers
dwsuse Oct 17, 2026
401b549
scaleflux: fix the device name and sysfs buffer overflows
dwsuse Oct 17, 2026
7a75cd3
virtium: bound the string buffers
dwsuse Oct 17, 2026
05ec831
solidigm: don't append the field names to an uninitialized buffer
dwsuse Oct 17, 2026
1ba6920
exclusion: parse the entry to remove strictly
dwsuse Oct 17, 2026
1be05bc
nvme-print: bound the host metadata element walk
dwsuse Oct 17, 2026
c3a10e5
ci: attach the static Linux and Windows binaries to the release
Oct 16, 2026
dd807ed
tests/cli: define each mock function once for both builds
dwsuse Oct 19, 2026
a4802ab
build: keep the internal functions in the coverage report
dwsuse Oct 19, 2026
25ba2ad
tests: drop the -cli suffix and use kebab-case for the nvme-cli tests
dwsuse Oct 19, 2026
51cf099
tests/cli: name the plugin tests after their plugin
dwsuse Oct 19, 2026
f48e2a2
tests/fuzz: name the fabrics-conf target after libnvme
dwsuse Oct 19, 2026
c132286
discoverd, keysd: use kebab-case test names
dwsuse Oct 19, 2026
26392ef
libnvme: group the NBFT and Python binding tests
dwsuse Oct 19, 2026
5e1b29c
tests/e2e: prefix the e2e tests and put them in an e2e suite
dwsuse Oct 19, 2026
01892bb
build: put every test in exactly one group suite
dwsuse Oct 19, 2026
9530e56
doc: document the test names and groups
dwsuse Oct 19, 2026
52af1cb
build: require one toolchain for C and C++ in sanitizer builds
dwsuse Oct 19, 2026
3557443
build: require b_lundef=false for clang sanitizer builds
dwsuse Oct 19, 2026
4299d15
build: require a sanitizer for fuzzing builds
dwsuse Oct 19, 2026
390c6d0
scripts/build.sh: use clang++ and b_lundef=false for clang sanitizer …
dwsuse Oct 19, 2026
a1cead5
doc: complete the clang sanitizer and fuzzing instructions
dwsuse Oct 19, 2026
75ff051
scripts/build.sh: check the config specific options in one place
dwsuse Oct 19, 2026
f437810
scripts/build.sh: add a fuzz config for long libFuzzer runs
dwsuse Oct 19, 2026
f246661
scaleflux: initialize the options of query-cap
dwsuse Oct 19, 2026
dc6b232
ocp: bound the descriptors of the hardware component log
dwsuse Oct 19, 2026
e59490d
nvme-print: stop at a persistent event with a short header
dwsuse Oct 19, 2026
4ec3ddf
fabrics: disconnect the disc controller when open fails
martin-gpy Oct 19, 2026
1b1675e
tree: propagate ns scan errors in libnvme_ctrl_scan_namespaces()
martin-gpy Oct 19, 2026
7c7cf5c
libnvme: fix submit_entry setter guarding the wrong field
martin-gpy Oct 19, 2026
2179378
fabrics: avoid truncating discovery log length when saving
martin-gpy Oct 19, 2026
7dd0ce0
fabrics: do not lose dim errors across controllers in fabrics_dim()
martin-gpy Oct 19, 2026
c650026
print-json: fix invalid free of trimmed key pointer
martin-gpy Oct 19, 2026
73ee42f
nvme-print-stdout: do not truncate the 16-bit feature fields
NotAFlightRisk Oct 17, 2026
96e258b
ocp: Fix OCP telemetry timestamp field decode
jeff-lien-sndk Oct 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tests/fuzz/corpus/** binary
36 changes: 34 additions & 2 deletions .github/workflows/checkpatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,50 @@
# Authors: Daniel Wagner <dwagner@suse.de>

name: Checkpatch Review
on: [pull_request]
on:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 02 * * *'

# A pull request reads only the caches of its own branch and of the
# default branch. So only a run on the default branch saves the copy of
# checkpatch.pl. A scheduled run always runs there.
jobs:
refresh:
name: refresh checkpatch.pl
if: ${{ github.event_name != 'pull_request' &&
github.ref_name == github.event.repository.default_branch }}
runs-on: ubuntu-latest
steps:
- name: Fetch checkpatch.pl
run: |
curl -sSf \
https://raw.githubusercontent.com/torvalds/linux/master/scripts/checkpatch.pl \
-o checkpatch.pl
- uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: checkpatch.pl
key: checkpatch-${{ github.run_id }}

checkpatch:
name: checkpatch review
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Fetch checkpatch.pl
# The newest saved copy. No key is an exact match.
- uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: checkpatch.pl
key: checkpatch-
restore-keys: checkpatch-
- name: Fetch checkpatch.pl if no copy was saved
run: |
[ -f checkpatch.pl ] && exit 0
curl -sSf \
https://raw.githubusercontent.com/torvalds/linux/master/scripts/checkpatch.pl \
-o checkpatch.pl
Expand Down
81 changes: 77 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ name: Release

on:
push:
branches: [master]
tags:
- '**'
- 'v*'
pull_request:
paths:
- .github/workflows/release.yml
- scripts/build.sh

jobs:
build:
create-release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') && github.repository == 'linux-nvme/nvme-cli'
if: github.event_name == 'push' && github.repository == 'linux-nvme/nvme-cli'
permissions:
contents: write
steps:
Expand All @@ -35,3 +38,73 @@ jobs:
gh release create "${GITHUB_REF_NAME}" "${args[@]}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-linux-static:
runs-on: ubuntu-latest
container:
image: ghcr.io/linux-nvme/debian:latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
- name: Mark repo as safe for git
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: build
run: |
scripts/build.sh static
VERSION="$(git describe --always --abbrev=12 --dirty)"
mkdir upload
cp .build-ci/nvme "upload/nvme-cli-${VERSION}-x86_64"
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: linux-static
path: upload/*

build-windows-static:
runs-on: windows-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
- uses: msys2/setup-msys2@ec48f7c5447b3140e2b088413ae3a55687bccb6e # v2.33.0
with:
msystem: UCRT64
update: true
install: >-
git
mingw-w64-ucrt-x86_64-gcc
mingw-w64-ucrt-x86_64-pkgconf
mingw-w64-ucrt-x86_64-meson
mingw-w64-ucrt-x86_64-ninja
mingw-w64-ucrt-x86_64-json-c
- name: build
shell: msys2 {0}
run: |
set -euxo pipefail
git config --global --add safe.directory "$GITHUB_WORKSPACE"
scripts/build.sh -c /ucrt64/bin/gcc static_windows
VERSION="$(git describe --always --abbrev=12 --dirty)"
mkdir upload
cp .build-ci/nvme.exe "upload/nvme-cli-${VERSION}-x86_64.exe"
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: windows-static
path: upload/*

upload-release-assets:
runs-on: ubuntu-latest
needs: [create-release, build-linux-static, build-windows-static]
permissions:
contents: write
steps:
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
with:
path: upload
merge-multiple: true
- name: Upload binaries
run: |
gh release upload "${GITHUB_REF_NAME}" upload/* --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
13 changes: 9 additions & 4 deletions .github/workflows/run-nightly-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,18 +192,22 @@ jobs:

sudo dnf install -y gcc meson git kmod iproute systemd \
systemd-devel json-c-devel openssl-devel keyutils-libs-devel \
dbus-devel gcovr avahi avahi-tools ktls-utils
dbus-devel gcovr avahi avahi-tools ktls-utils python3

# The KMS for the KMIP phases of the nvme-keysd wringer.
python3 -m venv "$HOME/pykmip"
"$HOME/pykmip/bin/pip" install pykmip

git clone https://github.com/${{ github.repository }} nvme-cli
cd nvme-cli
git checkout ${{ github.sha }}

# Enable explicitly so a missing or too old libsystemd fails
# the build instead of silently skipping a daemon or the mDNS
# support of nvme-discoverd.
# the build instead of silently skipping a daemon, the mDNS
# support of nvme-discoverd, or the KMIP support of nvme-keysd.
meson setup .build-ci --buildtype=release \
-Dnvme-discoverd=enabled -Dmdns=enabled \
-Dnvme-keysd=enabled -Db_coverage=true
-Dnvme-keysd=enabled -Dkmip=enabled -Db_coverage=true
meson compile -C .build-ci

# Test link for the mDNS phases. The mDNS traffic stays on
Expand All @@ -226,6 +230,7 @@ jobs:
tee daemon-results/discoverd-wringer.log
discoverd_status=$?
sudo env BUILD_DIR="$PWD/.build-ci" \
PYKMIP_PYTHON="$HOME/pykmip/bin/python" \
keysd/tests/wringer.sh -y 2>&1 |
tee daemon-results/keysd-wringer.log
keysd_status=$?
Expand Down
31 changes: 1 addition & 30 deletions .github/workflows/upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,13 @@ on:
branches: [master]
tags:
- 'v*'
release:
types: [published]

jobs:
build-static:
name: build static binary
runs-on: ubuntu-latest
container:
image: ghcr.io/linux-nvme/debian:latest
outputs:
VERSION: ${{ steps.build.outputs.VERSION }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
Expand All @@ -33,13 +29,8 @@ jobs:
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- name: build
id: build
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
VERSION="$(git describe --always --abbrev=12 --dirty)"
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo $VERSION

scripts/build.sh static
mkdir upload
cp .build-ci/nvme upload/nvme-cli-latest-x86_64
Expand All @@ -59,7 +50,7 @@ jobs:
name: upload test binary
runs-on: ubuntu-latest
needs: build-static
if: ${{ (github.event_name == 'push' || github.event_name == 'release') && github.repository == 'linux-nvme/nvme-cli' }}
if: ${{ github.event_name == 'push' && github.repository == 'linux-nvme/nvme-cli' }}
steps:
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
with:
Expand All @@ -86,23 +77,3 @@ jobs:
echo "put $f $(basename "$f")" >> "$SFTP_BATCH"
done
sftp -b "$SFTP_BATCH" "${SFTP_USERNAME}@${SFTP_SERVER}"

upload-release-assets:
name: upload GitHub release assets
runs-on: ubuntu-latest
needs: build-static
env:
VERSION: ${{ needs.build-static.outputs.VERSION }}
if: ${{ github.event_name == 'release' && github.repository == 'linux-nvme/nvme-cli' }}
steps:
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
with:
name: nvme-cli
path: upload
- name: upload versioned binary
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: upload/nvme-cli-${{ env.VERSION }}-x86_64
asset_name: nvme-cli-${{ env.VERSION }}-x86_64
asset_content_type: application/octet-stream
121 changes: 121 additions & 0 deletions Documentation/TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,38 @@ Example: Cross-build for `s390x`:

The exact supported targets depend on the toolchains installed in the container.

## Test names

Every test is named `<component> - <test>` and is in exactly one
group. `meson test` prints it as `<group> - nvme-cli:<component> - <test>`:

- `<component>` is what the test covers: `nvme-cli`, `libnvme`,
`shared`, a daemon (`nvme-discoverd`, `nvme-keysd`, ...) or a plugin
(`micron`, `ocp`, ...).
- `<test>` is in kebab-case and names the feature, usually the command
it covers. It does not repeat the component and has no `-test` or
`-cli` suffix. Fuzz and e2e tests start with `fuzz-` and `e2e-`.
- A group of tests over a set of inputs uses a `/`, e.g.
`libnvme - header/tree` or `libnvme - nbft/rhpoc`.

The group is the meson suite and says how the test runs:

| Group | What runs |
|---------|---------------------------------------------------------------|
| `unit` | a test program for library or internal code |
| `mock` | the nvme binary or a daemon, with a mock where it needs a device |
| `e2e` | the nvme binary against a real device (`-De2e-tests=true`) |
| `fuzz` | a fuzz target over its corpus (see [Fuzzing](#fuzzing)) |
| `check` | a consistency check of the tree: headers, symbols, docs, tags |

Select tests by group or by a name pattern:

```shell
meson test -C .build --suite unit --suite mock
meson test -C .build 'micron - *'
meson test -C .build 'nvme-cli - print'
```

## Memory Testing

### Valgrind
Expand Down Expand Up @@ -193,5 +225,94 @@ meson test -C .build-asanubsan --setup asanubsan
No wrapper binary is needed — sanitizer reports are emitted directly to stderr
when a violation is detected.

With clang, set the C++ compiler too, and let shared libraries have the
symbols of the sanitizer runtime undefined: clang links the runtime only into
executables.

```bash
CC=clang CXX=clang++ meson setup .build-asanubsan \
-Db_sanitize=address,undefined -Db_lundef=false
```

The same known limitations apply as for Valgrind: Python tests and shell script
tests may produce false positives. Focus triage on the `nvme-cli - *` unit tests.

## Fuzzing

The parsers of untrusted input have fuzz targets in `tests/fuzz`: the
command line parser (`argconfig`), the INI parser (`ini`), `nvme-cli.conf`
(`global-config`) and `nvme-fabrics.conf` (`fabrics-conf`).

The `device` target fuzzes what nvme-cli does with the data a device
returns. It runs one of the commands which read and print something, from
the table in `tests/fuzz/fuzz-device.c`, against the device mock of
`tests/cli/libmock_nvme.c`, which answers every command from the input.
It needs a dynamically linked Linux build. Its seeds named `regress-*` are
inputs which found a bug.

Every build runs them as tests of the `fuzz` suite: each target replays its
seeds in `tests/fuzz/corpus/<target>` and then a few seconds of random
mutations of them. The mutations come from a fixed seed, so a failure can be
repeated, and the input which crashed a target is written to
`fuzz-crash-<target>` in the build directory.

```bash
meson test -C .build --suite fuzz
FUZZ_SECONDS=60 FUZZ_SEED=7 meson test -C .build --suite fuzz
```

Run in a sanitizer build (see above) they also catch memory errors which
don't crash.

For longer, coverage guided runs, build the targets for libFuzzer with clang,
in a sanitizer build as described above:

```bash
CC=clang CXX=clang++ meson setup .build-fuzz -Dfuzzing=true \
-Db_sanitize=address,undefined -Db_lundef=false
meson compile -C .build-fuzz
```

Run a target on a copy of its seeds in the build directory, so the seeds in
the tree stay as they are. The new inputs libFuzzer finds go to the copy:

```bash
mkdir -p .build-fuzz/corpus/argconfig
cp tests/fuzz/corpus/argconfig/* .build-fuzz/corpus/argconfig/
.build-fuzz/tests/fuzz/fuzz-argconfig -close_fd_mask=3 \
-dict=tests/fuzz/argconfig.dict .build-fuzz/corpus/argconfig
```

The config targets (`ini`, `global-config`, `fabrics-conf`) use
`tests/fuzz/config.dict`. The `device` target reads log pages, so give it
longer inputs. A device reports sizes of up to gigabytes, which nvme-cli
allocates: let ASan fail such an allocation instead of libFuzzer aborting the
run as out of memory:

```bash
mkdir -p .build-fuzz/corpus/device
cp tests/fuzz/corpus/device/* .build-fuzz/corpus/device/
ASAN_OPTIONS=allocator_may_return_null=1:max_allocation_size_mb=1024 \
.build-fuzz/tests/fuzz/fuzz-device -close_fd_mask=3 -max_len=16384 \
-timeout=10 .build-fuzz/corpus/device
```

`scripts/build.sh fuzz` does all of this for every target in turn, each with
one libFuzzer job per CPU on a shared corpus, for 600 seconds by default:

```bash
scripts/build.sh --fuzz-seconds 3600 fuzz
scripts/build.sh --fuzz-targets device --fuzz-jobs 8 fuzz
```

It writes the results to `.build-ci/fuzz`: `summary.txt`, and per target the
logs of the jobs in `logs/<target>/`, the inputs which found a bug in
`artifacts/<target>/` and the corpus in `corpus/<target>/`. A finding stops
only its job, a UBSan finding like a crash. The next run of `build.sh` removes
the results; pass a `--fuzz-dir` outside of `.build-ci` to keep them, and to
grow the corpus across runs. `scripts/build.sh -h` lists all options.

When run by hand, a crashing input is written to `crash-*` in the current
directory. Add an input which found a bug to the seeds of its target. The
targets use the libFuzzer interface, so AFL++ can run them too
(`afl-clang-fast` with `-fsanitize=fuzzer`).
Loading
Loading