Skip to content

eBPF-based security platform

upatch: reserve the header's unused metadata fields

Jiri Olsa57734916b70e
diff --git a/Documentation/contribute/testing/proof-coverage.rst b/Documentation/contribute/testing/proof-coverage.rst
index 0a84c1df..906cd221 100644
--- a/Documentation/contribute/testing/proof-coverage.rst
+++ b/Documentation/contribute/testing/proof-coverage.rst
@@ -609,7 +609,7 @@ or shorter, and "lengths 0 to 6" every input of each of those lengths.
- Every file: the header is read from a buffer of exactly its size
for files of any size
- Reads nothing past the header; an accepted header has its magic,
- version, zero reserved field and a terminated name, a BPF or Java
+ version, zero reserved fields and a terminated name, a BPF or Java
payload, a signature, every section inside the file and behind
the header; a BPF payload has a loader of whole aligned
instructions and a ``.rodata`` offset inside the data, a Java
diff --git a/Documentation/reference/cli/upatch-info.rst b/Documentation/reference/cli/upatch-info.rst
index bd2d584e..aadb634a 100644
--- a/Documentation/reference/cli/upatch-info.rst
+++ b/Documentation/reference/cli/upatch-info.rst
@@ -65,8 +65,8 @@ Options
- off
- Print one JSON object: ``schema``, ``path``, ``name``, ``type``,
``payload_type``, ``version``, ``payload_sha256``,
- ``loader_insns_len``, ``signature_len``, ``metadata_len``,
- ``data_len``, ``log_buf_sz``, ``file_size``, ``signed_name``,
+ ``loader_insns_len``, ``signature_len``, ``data_len``,
+ ``log_buf_sz``, ``file_size``, ``signed_name``,
``attach_metadata_len``, ``jar_len`` (0 but for a Java load),
``unload_payload_sha256`` and ``decoders``.
@@ -106,7 +106,6 @@ Describe an artifact:
Loader:
Instructions: off=360 len=992
Log buffer size: 1048576
- Metadata: (none)
Data: off=6205 len=2456
Signature:
diff --git a/Documentation/reference/formats/upatch-format.rst b/Documentation/reference/formats/upatch-format.rst
index f1f5b519..3b539b00 100644
--- a/Documentation/reference/formats/upatch-format.rst
+++ b/Documentation/reference/formats/upatch-format.rst
@@ -53,10 +53,6 @@ order and what ``data`` holds.
- ``data_off``, ``data_len``
- The loader's data blob (``gen_loader_opts.data``), then the signed
sections, their directory and the trailer.
- * - ``metadata``
- - ``metadata_off``, ``metadata_len``
- - Absent. ``shirudo build`` sets both fields to 0. The target never
- reads this region.
.. figure:: /images/reference-upatch-layout.svg
:alt: A strip of the file: an unsigned 360-byte header, then
@@ -128,11 +124,11 @@ Header
- Non-zero.
* - 320
- 4
- - ``metadata_off``
+ - ``reserved2``
- 0.
* - 324
- 4
- - ``metadata_len``
+ - ``reserved3``
- 0.
* - 328
- 4
@@ -184,7 +180,7 @@ Signature
- Value
* - Signed bytes
- ``loader_insns`` followed by ``data``, exactly as stored. The header
- and ``metadata`` are outside the signature.
+ is outside the signature.
* - Encoding
- DER CMS ``SignedData``, detached (no encapsulated content), no
certificates. The signer is identified by its subject key
@@ -345,9 +341,8 @@ Java payloads
~~~~~~~~~~~~~
A Java payload (``type`` 2) carries a Java agent ``.jar`` instead of a BPF
-loader. It has no loader instructions and no ``metadata``, and
-``loader_insns_off``, ``log_buf_sz``, ``nr_maps``, ``nr_progs`` and
-``rodata_data_off`` are 0. Its ``data`` holds only signed sections, so the
+loader. It has no loader instructions, and ``loader_insns_off``,
+``log_buf_sz``, ``nr_maps``, ``nr_progs`` and ``rodata_data_off`` are 0. Its ``data`` holds only signed sections, so the
signature covers ``data`` alone and ``payload_sha256`` is SHA-256 of
``data``. The kernel never sees a Java payload. The target verifies its
signature in userspace with OpenSSL, against the unrevoked certificates of
@@ -770,10 +765,8 @@ signed bytes and trusts others as they are.
other signed bytes.
* - ``log_buf_sz``
- Ignored.
- * - ``metadata_off``, ``metadata_len``
- - Bounds-checked. Not read on the target.
- * - ``magic``, ``version``, ``type``, ``reserved1``, section offsets and
- lengths
+ * - ``magic``, ``version``, ``type``, ``reserved1`` to ``reserved3``,
+ section offsets and lengths
- Checked by the reader, see `Reader validation`_.
Reader validation
@@ -787,17 +780,17 @@ file.
#. ``magic`` equals ``0x53485244554e4150``.
#. ``version`` equals 1.
#. ``name`` contains a NUL.
-#. ``reserved1`` is 0.
-#. ``signature``, ``metadata`` and ``data`` each lie inside the file, and
- each non-empty one starts at or after offset 360.
+#. ``reserved1``, ``reserved2`` and ``reserved3`` are 0.
+#. ``signature`` and ``data`` each lie inside the file, and each
+ non-empty one starts at or after offset 360.
#. ``signature_len`` is not 0.
#. ``type`` is 1 or 2.
#. For ``type`` 1: ``loader_insns_off`` is at least 360 and a multiple of
8, ``loader_insns_len`` is a multiple of 8 and not 0, the region lies
inside the file, and ``rodata_data_off`` is at most ``data_len``.
#. For ``type`` 2: ``loader_insns_off``, ``loader_insns_len``,
- ``metadata_len``, ``log_buf_sz``, ``nr_maps``, ``nr_progs`` and
- ``rodata_data_off`` are 0, and ``data_len`` is not.
+ ``log_buf_sz``, ``nr_maps``, ``nr_progs`` and ``rodata_data_off`` are
+ 0, and ``data_len`` is not.
The reader then parses the signed sections. A failure here does not reject
the file. The reader treats the whole directory as absent, so a load or an
@@ -913,9 +906,9 @@ Versioning
A section tag the reader does not know makes it treat the directory as
absent. A new section therefore needs readers that know its tag before
writers emit it. Reserved fields are 0 in every file a writer emits. The
-reader checks ``reserved1``, the directory entries' ``reserved`` and the
-``UPUT`` ``reserved`` field. It does not check ``flags``
-bits 1 to 31 or the ``DCDB`` ``reserved`` field.
+reader checks ``reserved1`` to ``reserved3``, the directory entries'
+``reserved`` and the ``UPUT`` ``reserved`` field. It does not check
+``flags`` bits 1 to 31 or the ``DCDB`` ``reserved`` field.
Limits
------
diff --git a/Documentation/start/quickstart.rst b/Documentation/start/quickstart.rst
index 22b19b5f..d5ee7cee 100644
--- a/Documentation/start/quickstart.rst
+++ b/Documentation/start/quickstart.rst
@@ -352,7 +352,6 @@ VM enrolled its certificate. You sign with that key on the host.
Loader:
Instructions: off=360 len=992
Log buffer size: 1048576
- Metadata: (none)
Data: off=6205 len=2400
Signature:
diff --git a/Documentation/upatches/learn/kernel-fix-tutorial.rst b/Documentation/upatches/learn/kernel-fix-tutorial.rst
index 0ac5d333..71c8babb 100644
--- a/Documentation/upatches/learn/kernel-fix-tutorial.rst
+++ b/Documentation/upatches/learn/kernel-fix-tutorial.rst
@@ -209,7 +209,6 @@ Read the artifact back before it leaves the operator host:
Loader:
Instructions: off=360 len=1376
Log buffer size: 1048576
- Metadata: (none)
Data: off=6589 len=3480
Signature:
diff --git a/builtin-upatch.c b/builtin-upatch.c
index 98d1bab7..a9b67d8d 100644
--- a/builtin-upatch.c
+++ b/builtin-upatch.c
@@ -517,7 +517,6 @@ static int cmd_upatch_info(int argc, const char **argv)
json_kv_int(&e, "loader_insns_len",
u.hdr.loader_insns_len);
json_kv_int(&e, "signature_len", u.hdr.signature_len);
- json_kv_int(&e, "metadata_len", u.hdr.metadata_len);
json_kv_int(&e, "data_len", u.hdr.data_len);
json_kv_int(&e, "log_buf_sz", u.hdr.log_buf_sz);
json_kv_int(&e, "file_size", (__s64)u.map_size);
@@ -584,11 +583,6 @@ static int cmd_upatch_info(int argc, const char **argv)
printf(" %-22s off=%u len=%u\n", "Instructions:",
u.hdr.loader_insns_off, u.hdr.loader_insns_len);
printf(" %-22s %u\n", "Log buffer size:", u.hdr.log_buf_sz);
- if (u.hdr.metadata_len)
- printf(" %-22s off=%u len=%u\n", "Metadata:",
- u.hdr.metadata_off, u.hdr.metadata_len);
- else
- printf(" %-22s (none)\n", "Metadata:");
if (u.hdr.data_len)
printf(" %-22s off=%u len=%u\n", "Data:",
u.hdr.data_off, u.hdr.data_len);
diff --git a/include/shirudo/upatch.h b/include/shirudo/upatch.h
index 0fd8ce78..0741d139 100644
--- a/include/shirudo/upatch.h
+++ b/include/shirudo/upatch.h
@@ -52,8 +52,8 @@ struct upatch_header {
__le32 loader_insns_len;
__le32 signature_off;
__le32 signature_len;
- __le32 metadata_off;
- __le32 metadata_len;
+ __le32 reserved2; /* zero */
+ __le32 reserved3; /* zero */
__le32 data_off; /* gen_loader_opts.data */
__le32 data_len;
__le32 log_buf_sz; /* verifier-log buf size */
diff --git a/testing/functional/signing/t2002-mldsa-sign.sh b/testing/functional/signing/t2002-mldsa-sign.sh
index e076b32d..b6a02418 100755
--- a/testing/functional/signing/t2002-mldsa-sign.sh
+++ b/testing/functional/signing/t2002-mldsa-sign.sh
@@ -94,7 +94,8 @@ python3 - "$WORK/u.upatch" "$WORK" <<'PY'
import struct, sys
path, out = sys.argv[1], sys.argv[2]
b = open(path, "rb").read()
-ioff, ilen, soff, slen, moff, mlen, doff, dlen = struct.unpack_from("<8I", b, 304)
+ioff, ilen, soff, slen = struct.unpack_from("<4I", b, 304)
+doff, dlen = struct.unpack_from("<2I", b, 328)
open(out + "/sig.der", "wb").write(b[soff:soff + slen])
content = b[ioff:ioff + ilen] + (b[doff:doff + dlen] if doff else b"")
open(out + "/content.bin", "wb").write(content)
diff --git a/testing/functional/upatch/t3001-upatch-parse.sh b/testing/functional/upatch/t3001-upatch-parse.sh
index 66351328..b222070d 100644
--- a/testing/functional/upatch/t3001-upatch-parse.sh
+++ b/testing/functional/upatch/t3001-upatch-parse.sh
@@ -76,9 +76,8 @@ mutate("zero-signature", 316, "<I", 0)
mutate("loader-in-header", 304, "<I", 359)
mutate("signature-oob", 312, "<I", 0xfffffff0)
mutate("data-overflow", 328, "<I", 0xfffffff0)
-data = bytearray(header)
-struct.pack_into("<II", data, 320, 359, 1)
-(root / "metadata-in-header").write_bytes(data)
+mutate("reserved2", 320, "<I", 368)
+mutate("reserved3", 324, "<I", 1)
mutate("data-len-overflow", 332, "<I", 0xffffffff)
data = bytearray(header)
data[16:32] = b"a\x1b[2Jb\xc2\x9bc\xff".ljust(16, bytes([0]))
@@ -90,9 +89,9 @@ test_expect_success 'structured valid container parses' '
"$S" upatch info "$WORK/valid-structured" >/dev/null 2>&1
'
test_expect_success 'structured header and section bounds fail cleanly' '
- for f in bad-version rodata-offset-oob reserved1 zero-loader zero-signature \
- loader-in-header signature-oob data-overflow metadata-in-header \
- data-len-overflow; do reject "$WORK/$f" || exit 1; done
+ for f in bad-version rodata-offset-oob reserved1 reserved2 reserved3 \
+ zero-loader zero-signature loader-in-header signature-oob \
+ data-overflow data-len-overflow; do reject "$WORK/$f" || exit 1; done
'
test_expect_success 'a name from the file shows its controls as ?' '
"$S" upatch info "$WORK/controls-in-name" >"$WORK/info.out" 2>&1 &&
diff --git a/testing/functional/upatch/t3014-java-build.sh b/testing/functional/upatch/t3014-java-build.sh
index 05fab9ce..b6ed2be1 100755
--- a/testing/functional/upatch/t3014-java-build.sh
+++ b/testing/functional/upatch/t3014-java-build.sh
@@ -56,7 +56,7 @@ test_expect_success 'a jar becomes a signed Java load' '
assert d["type"] == "load", d
assert d["payload_type"] == "java", d
assert d["name"] == "agent" and d["signed_name"] == "agent", d
- assert d["loader_insns_len"] == 0 and d["metadata_len"] == 0, d
+ assert d["loader_insns_len"] == 0, d
assert d["signature_len"] > 0, d
assert d["jar_len"] == len(jar), d
assert d["attach_metadata_len"] == 0 and not d["decoders"], d
diff --git a/testing/proofs/cbmc/upatch-header.c b/testing/proofs/cbmc/upatch-header.c
index c83a994f..1f381f68 100644
--- a/testing/proofs/cbmc/upatch-header.c
+++ b/testing/proofs/cbmc/upatch-header.c
@@ -29,8 +29,9 @@ void harness(void)
return;
__CPROVER_assert(n >= UPATCH_HEADER_SIZE, "a whole header");
__CPROVER_assert(h.magic == UPATCH_MAGIC &&
- h.version == UPATCH_VERSION && !h.reserved1,
- "its magic, version and zero reserved field");
+ h.version == UPATCH_VERSION && !h.reserved1 &&
+ !h.reserved2 && !h.reserved3,
+ "its magic, version and zero reserved fields");
__CPROVER_assert(memchr(h.name, '\0', sizeof(h.name)),
"a terminated name");
if (validate_bounds(&h, n))
@@ -39,13 +40,12 @@ void harness(void)
h.type == UPATCH_TYPE_JAVA, "a known payload");
__CPROVER_assert(inside(h.loader_insns_off, h.loader_insns_len, n) &&
inside(h.signature_off, h.signature_len, n) &&
- inside(h.metadata_off, h.metadata_len, n) &&
inside(h.data_off, h.data_len, n),
"every section inside the file, behind the header");
__CPROVER_assert(h.signature_len, "a signature");
if (h.type == UPATCH_TYPE_JAVA) {
__CPROVER_assert(!h.loader_insns_off && !h.loader_insns_len &&
- !h.metadata_len && !h.log_buf_sz &&
+ !h.log_buf_sz &&
!h.nr_maps && !h.nr_progs &&
!h.rodata_data_off && h.data_len,
"data alone, without a loader's fields");
diff --git a/testing/proofs/cbmc/upatch-writer-header.c b/testing/proofs/cbmc/upatch-writer-header.c
index ade01ade..602b8b0a 100644
--- a/testing/proofs/cbmc/upatch-writer-header.c
+++ b/testing/proofs/cbmc/upatch-writer-header.c
@@ -22,7 +22,7 @@
void harness(void)
{
- __u32 loader_off, loader_len, sig_off, sig_len, meta_off, meta_len;
+ __u32 loader_off, loader_len, sig_off, sig_len;
__u32 data_off, data_len, log_buf_sz, rodata_data_off;
__u32 type, flags, nr_maps, nr_progs;
__u8 payload[UPATCH_PAYLOAD_HASH_LEN];
@@ -40,9 +40,8 @@ void harness(void)
strnlen(name, len) == len);
__CPROVER_assert(!pack_header(&h, name, type, flags, payload,
loader_off, loader_len, sig_off, sig_len,
- meta_off, meta_len, data_off, data_len,
- log_buf_sz, rodata_data_off, nr_maps,
- nr_progs),
+ data_off, data_len, log_buf_sz,
+ rodata_data_off, nr_maps, nr_progs),
"a name shorter than the field is packed");
__CPROVER_assume(n >= sizeof(h));
__CPROVER_assert(!parse_header((const __u8 *)&h, n, &out),
@@ -56,8 +55,6 @@ void harness(void)
out.loader_insns_len == loader_len &&
out.signature_off == sig_off &&
out.signature_len == sig_len &&
- out.metadata_off == meta_off &&
- out.metadata_len == meta_len &&
out.data_off == data_off && out.data_len == data_len,
"the offset and length of every section");
__CPROVER_assume(i < sizeof(name));
diff --git a/tools/shirudo-build/package.c b/tools/shirudo-build/package.c
index 9383899b..322f9e59 100644
--- a/tools/shirudo-build/package.c
+++ b/tools/shirudo-build/package.c
@@ -93,7 +93,6 @@ pack_header(struct upatch_header *h,
const __u8 *payload_sha256,
__u32 loader_off, __u32 loader_len,
__u32 sig_off, __u32 sig_len,
- __u32 meta_off, __u32 meta_len,
__u32 data_off, __u32 data_len,
__u32 log_buf_sz,
__u32 rodata_data_off, __u32 nr_maps, __u32 nr_progs)
@@ -110,8 +109,6 @@ pack_header(struct upatch_header *h,
h->loader_insns_len = cpu_to_le32(loader_len);
h->signature_off = cpu_to_le32(sig_off);
h->signature_len = cpu_to_le32(sig_len);
- h->metadata_off = cpu_to_le32(meta_off);
- h->metadata_len = cpu_to_le32(meta_len);
h->data_off = cpu_to_le32(data_off);
h->data_len = cpu_to_le32(data_len);
h->log_buf_sz = cpu_to_le32(log_buf_sz);
@@ -189,10 +186,9 @@ static int package_resign_symbols(const char *original,
const __u8 *src_data, *mod_data;
bool range_found[16] = {};
char name[UPATCH_NAME_MAX + 1];
- __u32 loader_off, sig_off, data_off, meta_off;
+ __u32 loader_off, sig_off, data_off, end;
__u8 *sig_buf = NULL;
size_t i, j;
- __u64 total;
bool wrote = false;
int fd = -1;
int ret;
@@ -215,14 +211,10 @@ static int package_resign_symbols(const char *original,
src.hdr.loader_insns_len != mod.hdr.loader_insns_len ||
src.hdr.signature_len != mod.hdr.signature_len ||
src.hdr.data_len != mod.hdr.data_len ||
- src.hdr.metadata_len != mod.hdr.metadata_len ||
memcmp(upatch_loader(&src), upatch_loader(&mod),
src.hdr.loader_insns_len) ||
memcmp(upatch_signature(&src), upatch_signature(&mod),
- src.hdr.signature_len) ||
- (src.hdr.metadata_len &&
- memcmp(upatch_metadata(&src), upatch_metadata(&mod),
- src.hdr.metadata_len))) {
+ src.hdr.signature_len)) {
ret = -EINVAL;
goto out;
}
@@ -291,12 +283,11 @@ static int package_resign_symbols(const char *original,
loader_off = sizeof(hdr);
if (check_add_overflow(loader_off, sio.insns_sz, &sig_off) ||
check_add_overflow(sig_off, sio.signature_sz, &data_off) ||
- check_add_overflow(data_off, sio.data_sz, &meta_off)) {
+ check_add_overflow(data_off, sio.data_sz, &end)) {
ret = -EOVERFLOW;
goto out;
}
- total = (__u64)meta_off + mod.hdr.metadata_len;
- if (total > UPATCH_FILE_MAX) {
+ if (end > UPATCH_FILE_MAX) {
ret = -E2BIG;
goto out;
}
@@ -305,8 +296,6 @@ static int package_resign_symbols(const char *original,
sio.payload_sha256,
loader_off, (__u32)sio.insns_sz,
sig_off, (__u32)sio.signature_sz,
- mod.hdr.metadata_len ? meta_off : 0,
- mod.hdr.metadata_len,
sio.data_sz ? data_off : 0, (__u32)sio.data_sz,
mod.hdr.log_buf_sz, mod.hdr.rodata_data_off,
mod.hdr.nr_maps, mod.hdr.nr_progs);
@@ -329,8 +318,6 @@ static int package_resign_symbols(const char *original,
ret = write_complete(fd, sig_buf, sio.signature_sz);
if (!ret && sio.data_sz)
ret = write_complete(fd, sio.data, sio.data_sz);
- if (!ret && mod.hdr.metadata_len)
- ret = write_complete(fd, upatch_metadata(&mod), mod.hdr.metadata_len);
if (!ret && fsync(fd) != 0)
ret = -errno;
out:
@@ -2186,7 +2173,6 @@ static int finalize_object(struct bpf_object *obj, const char *out_path,
sio.payload_sha256,
loader_off, opts.insns_sz,
sig_off, (__u32)sio.signature_sz,
- 0, 0,
data_off, data_len,
1u * 1024u * 1024u,
rodata_data_off, nr_maps, nr_progs);
@@ -2463,7 +2449,7 @@ static int finalize_java(const char *out_path, const char *upatch_name,
}
err = pack_header(&hdr, upatch_name, UPATCH_TYPE_JAVA, flags,
sio.payload_sha256, 0, 0,
- (__u32)sizeof(hdr), (__u32)sio.signature_sz, 0, 0,
+ (__u32)sizeof(hdr), (__u32)sio.signature_sz,
data_off, signed_data_len, 0, 0, 0, 0);
if (!err)
err = write_artifact(out_path, &hdr, NULL, 0, sig_buf,
diff --git a/upatches/kernel-obs/rewrite_watch_upatch.py b/upatches/kernel-obs/rewrite_watch_upatch.py
index 41ba14e4..579f7bda 100644
--- a/upatches/kernel-obs/rewrite_watch_upatch.py
+++ b/upatches/kernel-obs/rewrite_watch_upatch.py
@@ -266,13 +266,11 @@ def rewrite(args):
magic, version, flags = struct.unpack_from("<QII", artifact, 0)
if magic != 0x53485244554e4150 or version != 1 or flags & 1:
raise RewriteError("input must be a version 1 load upatch")
- loader_off, loader_len, sig_off, sig_len, meta_off, meta_len, \
- data_off, data_len = struct.unpack_from("<8I", artifact, 304)
+ loader_off, loader_len, sig_off, sig_len = struct.unpack_from("<4I", artifact, 304)
+ data_off, data_len = struct.unpack_from("<2I", artifact, 328)
if (loader_off > len(artifact) or loader_len > len(artifact) - loader_off or
data_off > len(artifact) or data_len > len(artifact) - data_off or
- sig_off > len(artifact) or sig_len > len(artifact) - sig_off or
- (meta_len and (meta_off > len(artifact) or
- meta_len > len(artifact) - meta_off))):
+ sig_off > len(artifact) or sig_len > len(artifact) - sig_off):
raise RewriteError("upatch section bounds are invalid")
data_blob = artifact[data_off:data_off + data_len]
types, variables = read_watch_arrays(data_blob)
diff --git a/util/upatch.c b/util/upatch.c
index 95c95ad1..94220d44 100644
--- a/util/upatch.c
+++ b/util/upatch.c
@@ -59,9 +59,9 @@ static int parse_header(const __u8 *m, size_t n,
p += 4;
out->signature_len = get_le32(p);
p += 4;
- out->metadata_off = get_le32(p);
+ out->reserved2 = get_le32(p);
p += 4;
- out->metadata_len = get_le32(p);
+ out->reserved3 = get_le32(p);
p += 4;
out->data_off = get_le32(p);
p += 4;
@@ -78,7 +78,7 @@ static int parse_header(const __u8 *m, size_t n,
out->type = get_le32(p);
p += 4;
out->reserved1 = get_le32(p);
- if (out->reserved1 != 0)
+ if (out->reserved1 || out->reserved2 || out->reserved3)
return -EINVAL;
return 0;
}
@@ -109,7 +109,7 @@ static int validate_bpf_bounds(const struct upatch_host_header *h,
/* A Java payload is all data: none of the loader's fields apply. */
static int validate_java_bounds(const struct upatch_host_header *h)
{
- if (h->loader_insns_off || h->loader_insns_len || h->metadata_len ||
+ if (h->loader_insns_off || h->loader_insns_len ||
h->log_buf_sz || h->nr_maps || h->nr_progs ||
h->rodata_data_off || h->data_len == 0)
return -EINVAL;
@@ -121,8 +121,6 @@ static int validate_bounds(const struct upatch_host_header *h,
{
if (!section_inside(h->signature_off, h->signature_len, n))
return -EINVAL;
- if (!section_inside(h->metadata_off, h->metadata_len, n))
- return -EINVAL;
if (!section_inside(h->data_off, h->data_len, n))
return -EINVAL;
if (h->signature_len == 0)
@@ -556,13 +554,6 @@ const void *upatch_signature(const struct upatch *u)
return u->map + u->hdr.signature_off;
}
-const void *upatch_metadata(const struct upatch *u)
-{
- if (!u->map || u->hdr.metadata_len == 0)
- return NULL;
- return u->map + u->hdr.metadata_off;
-}
-
const void *upatch_data(const struct upatch *u)
{
if (!u->map || u->hdr.data_len == 0)
diff --git a/util/upatch.h b/util/upatch.h
index 6e170ec0..f9a23106 100644
--- a/util/upatch.h
+++ b/util/upatch.h
@@ -29,8 +29,8 @@ struct upatch_host_header {
__u32 loader_insns_len;
__u32 signature_off;
__u32 signature_len;
- __u32 metadata_off;
- __u32 metadata_len;
+ __u32 reserved2;
+ __u32 reserved3;
__u32 data_off;
__u32 data_len;
__u32 log_buf_sz;
@@ -91,7 +91,6 @@ void upatch_close(struct upatch *u);
*/
const void *upatch_loader(const struct upatch *u);
const void *upatch_signature(const struct upatch *u);
-const void *upatch_metadata(const struct upatch *u);
const void *upatch_data(const struct upatch *u);
bool upatch_is_unload(const struct upatch *u);