]> git.ipfire.org Git - thirdparty/dracut.git/commit
feat(skipcpio): speed up and harden skipcpio
authorHarald Hoyer <harald@redhat.com>
Wed, 24 Feb 2021 12:55:54 +0000 (13:55 +0100)
committerHarald Hoyer <harald@hoyer.xyz>
Thu, 25 Feb 2021 13:48:22 +0000 (14:48 +0100)
commit630334950c9a7a714fdf31b6ff545d804b5df2f2
tree630b754533f6d5c6a994cbc72a85510c9f78bed9
parentc67b62463762de1b79c62c9077d4a3ba96a94aa1
feat(skipcpio): speed up and harden skipcpio

Before:
```
Benchmark #1: ./skipcpio/skipcpio test-5.10.15-200.fc33.x86_64.img >/dev/null
  Time (mean ± σ):     125.5 ms ±   0.9 ms    [User: 97.4 ms, System: 27.9 ms]
  Range (min … max):   124.8 ms … 129.4 ms    23 runs
```

After:
```
Benchmark #1: ./skipcpio/skipcpio test-5.10.15-200.fc33.x86_64.img >/dev/null
  Time (mean ± σ):      12.2 ms ±   0.3 ms    [User: 2.7 ms, System: 9.5 ms]
  Range (min … max):    11.7 ms …  13.6 ms    212 runs
```

Besides the speedup, skipcpio now parses the cpio header and is not
falsely ending when the early cpio payload contains `TRAILER!!!`.

Fixes: https://github.com/dracutdevs/dracut/issues/1123
skipcpio/skipcpio.c