Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1466833/?format=api
{ "id": 1466833, "url": "http://patchwork.ozlabs.org/api/patches/1466833/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20210416040924.2882771-3-danielwa@cisco.com/", "project": { "id": 2, "url": "http://patchwork.ozlabs.org/api/projects/2/?format=api", "name": "Linux PPC development", "link_name": "linuxppc-dev", "list_id": "linuxppc-dev.lists.ozlabs.org", "list_email": "linuxppc-dev@lists.ozlabs.org", "web_url": "https://github.com/linuxppc/wiki/wiki", "scm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git", "webscm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/", "list_archive_url_format": "https://lore.kernel.org/linuxppc-dev/{}/", "commit_url_format": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}" }, "msgid": "<20210416040924.2882771-3-danielwa@cisco.com>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20210416040924.2882771-3-danielwa@cisco.com/", "date": "2021-04-16T04:09:13", "name": "[2/8] scripts: insert-sys-cert: add command line insert capability", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": false, "hash": "fc8c92b86c86bf4324909b108be363a6c510686b", "submitter": { "id": 67374, "url": "http://patchwork.ozlabs.org/api/people/67374/?format=api", "name": "Daniel Walker (danielwa)", "email": "danielwa@cisco.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20210416040924.2882771-3-danielwa@cisco.com/mbox/", "series": [ { "id": 239425, "url": "http://patchwork.ozlabs.org/api/series/239425/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=239425", "date": "2021-04-16T04:09:11", "name": "generic command line v4", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/239425/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1466833/comments/", "check": "warning", "checks": "http://patchwork.ozlabs.org/api/patches/1466833/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>", "X-Original-To": [ "patchwork-incoming@ozlabs.org", "linuxppc-dev@lists.ozlabs.org" ], "Delivered-To": [ "patchwork-incoming@ozlabs.org", "linuxppc-dev@lists.ozlabs.org" ], "Authentication-Results": [ "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org;\n receiver=<UNKNOWN>)", "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=cisco.com header.i=@cisco.com header.a=rsa-sha256\n header.s=iport header.b=FVcz5IOB;\n\tdkim-atps=neutral", "lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=cisco.com header.i=@cisco.com header.a=rsa-sha256\n header.s=iport header.b=FVcz5IOB;\n\tdkim-atps=neutral", "lists.ozlabs.org; spf=pass (sender SPF authorized)\n smtp.mailfrom=cisco.com (client-ip=173.37.86.72; helo=rcdn-iport-1.cisco.com;\n envelope-from=danielwa@cisco.com; receiver=<UNKNOWN>)", "lists.ozlabs.org; dkim=pass (1024-bit key;\n unprotected) header.d=cisco.com header.i=@cisco.com header.a=rsa-sha256\n header.s=iport header.b=FVcz5IOB; dkim-atps=neutral" ], "Received": [ "from lists.ozlabs.org (lists.ozlabs.org\n [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4FM2nP5Yjtz9sVv\n\tfor <patchwork-incoming@ozlabs.org>; Fri, 16 Apr 2021 14:10:49 +1000 (AEST)", "from boromir.ozlabs.org (localhost [IPv6:::1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4FM2nP4hMZz3cBt\n\tfor <patchwork-incoming@ozlabs.org>; Fri, 16 Apr 2021 14:10:49 +1000 (AEST)", "from rcdn-iport-1.cisco.com (rcdn-iport-1.cisco.com [173.37.86.72])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n bits)) (No client certificate requested)\n by lists.ozlabs.org (Postfix) with ESMTPS id 4FM2ly0jTxz302y\n for <linuxppc-dev@lists.ozlabs.org>; Fri, 16 Apr 2021 14:09:33 +1000 (AEST)", "from alln-core-6.cisco.com ([173.36.13.139])\n by rcdn-iport-1.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA;\n 16 Apr 2021 04:09:30 +0000", "from zorba.cisco.com ([10.24.7.67])\n by alln-core-6.cisco.com (8.15.2/8.15.2) with ESMTP id 13G49OHh016753;\n Fri, 16 Apr 2021 04:09:29 GMT" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=cisco.com; i=@cisco.com; l=8964; q=dns/txt; s=iport;\n t=1618546174; x=1619755774;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=Ie6EtdAViAiALCeFYxNqsCsTGUdiUZbe/6PrULxlkAo=;\n b=FVcz5IOBUPzwD3bypEiRXzk5tfhK9APVk5HHGCR9+eHbgzU0nVwkCuVN\n Z40Kp1xVdcC2LmH6/ug4hhLAH9g0yzEEo/RgMTsue0SYnwidCxt59xD15\n 0aD86d+25joex5vGXh0IaBZSYOVYdSlqYLqz19HihnMWMVns5gdOcosKq g=;", "IronPort-HdrOrdr": "\n A9a23:WHWvQ6AC+De4gZnlHejxsceALOonbusQ8zAX/mp6ICY4TuWzkceykPMHkSLugDEKV3063fyGMq+MQXTTnKQFhbU5EL++UGDd1leAA5pl6eLZqQHIOyq7zeJF0LclTq4WMqySMXFfreLXpDa1CMwhxt7vytHMuc77w212RQ9nL4Fshj0ZNi+hHkd7RBZLCPMCffL22uN9qzWtYngRZMigb0N1PdTrncHBl57tfHc9aCIP1Q/mt16VwY+/OwSE2FMkXylXx7A5/Sz+jxXh/am4qZiAu3jh/l6Wy5xXndf7o+EiOOW8zu4INz7rlgGkIKNmVrHqhkFNnMifrHA3jdLLvxAse/5W1kqUVGS0rRzxsjOQtgoT1w==", "X-IronPort-Anti-Spam-Filtered": "true", "X-IronPort-Anti-Spam-Result": "\n A0BMAACIDXlg/4sNJK1aHAEBAQEBAQcBARIBAQQEAQGBfgcBAQsBAYIpgU0BOTGMZ4lOgQyZYoF8CwEBAQ80BAEBhFACgXMCJTQJDgIDAQEMAQEFAQEBAgEGBHEThV1DFgGFawYnCwFGEFFXBgESgnGDCKwHgXgzgQGIM4FEFIElAYhrdIN1JxyBSUKBE4JsdIo5BIFVawUBAXsTQ4FCY5ERi1SBf5wtgxaBJptRDyODTop8ljKVGJ8GMYQrgVQ6gVkzGggbFYMkUBkOjigDFo1rAVshAy84AgYKAQEDCYlOg0ABAQ", "X-IronPort-AV": "E=Sophos;i=\"5.82,226,1613433600\"; d=\"scan'208\";a=\"876181596\"", "From": "Daniel Walker <danielwa@cisco.com>", "To": "Will Deacon <will@kernel.org>,\n Christophe Leroy <christophe.leroy@csgroup.eu>,\n Rob Herring <robh@kernel.org>,\n Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>,\n Andrew Morton <akpm@linux-foundation.org>, x86@kernel.org,\n linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org", "Subject": "[PATCH 2/8] scripts: insert-sys-cert: add command line insert\n capability", "Date": "Thu, 15 Apr 2021 21:09:13 -0700", "Message-Id": "<20210416040924.2882771-3-danielwa@cisco.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20210416040924.2882771-1-danielwa@cisco.com>", "References": "<20210416040924.2882771-1-danielwa@cisco.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-Auto-Response-Suppress": "DR, OOF, AutoReply", "X-Outbound-SMTP-Client": "10.24.7.67, [10.24.7.67]", "X-Outbound-Node": "alln-core-6.cisco.com", "X-BeenThere": "linuxppc-dev@lists.ozlabs.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "Linux on PowerPC Developers Mail List <linuxppc-dev.lists.ozlabs.org>", "List-Unsubscribe": "<https://lists.ozlabs.org/options/linuxppc-dev>,\n <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>", "List-Archive": "<http://lists.ozlabs.org/pipermail/linuxppc-dev/>", "List-Post": "<mailto:linuxppc-dev@lists.ozlabs.org>", "List-Help": "<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>", "List-Subscribe": "<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>", "Cc": "linux-kernel@vger.kernel.org, xe-linux-external@cisco.com", "Errors-To": "linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org", "Sender": "\"Linuxppc-dev\"\n <linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>" }, "content": "This adds changes to the insert-sys-cert tool to allow updating\nthe cmdline_prepend and cmdline_append symbols in addition to\nadding certificates.\n\nUpdating the cmdline symbols was tested on a PVH virtual machine\nwith a vmlinux, and with a bzImage which was repackaged on x86.\n\nThis commit intentionally keeps the tool filename the same to allow\nthe changes to be seen more easily. The next commit will change\nthe name of the tool.\n\nCc: xe-linux-external@cisco.com\nSigned-off-by: Daniel Walker <danielwa@cisco.com>\n---\n scripts/insert-sys-cert.c | 241 +++++++++++++++++++++++++++-----------\n 1 file changed, 170 insertions(+), 71 deletions(-)", "diff": "diff --git a/scripts/insert-sys-cert.c b/scripts/insert-sys-cert.c\nindex 8902836c2342..77d3306cfbfb 100644\n--- a/scripts/insert-sys-cert.c\n+++ b/scripts/insert-sys-cert.c\n@@ -30,6 +30,9 @@\n #define USED_SYM \"system_extra_cert_used\"\n #define LSIZE_SYM \"system_certificate_list_size\"\n \n+#define CMDLINE_APPEND \"cmdline_append\"\n+#define CMDLINE_PREPEND \"cmdline_prepend\"\n+\n #define info(format, args...) fprintf(stderr, \"INFO: \" format, ## args)\n #define warn(format, args...) fprintf(stdout, \"WARNING: \" format, ## args)\n #define err(format, args...) fprintf(stderr, \"ERROR: \" format, ## args)\n@@ -267,95 +270,46 @@ static void print_sym(Elf_Ehdr *hdr, struct sym *s)\n \n static void print_usage(char *e)\n {\n-\tprintf(\"Usage %s [-s <System.map>] -b <vmlinux> -c <certfile>\\n\", e);\n+\tprintf(\"Usage %s [-s <System.map>] -b <vmlinux> [ -c <certfile> | -p <command line prepend> | -a <command line append> ]-\\n\", e);\n }\n \n-int main(int argc, char **argv)\n+static char *cmdline_prepend, *cmdline_append;\n+static char *system_map_file;\n+static char *cert_file;\n+static char *cli_name;\n+\n+static int insert_certificate(Elf_Ehdr *hdr)\n {\n-\tchar *system_map_file = NULL;\n-\tchar *vmlinux_file = NULL;\n-\tchar *cert_file = NULL;\n-\tint vmlinux_size;\n+\tstruct sym cert_sym, lsize_sym, used_sym;\n+\tElf_Shdr *symtab = NULL;\n+\tunsigned long *lsize;\n+\tFILE *system_map;\n \tint cert_size;\n-\tElf_Ehdr *hdr;\n \tchar *cert;\n-\tFILE *system_map;\n-\tunsigned long *lsize;\n \tint *used;\n-\tint opt;\n-\tElf_Shdr *symtab = NULL;\n-\tstruct sym cert_sym, lsize_sym, used_sym;\n-\n-\twhile ((opt = getopt(argc, argv, \"b:c:s:\")) != -1) {\n-\t\tswitch (opt) {\n-\t\tcase 's':\n-\t\t\tsystem_map_file = optarg;\n-\t\t\tbreak;\n-\t\tcase 'b':\n-\t\t\tvmlinux_file = optarg;\n-\t\t\tbreak;\n-\t\tcase 'c':\n-\t\t\tcert_file = optarg;\n-\t\t\tbreak;\n-\t\tdefault:\n-\t\t\tbreak;\n-\t\t}\n-\t}\n \n-\tif (!vmlinux_file || !cert_file) {\n-\t\tprint_usage(argv[0]);\n-\t\texit(EXIT_FAILURE);\n+\tif (!cert_file) {\n+\t\tprint_usage(cli_name);\n+\t\treturn EXIT_FAILURE;\n \t}\n \n \tcert = read_file(cert_file, &cert_size);\n \tif (!cert)\n-\t\texit(EXIT_FAILURE);\n-\n-\thdr = map_file(vmlinux_file, &vmlinux_size);\n-\tif (!hdr)\n-\t\texit(EXIT_FAILURE);\n-\n-\tif (vmlinux_size < sizeof(*hdr)) {\n-\t\terr(\"Invalid ELF file.\\n\");\n-\t\texit(EXIT_FAILURE);\n-\t}\n-\n-\tif ((hdr->e_ident[EI_MAG0] != ELFMAG0) ||\n-\t (hdr->e_ident[EI_MAG1] != ELFMAG1) ||\n-\t (hdr->e_ident[EI_MAG2] != ELFMAG2) ||\n-\t (hdr->e_ident[EI_MAG3] != ELFMAG3)) {\n-\t\terr(\"Invalid ELF magic.\\n\");\n-\t\texit(EXIT_FAILURE);\n-\t}\n-\n-\tif (hdr->e_ident[EI_CLASS] != CURRENT_ELFCLASS) {\n-\t\terr(\"ELF class mismatch.\\n\");\n-\t\texit(EXIT_FAILURE);\n-\t}\n-\n-\tif (hdr->e_ident[EI_DATA] != endianness()) {\n-\t\terr(\"ELF endian mismatch.\\n\");\n-\t\texit(EXIT_FAILURE);\n-\t}\n-\n-\tif (hdr->e_shoff > vmlinux_size) {\n-\t\terr(\"Could not find section header.\\n\");\n-\t\texit(EXIT_FAILURE);\n-\t}\n+\t\treturn EXIT_FAILURE;\n \n \tsymtab = get_symbol_table(hdr);\n \tif (!symtab) {\n \t\twarn(\"Could not find the symbol table.\\n\");\n \t\tif (!system_map_file) {\n \t\t\terr(\"Please provide a System.map file.\\n\");\n-\t\t\tprint_usage(argv[0]);\n-\t\t\texit(EXIT_FAILURE);\n+\t\t\tprint_usage(cli_name);\n+\t\t\treturn EXIT_FAILURE;\n \t\t}\n \n \t\tsystem_map = fopen(system_map_file, \"r\");\n \t\tif (!system_map) {\n \t\t\tperror(system_map_file);\n-\t\t\texit(EXIT_FAILURE);\n+\t\t\treturn EXIT_FAILURE;\n \t\t}\n \t\tget_symbol_from_map(hdr, system_map, CERT_SYM, &cert_sym);\n \t\tget_symbol_from_map(hdr, system_map, USED_SYM, &used_sym);\n@@ -371,7 +325,7 @@ int main(int argc, char **argv)\n \t}\n \n \tif (!cert_sym.offset || !lsize_sym.offset || !used_sym.offset)\n-\t\texit(EXIT_FAILURE);\n+\t\treturn EXIT_FAILURE;\n \n \tprint_sym(hdr, &cert_sym);\n \tprint_sym(hdr, &used_sym);\n@@ -382,14 +336,14 @@ int main(int argc, char **argv)\n \n \tif (cert_sym.size < cert_size) {\n \t\terr(\"Certificate is larger than the reserved area!\\n\");\n-\t\texit(EXIT_FAILURE);\n+\t\treturn EXIT_FAILURE;\n \t}\n \n \t/* If the existing cert is the same, don't overwrite */\n \tif (cert_size == *used &&\n \t strncmp(cert_sym.content, cert, cert_size) == 0) {\n \t\twarn(\"Certificate was already inserted.\\n\");\n-\t\texit(EXIT_SUCCESS);\n+\t\treturn EXIT_SUCCESS;\n \t}\n \n \tif (*used > 0)\n@@ -406,5 +360,150 @@ int main(int argc, char **argv)\n \t\t\t\t\t\tcert_sym.address);\n \tinfo(\"Used %d bytes out of %d bytes reserved.\\n\", *used,\n \t\t\t\t\t\t cert_sym.size);\n-\texit(EXIT_SUCCESS);\n+\treturn EXIT_SUCCESS;\n+}\n+\n+static int insert_cmdline(Elf_Ehdr *hdr)\n+{\n+\tstruct sym cmdline_prepend_sym, cmdline_append_sym;\n+\tElf_Shdr *symtab = NULL;\n+\tFILE *system_map;\n+\n+\tsymtab = get_symbol_table(hdr);\n+\tif (!symtab) {\n+\t\twarn(\"Could not find the symbol table.\\n\");\n+\t\tif (!system_map_file) {\n+\t\t\terr(\"Please provide a System.map file.\\n\");\n+\t\t\tprint_usage(cli_name);\n+\t\t\treturn EXIT_FAILURE;\n+\t\t}\n+\n+\t\tsystem_map = fopen(system_map_file, \"r\");\n+\t\tif (!system_map) {\n+\t\t\tperror(system_map_file);\n+\t\t\treturn EXIT_FAILURE;\n+\t\t}\n+\t\tget_symbol_from_map(hdr, system_map, CMDLINE_PREPEND, &cmdline_prepend_sym);\n+\t\tget_symbol_from_map(hdr, system_map, CMDLINE_APPEND, &cmdline_append_sym);\n+\t} else {\n+\t\tinfo(\"Symbol table found.\\n\");\n+\t\tif (system_map_file)\n+\t\t\twarn(\"System.map is ignored.\\n\");\n+\t\tget_symbol_from_table(hdr, symtab, CMDLINE_PREPEND, &cmdline_prepend_sym);\n+\t\tget_symbol_from_table(hdr, symtab, CMDLINE_APPEND, &cmdline_append_sym);\n+\t}\n+\n+\tprint_sym(hdr, &cmdline_prepend_sym);\n+\tprint_sym(hdr, &cmdline_append_sym);\n+\n+\n+\tif (cmdline_prepend) {\n+\t\tif ((strlen(cmdline_prepend) + 1) > cmdline_prepend_sym.size) {\n+\t\t\terr(\"cmdline prepend is larger than the reserved area!\\n\");\n+\t\t\treturn EXIT_FAILURE;\n+\t\t}\n+\n+\t\tmemcpy(cmdline_prepend_sym.content, cmdline_prepend, strlen(cmdline_prepend) + 1);\n+\t\tif ((strlen(cmdline_prepend) + 1) < cmdline_prepend_sym.size)\n+\t\t\tmemset(cmdline_prepend_sym.content + strlen(cmdline_prepend) + 1,\n+\t\t\t\t0, cmdline_prepend_sym.size - (strlen(cmdline_prepend) + 1));\n+\n+\t\tinfo(\"Inserted cmdline prepend of \\\"%s\\\" into vmlinux.\\n\", cmdline_prepend);\n+\n+\t}\n+\tif (cmdline_append) {\n+\t\tif ((strlen(cmdline_append) + 1) > cmdline_append_sym.size) {\n+\t\t\terr(\"cmdline append is larger than the reserved area!\\n\");\n+\t\t\treturn EXIT_FAILURE;\n+\t\t}\n+\n+\t\tmemcpy(cmdline_append_sym.content, cmdline_append, strlen(cmdline_append) + 1);\n+\t\tif ((strlen(cmdline_append) + 1) < cmdline_append_sym.size)\n+\t\t\tmemset(cmdline_append_sym.content + strlen(cmdline_append) + 1,\n+\t\t\t\t0, cmdline_append_sym.size - (strlen(cmdline_append) + 1));\n+\n+\t\tinfo(\"Inserted cmdline append of \\\"%s\\\" into vmlinux.\\n\", cmdline_append);\n+\n+\t}\n+\treturn EXIT_SUCCESS;\n+}\n+\n+int main(int argc, char **argv)\n+{\n+\tchar *vmlinux_file = NULL;\n+\tint vmlinux_size;\n+\tElf_Ehdr *hdr;\n+\tint opt;\n+\tint ret = EXIT_SUCCESS;\n+\n+\twhile ((opt = getopt(argc, argv, \"b:c:s:p:a:\")) != -1) {\n+\t\tswitch (opt) {\n+\t\tcase 's':\n+\t\t\tsystem_map_file = optarg;\n+\t\t\tbreak;\n+\t\tcase 'b':\n+\t\t\tvmlinux_file = optarg;\n+\t\t\tbreak;\n+\t\tcase 'c':\n+\t\t\tcert_file = optarg;\n+\t\t\tbreak;\n+\t\tcase 'p':\n+\t\t\tcmdline_prepend = optarg;\n+\t\t\tbreak;\n+\t\tcase 'a':\n+\t\t\tcmdline_append = optarg;\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\n+\tcli_name = argv[0];\n+\n+\tif (!vmlinux_file) {\n+\t\tprint_usage(cli_name);\n+\t\texit(EXIT_FAILURE);\n+\t}\n+\n+\thdr = map_file(vmlinux_file, &vmlinux_size);\n+\tif (!hdr)\n+\t\texit(EXIT_FAILURE);\n+\n+\tif (vmlinux_size < sizeof(*hdr)) {\n+\t\terr(\"Invalid ELF file.\\n\");\n+\t\texit(EXIT_FAILURE);\n+\t}\n+\n+\tif ((hdr->e_ident[EI_MAG0] != ELFMAG0) ||\n+\t (hdr->e_ident[EI_MAG1] != ELFMAG1) ||\n+\t (hdr->e_ident[EI_MAG2] != ELFMAG2) ||\n+\t (hdr->e_ident[EI_MAG3] != ELFMAG3)) {\n+\t\terr(\"Invalid ELF magic.\\n\");\n+\t\texit(EXIT_FAILURE);\n+\t}\n+\n+\tif (hdr->e_ident[EI_CLASS] != CURRENT_ELFCLASS) {\n+\t\terr(\"ELF class mismatch.\\n\");\n+\t\texit(EXIT_FAILURE);\n+\t}\n+\n+\tif (hdr->e_ident[EI_DATA] != endianness()) {\n+\t\terr(\"ELF endian mismatch.\\n\");\n+\t\texit(EXIT_FAILURE);\n+\t}\n+\n+\tif (hdr->e_shoff > vmlinux_size) {\n+\t\terr(\"Could not find section header.\\n\");\n+\t\texit(EXIT_FAILURE);\n+\t}\n+\n+\tif (cert_file) {\n+\t\tret = insert_certificate(hdr);\n+\t\tprintf(\"%s\\n\", cert_file);\n+\t}\n+\n+\tif (cmdline_append || cmdline_prepend)\n+\t\tret = insert_cmdline(hdr);\n+\n+\texit(ret);\n }\n", "prefixes": [ "2/8" ] }