^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * vdso2c - A vdso image preparation tool
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (c) 2014 Andy Lutomirski and others
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Licensed under the GPL v2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * vdso2c requires stripped and unstripped input. It would be trivial
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * to fully strip the input in here, but, for reasons described below,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * we need to write a section table. Doing this is more or less
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * equivalent to dropping all non-allocatable sections, but it's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * easier to let objcopy handle that instead of doing it ourselves.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * If we ever need to do something fancier than what objcopy provides,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * it would be straightforward to add here.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * We keep a section table for a few reasons:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * Binutils has issues debugging the vDSO: it reads the section table to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * find SHT_NOTE; it won't look at PT_NOTE for the in-memory vDSO, which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * would break build-id if we removed the section table. Binutils
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * also requires that shstrndx != 0. See:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * https://sourceware.org/bugzilla/show_bug.cgi?id=17064
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * elfutils might not look for PT_NOTE if there is a section table at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * all. I don't know whether this matters for any practical purpose.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * For simplicity, rather than hacking up a partial section table, we
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * just write a mostly complete one. We omit non-dynamic symbols,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * though, since they're rather large.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * Once binutils gets fixed, we might be able to drop this for all but
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * the 64-bit vdso, since build-id only works in kernel RPMs, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) * systems that update to new enough kernel RPMs will likely update
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) * binutils in sync. build-id has never worked for home-built kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * RPMs without manual symlinking, and I suspect that no one ever does
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) * that.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #include <inttypes.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #include <stdint.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #include <unistd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #include <stdarg.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #include <stdlib.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #include <stdio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #include <string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #include <fcntl.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #include <err.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) #include <sys/mman.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #include <sys/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #include <tools/be_byteshift.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) #include <linux/elf.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) const char *outfilename;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) /* Symbols that we need in vdso2c. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) sym_vvar_start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) sym_VDSO_FAKE_SECTION_TABLE_START,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) sym_VDSO_FAKE_SECTION_TABLE_END,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) struct vdso_sym {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) const char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) int export;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) struct vdso_sym required_syms[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) [sym_vvar_start] = {"vvar_start", 1},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) [sym_VDSO_FAKE_SECTION_TABLE_START] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) "VDSO_FAKE_SECTION_TABLE_START", 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) [sym_VDSO_FAKE_SECTION_TABLE_END] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) "VDSO_FAKE_SECTION_TABLE_END", 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) __attribute__((format(printf, 1, 2))) __attribute__((noreturn))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) static void fail(const char *format, ...)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) va_list ap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) va_start(ap, format);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) fprintf(stderr, "Error: ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) vfprintf(stderr, format, ap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) if (outfilename)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) unlink(outfilename);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) exit(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) va_end(ap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) * Evil macros for big-endian reads and writes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #define GBE(x, bits, ifnot) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) __builtin_choose_expr( \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) (sizeof(*(x)) == bits/8), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) (__typeof__(*(x)))get_unaligned_be##bits(x), ifnot)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) #define LAST_GBE(x) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) __builtin_choose_expr(sizeof(*(x)) == 1, *(x), (void)(0))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) #define GET_BE(x) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) GBE(x, 64, GBE(x, 32, GBE(x, 16, LAST_GBE(x))))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) #define PBE(x, val, bits, ifnot) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) __builtin_choose_expr( \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) (sizeof(*(x)) == bits/8), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) put_unaligned_be##bits((val), (x)), ifnot)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) #define LAST_PBE(x, val) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) __builtin_choose_expr(sizeof(*(x)) == 1, *(x) = (val), (void)(0))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) #define PUT_BE(x, val) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) PBE(x, val, 64, PBE(x, val, 32, PBE(x, val, 16, LAST_PBE(x, val))))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) #define NSYMS ARRAY_SIZE(required_syms)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) #define BITSFUNC3(name, bits, suffix) name##bits##suffix
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) #define BITSFUNC2(name, bits, suffix) BITSFUNC3(name, bits, suffix)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) #define BITSFUNC(name) BITSFUNC2(name, ELF_BITS, )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) #define INT_BITS BITSFUNC2(int, ELF_BITS, _t)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) #define ELF_BITS_XFORM2(bits, x) Elf##bits##_##x
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) #define ELF_BITS_XFORM(bits, x) ELF_BITS_XFORM2(bits, x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) #define ELF(x) ELF_BITS_XFORM(ELF_BITS, x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) #define ELF_BITS 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) #include "vdso2c.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) #undef ELF_BITS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) #define ELF_BITS 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) #include "vdso2c.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) #undef ELF_BITS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) static void go(void *raw_addr, size_t raw_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) void *stripped_addr, size_t stripped_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) FILE *outfile, const char *name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) Elf64_Ehdr *hdr = (Elf64_Ehdr *)raw_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) if (hdr->e_ident[EI_CLASS] == ELFCLASS64) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) go64(raw_addr, raw_len, stripped_addr, stripped_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) outfile, name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) } else if (hdr->e_ident[EI_CLASS] == ELFCLASS32) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) go32(raw_addr, raw_len, stripped_addr, stripped_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) outfile, name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) fail("unknown ELF class\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) static void map_input(const char *name, void **addr, size_t *len, int prot)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) off_t tmp_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) int fd = open(name, O_RDONLY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) if (fd == -1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) err(1, "%s", name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) tmp_len = lseek(fd, 0, SEEK_END);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) if (tmp_len == (off_t)-1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) err(1, "lseek");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) *len = (size_t)tmp_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) *addr = mmap(NULL, tmp_len, prot, MAP_PRIVATE, fd, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) if (*addr == MAP_FAILED)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) err(1, "mmap");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) close(fd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) int main(int argc, char **argv)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) size_t raw_len, stripped_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) void *raw_addr, *stripped_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) FILE *outfile;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) char *name, *tmp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) int namelen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) if (argc != 4) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) printf("Usage: vdso2c RAW_INPUT STRIPPED_INPUT OUTPUT\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) * Figure out the struct name. If we're writing to a .so file,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) * generate raw output insted.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) name = strdup(argv[3]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) namelen = strlen(name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) if (namelen >= 3 && !strcmp(name + namelen - 3, ".so")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) name = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) tmp = strrchr(name, '/');
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) if (tmp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) name = tmp + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) tmp = strchr(name, '.');
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) if (tmp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) *tmp = '\0';
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) for (tmp = name; *tmp; tmp++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) if (*tmp == '-')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) *tmp = '_';
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) map_input(argv[1], &raw_addr, &raw_len, PROT_READ);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) map_input(argv[2], &stripped_addr, &stripped_len, PROT_READ);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) outfilename = argv[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) outfile = fopen(outfilename, "w");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) if (!outfile)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) err(1, "%s", argv[2]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) go(raw_addr, raw_len, stripped_addr, stripped_len, outfile, name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) munmap(raw_addr, raw_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) munmap(stripped_addr, stripped_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) fclose(outfile);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) }