1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
4 This file is part of systemd.
6 Copyright 2012 Lennart Poettering
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
29 #include "journal-def.h"
30 #include "journal-file.h"
31 #include "journal-authenticate.h"
32 #include "journal-verify.h"
37 static int journal_file_object_verify(JournalFile *f, Object *o) {
43 /* This does various superficial tests about the length an
44 * possible field values. It does not follow any references to
47 if ((o->object.flags & OBJECT_COMPRESSED) &&
48 o->object.type != OBJECT_DATA)
51 switch (o->object.type) {
56 if (le64toh(o->data.entry_offset) <= 0 ||
57 le64toh(o->data.n_entries) <= 0)
60 if (le64toh(o->object.size) - offsetof(DataObject, payload) <= 0)
63 h1 = le64toh(o->data.hash);
65 if (o->object.flags & OBJECT_COMPRESSED) {
68 uint64_t alloc = 0, b_size;
70 if (!uncompress_blob(o->data.payload,
71 le64toh(o->object.size) - offsetof(Object, data.payload),
72 &b, &alloc, &b_size, 0))
75 h2 = hash64(b, b_size);
78 return -EPROTONOSUPPORT;
81 h2 = hash64(o->data.payload, le64toh(o->object.size) - offsetof(Object, data.payload));
86 if (!VALID64(o->data.next_hash_offset) ||
87 !VALID64(o->data.next_field_offset) ||
88 !VALID64(o->data.entry_offset) ||
89 !VALID64(o->data.entry_array_offset))
96 if (le64toh(o->object.size) - offsetof(FieldObject, payload) <= 0)
99 if (!VALID64(o->field.next_hash_offset) ||
100 !VALID64(o->field.head_data_offset))
105 if ((le64toh(o->object.size) - offsetof(EntryObject, items)) % sizeof(EntryItem) != 0)
108 if ((le64toh(o->object.size) - offsetof(EntryObject, items)) / sizeof(EntryItem) <= 0)
111 if (le64toh(o->entry.seqnum) <= 0 ||
112 !VALID_REALTIME(le64toh(o->entry.realtime)) ||
113 !VALID_MONOTONIC(le64toh(o->entry.monotonic)))
116 for (i = 0; i < journal_file_entry_n_items(o); i++) {
117 if (o->entry.items[i].object_offset == 0 ||
118 !VALID64(o->entry.items[i].object_offset))
124 case OBJECT_DATA_HASH_TABLE:
125 case OBJECT_FIELD_HASH_TABLE:
126 if ((le64toh(o->object.size) - offsetof(HashTableObject, items)) % sizeof(HashItem) != 0)
129 if ((le64toh(o->object.size) - offsetof(HashTableObject, items)) / sizeof(HashItem) <= 0)
132 for (i = 0; i < journal_file_hash_table_n_items(o); i++) {
133 if (o->hash_table.items[i].head_hash_offset != 0 &&
134 !VALID64(le64toh(o->hash_table.items[i].head_hash_offset)))
136 if (o->hash_table.items[i].tail_hash_offset != 0 &&
137 !VALID64(le64toh(o->hash_table.items[i].tail_hash_offset)))
140 if ((o->hash_table.items[i].head_hash_offset != 0) !=
141 (o->hash_table.items[i].tail_hash_offset != 0))
147 case OBJECT_ENTRY_ARRAY:
148 if ((le64toh(o->object.size) - offsetof(EntryArrayObject, items)) % sizeof(le64_t) != 0)
151 if ((le64toh(o->object.size) - offsetof(EntryArrayObject, items)) / sizeof(le64_t) <= 0)
154 if (!VALID64(o->entry_array.next_entry_array_offset))
157 for (i = 0; i < journal_file_entry_array_n_items(o); i++)
158 if (o->entry_array.items[i] != 0 &&
159 !VALID64(o->entry_array.items[i]))
165 if (le64toh(o->object.size) != sizeof(TagObject))
168 if (!VALID_EPOCH(o->tag.epoch))
177 static void draw_progress(uint64_t p, usec_t *last_usec) {
184 z = now(CLOCK_MONOTONIC);
187 if (x != 0 && x + 40 * USEC_PER_MSEC > z)
192 n = (3 * columns()) / 4;
193 j = (n * (unsigned) p) / 65535ULL;
196 fputs("\r\x1B[?25l" ANSI_HIGHLIGHT_GREEN_ON, stdout);
198 for (i = 0; i < j; i++)
199 fputs("\xe2\x96\x88", stdout);
201 fputs(ANSI_HIGHLIGHT_OFF, stdout);
203 for (i = 0; i < k; i++)
204 fputs("\xe2\x96\x91", stdout);
206 printf(" %3lu%%", 100LU * (unsigned long) p / 65535LU);
208 fputs("\r\x1B[?25h", stdout);
212 static void flush_progress(void) {
218 n = (3 * columns()) / 4;
222 for (i = 0; i < n + 5; i++)
229 static int write_uint64(int fd, uint64_t p) {
232 k = write(fd, &p, sizeof(p));
241 static int contains_uint64(MMapCache *m, int fd, uint64_t n, uint64_t p) {
256 r = mmap_cache_get(m, fd, PROT_READ|PROT_WRITE, 0, false, c * sizeof(uint64_t), sizeof(uint64_t), NULL, (void **) &z);
275 static int entry_points_to_data(
288 assert(entry_fd >= 0);
290 if (!contains_uint64(f->mmap, entry_fd, n_entries, entry_p)) {
291 log_error("Data object references invalid entry at %llu", (unsigned long long) data_p);
295 r = journal_file_move_to_object(f, OBJECT_ENTRY, entry_p, &o);
299 n = journal_file_entry_n_items(o);
300 for (i = 0; i < n; i++)
301 if (le64toh(o->entry.items[i].object_offset) == data_p) {
307 log_error("Data object not referenced by linked entry at %llu", (unsigned long long) data_p);
311 /* Check if this entry is also in main entry array. Since the
312 * main entry array has already been verified we can rely on
316 n = le64toh(f->header->n_entries);
317 a = le64toh(f->header->entry_array_offset);
322 r = journal_file_move_to_object(f, OBJECT_ENTRY_ARRAY, a, &o);
326 m = journal_file_entry_array_n_items(o);
329 if (entry_p <= le64toh(o->entry_array.items[u-1])) {
338 if (le64toh(o->entry_array.items[z]) == entry_p)
344 if (entry_p < le64toh(o->entry_array.items[z]))
350 log_error("Entry object doesn't exist in main entry array at %llu", (unsigned long long) entry_p);
355 a = le64toh(o->entry_array.next_entry_array_offset);
361 static int verify_data(
363 Object *o, uint64_t p,
364 int entry_fd, uint64_t n_entries,
365 int entry_array_fd, uint64_t n_entry_arrays) {
367 uint64_t i, n, a, last, q;
372 assert(entry_fd >= 0);
373 assert(entry_array_fd >= 0);
375 n = le64toh(o->data.n_entries);
376 a = le64toh(o->data.entry_array_offset);
378 /* We already checked this earlier */
381 last = q = le64toh(o->data.entry_offset);
382 r = entry_points_to_data(f, entry_fd, n_entries, q, p);
391 log_error("Array chain too short at %llu", (unsigned long long) p);
395 if (!contains_uint64(f->mmap, entry_array_fd, n_entry_arrays, a)) {
396 log_error("Invalid array at %llu", (unsigned long long) p);
400 r = journal_file_move_to_object(f, OBJECT_ENTRY_ARRAY, a, &o);
404 next = le64toh(o->entry_array.next_entry_array_offset);
405 if (next != 0 && next <= a) {
406 log_error("Array chain has cycle at %llu", (unsigned long long) p);
410 m = journal_file_entry_array_n_items(o);
411 for (j = 0; i < n && j < m; i++, j++) {
413 q = le64toh(o->entry_array.items[j]);
415 log_error("Data object's entry array not sorted at %llu", (unsigned long long) p);
420 r = entry_points_to_data(f, entry_fd, n_entries, q, p);
424 /* Pointer might have moved, reposition */
425 r = journal_file_move_to_object(f, OBJECT_ENTRY_ARRAY, a, &o);
436 static int verify_hash_table(
438 int data_fd, uint64_t n_data,
439 int entry_fd, uint64_t n_entries,
440 int entry_array_fd, uint64_t n_entry_arrays,
442 bool show_progress) {
448 assert(data_fd >= 0);
449 assert(entry_fd >= 0);
450 assert(entry_array_fd >= 0);
453 n = le64toh(f->header->data_hash_table_size) / sizeof(HashItem);
454 for (i = 0; i < n; i++) {
455 uint64_t last = 0, p;
458 draw_progress(0xC000 + (0x3FFF * i / n), last_usec);
460 p = le64toh(f->data_hash_table[i].head_hash_offset);
465 if (!contains_uint64(f->mmap, data_fd, n_data, p)) {
466 log_error("Invalid data object at hash entry %llu of %llu",
467 (unsigned long long) i, (unsigned long long) n);
471 r = journal_file_move_to_object(f, OBJECT_DATA, p, &o);
475 next = le64toh(o->data.next_hash_offset);
476 if (next != 0 && next <= p) {
477 log_error("Hash chain has a cycle in hash entry %llu of %llu",
478 (unsigned long long) i, (unsigned long long) n);
482 if (le64toh(o->data.hash) % n != i) {
483 log_error("Hash value mismatch in hash entry %llu of %llu",
484 (unsigned long long) i, (unsigned long long) n);
488 r = verify_data(f, o, p, entry_fd, n_entries, entry_array_fd, n_entry_arrays);
496 if (last != le64toh(f->data_hash_table[i].tail_hash_offset)) {
497 log_error("Tail hash pointer mismatch in hash table");
505 static int data_object_in_hash_table(JournalFile *f, uint64_t hash, uint64_t p) {
510 n = le64toh(f->header->data_hash_table_size) / sizeof(HashItem);
513 q = le64toh(f->data_hash_table[h].head_hash_offset);
520 r = journal_file_move_to_object(f, OBJECT_DATA, q, &o);
524 q = le64toh(o->data.next_hash_offset);
530 static int verify_entry(
532 Object *o, uint64_t p,
533 int data_fd, uint64_t n_data) {
540 assert(data_fd >= 0);
542 n = journal_file_entry_n_items(o);
543 for (i = 0; i < n; i++) {
547 q = le64toh(o->entry.items[i].object_offset);
548 h = le64toh(o->entry.items[i].hash);
550 if (!contains_uint64(f->mmap, data_fd, n_data, q)) {
551 log_error("Invalid data object at entry %llu",
552 (unsigned long long) p);
556 r = journal_file_move_to_object(f, OBJECT_DATA, q, &u);
560 if (le64toh(u->data.hash) != h) {
561 log_error("Hash mismatch for data object at entry %llu",
562 (unsigned long long) p);
566 r = data_object_in_hash_table(f, h, q);
570 log_error("Data object missing from hash at entry %llu",
571 (unsigned long long) p);
579 static int verify_entry_array(
581 int data_fd, uint64_t n_data,
582 int entry_fd, uint64_t n_entries,
583 int entry_array_fd, uint64_t n_entry_arrays,
585 bool show_progress) {
587 uint64_t i = 0, a, n, last = 0;
591 assert(data_fd >= 0);
592 assert(entry_fd >= 0);
593 assert(entry_array_fd >= 0);
596 n = le64toh(f->header->n_entries);
597 a = le64toh(f->header->entry_array_offset);
603 draw_progress(0x8000 + (0x3FFF * i / n), last_usec);
606 log_error("Array chain too short at %llu of %llu",
607 (unsigned long long) i, (unsigned long long) n);
611 if (!contains_uint64(f->mmap, entry_array_fd, n_entry_arrays, a)) {
612 log_error("Invalid array at %llu of %llu",
613 (unsigned long long) i, (unsigned long long) n);
617 r = journal_file_move_to_object(f, OBJECT_ENTRY_ARRAY, a, &o);
621 next = le64toh(o->entry_array.next_entry_array_offset);
622 if (next != 0 && next <= a) {
623 log_error("Array chain has cycle at %llu of %llu",
624 (unsigned long long) i, (unsigned long long) n);
628 m = journal_file_entry_array_n_items(o);
629 for (j = 0; i < n && j < m; i++, j++) {
632 p = le64toh(o->entry_array.items[j]);
634 log_error("Entry array not sorted at %llu of %llu",
635 (unsigned long long) i, (unsigned long long) n);
640 if (!contains_uint64(f->mmap, entry_fd, n_entries, p)) {
641 log_error("Invalid array entry at %llu of %llu",
642 (unsigned long long) i, (unsigned long long) n);
646 r = journal_file_move_to_object(f, OBJECT_ENTRY, p, &o);
650 r = verify_entry(f, o, p, data_fd, n_data);
654 /* Pointer might have moved, reposition */
655 r = journal_file_move_to_object(f, OBJECT_ENTRY_ARRAY, a, &o);
666 int journal_file_verify(
669 usec_t *first_contained, usec_t *last_validated, usec_t *last_contained,
670 bool show_progress) {
673 uint64_t p = 0, last_epoch = 0, last_tag_realtime = 0, last_sealed_realtime = 0;
675 uint64_t entry_seqnum = 0, entry_monotonic = 0, entry_realtime = 0;
676 sd_id128_t entry_boot_id;
677 bool entry_seqnum_set = false, entry_monotonic_set = false, entry_realtime_set = false, found_main_entry_array = false;
678 uint64_t n_weird = 0, n_objects = 0, n_entries = 0, n_data = 0, n_fields = 0, n_data_hash_tables = 0, n_field_hash_tables = 0, n_entry_arrays = 0, n_tags = 0;
679 usec_t last_usec = 0;
680 int data_fd = -1, entry_fd = -1, entry_array_fd = -1;
681 char data_path[] = "/var/tmp/journal-data-XXXXXX",
682 entry_path[] = "/var/tmp/journal-entry-XXXXXX",
683 entry_array_path[] = "/var/tmp/journal-entry-array-XXXXXX";
687 uint64_t last_tag = 0;
693 r = journal_file_parse_verification_key(f, key);
695 log_error("Failed to parse seed.");
704 data_fd = mkostemp(data_path, O_CLOEXEC);
706 log_error("Failed to create data file: %m");
712 entry_fd = mkostemp(entry_path, O_CLOEXEC);
714 log_error("Failed to create entry file: %m");
720 entry_array_fd = mkostemp(entry_array_path, O_CLOEXEC);
721 if (entry_array_fd < 0) {
722 log_error("Failed to create entry array file: %m");
726 unlink(entry_array_path);
729 if ((le32toh(f->header->compatible_flags) & ~HEADER_COMPATIBLE_SEALED) != 0)
731 if (f->header->compatible_flags != 0)
734 log_error("Cannot verify file with unknown extensions.");
739 for (i = 0; i < sizeof(f->header->reserved); i++)
740 if (f->header->reserved[i] != 0) {
741 log_error("Reserved field in non-zero.");
746 /* First iteration: we go through all objects, verify the
747 * superficial structure, headers, hashes. */
749 p = le64toh(f->header->header_size);
752 draw_progress(0x7FFF * p / le64toh(f->header->tail_object_offset), &last_usec);
754 r = journal_file_move_to_object(f, -1, p, &o);
756 log_error("Invalid object at %llu", (unsigned long long) p);
760 if (p > le64toh(f->header->tail_object_offset)) {
761 log_error("Invalid tail object pointer");
766 if (p == le64toh(f->header->tail_object_offset))
771 r = journal_file_object_verify(f, o);
773 log_error("Invalid object contents at %llu", (unsigned long long) p);
777 if ((o->object.flags & OBJECT_COMPRESSED) && !JOURNAL_HEADER_COMPRESSED(f->header)) {
778 log_error("Compressed object in file without compression at %llu", (unsigned long long) p);
783 switch (o->object.type) {
786 r = write_uint64(data_fd, p);
798 if (JOURNAL_HEADER_SEALED(f->header) && n_tags <= 0) {
799 log_error("First entry before first tag at %llu", (unsigned long long) p);
804 r = write_uint64(entry_fd, p);
808 if (le64toh(o->entry.realtime) < last_tag_realtime) {
809 log_error("Older entry after newer tag at %llu", (unsigned long long) p);
814 if (!entry_seqnum_set &&
815 le64toh(o->entry.seqnum) != le64toh(f->header->head_entry_seqnum)) {
816 log_error("Head entry sequence number incorrect at %llu", (unsigned long long) p);
821 if (entry_seqnum_set &&
822 entry_seqnum >= le64toh(o->entry.seqnum)) {
823 log_error("Entry sequence number out of synchronization at %llu", (unsigned long long) p);
828 entry_seqnum = le64toh(o->entry.seqnum);
829 entry_seqnum_set = true;
831 if (entry_monotonic_set &&
832 sd_id128_equal(entry_boot_id, o->entry.boot_id) &&
833 entry_monotonic > le64toh(o->entry.monotonic)) {
834 log_error("Entry timestamp out of synchronization at %llu", (unsigned long long) p);
839 entry_monotonic = le64toh(o->entry.monotonic);
840 entry_boot_id = o->entry.boot_id;
841 entry_monotonic_set = true;
843 if (!entry_realtime_set &&
844 le64toh(o->entry.realtime) != le64toh(f->header->head_entry_realtime)) {
845 log_error("Head entry realtime timestamp incorrect");
850 entry_realtime = le64toh(o->entry.realtime);
851 entry_realtime_set = true;
856 case OBJECT_DATA_HASH_TABLE:
857 if (n_data_hash_tables > 1) {
858 log_error("More than one data hash table at %llu", (unsigned long long) p);
863 if (le64toh(f->header->data_hash_table_offset) != p + offsetof(HashTableObject, items) ||
864 le64toh(f->header->data_hash_table_size) != le64toh(o->object.size) - offsetof(HashTableObject, items)) {
865 log_error("Header fields for data hash table invalid");
870 n_data_hash_tables++;
873 case OBJECT_FIELD_HASH_TABLE:
874 if (n_field_hash_tables > 1) {
875 log_error("More than one field hash table at %llu", (unsigned long long) p);
880 if (le64toh(f->header->field_hash_table_offset) != p + offsetof(HashTableObject, items) ||
881 le64toh(f->header->field_hash_table_size) != le64toh(o->object.size) - offsetof(HashTableObject, items)) {
882 log_error("Header fields for field hash table invalid");
887 n_field_hash_tables++;
890 case OBJECT_ENTRY_ARRAY:
891 r = write_uint64(entry_array_fd, p);
895 if (p == le64toh(f->header->entry_array_offset)) {
896 if (found_main_entry_array) {
897 log_error("More than one main entry array at %llu", (unsigned long long) p);
902 found_main_entry_array = true;
909 if (!JOURNAL_HEADER_SEALED(f->header)) {
910 log_error("Tag object in file without sealing at %llu", (unsigned long long) p);
915 if (le64toh(o->tag.seqnum) != n_tags + 1) {
916 log_error("Tag sequence number out of synchronization at %llu", (unsigned long long) p);
921 if (le64toh(o->tag.epoch) < last_epoch) {
922 log_error("Epoch sequence out of synchronization at %llu", (unsigned long long) p);
931 log_debug("Checking tag %llu..", (unsigned long long) le64toh(o->tag.seqnum));
933 rt = f->fss_start_usec + o->tag.epoch * f->fss_interval_usec;
934 if (entry_realtime_set && entry_realtime >= rt + f->fss_interval_usec) {
935 log_error("Tag/entry realtime timestamp out of synchronization at %llu", (unsigned long long) p);
940 /* OK, now we know the epoch. So let's now set
941 * it, and calculate the HMAC for everything
942 * since the last tag. */
943 r = journal_file_fsprg_seek(f, le64toh(o->tag.epoch));
947 r = journal_file_hmac_start(f);
952 r = journal_file_hmac_put_header(f);
956 q = le64toh(f->header->header_size);
961 r = journal_file_move_to_object(f, -1, q, &o);
965 r = journal_file_hmac_put_object(f, -1, o, q);
969 q = q + ALIGN64(le64toh(o->object.size));
972 /* Position might have changed, let's reposition things */
973 r = journal_file_move_to_object(f, -1, p, &o);
977 if (memcmp(o->tag.tag, gcry_md_read(f->hmac, 0), TAG_LENGTH) != 0) {
978 log_error("Tag failed verification at %llu", (unsigned long long) p);
983 f->hmac_running = false;
984 last_tag_realtime = rt;
985 last_sealed_realtime = entry_realtime;
988 last_tag = p + ALIGN64(le64toh(o->object.size));
991 last_epoch = le64toh(o->tag.epoch);
1000 if (p == le64toh(f->header->tail_object_offset))
1003 p = p + ALIGN64(le64toh(o->object.size));
1007 log_error("Tail object pointer dead");
1012 if (n_objects != le64toh(f->header->n_objects)) {
1013 log_error("Object number mismatch");
1018 if (n_entries != le64toh(f->header->n_entries)) {
1019 log_error("Entry number mismatch");
1024 if (JOURNAL_HEADER_CONTAINS(f->header, n_data) &&
1025 n_data != le64toh(f->header->n_data)) {
1026 log_error("Data number mismatch");
1031 if (JOURNAL_HEADER_CONTAINS(f->header, n_fields) &&
1032 n_fields != le64toh(f->header->n_fields)) {
1033 log_error("Field number mismatch");
1038 if (JOURNAL_HEADER_CONTAINS(f->header, n_tags) &&
1039 n_tags != le64toh(f->header->n_tags)) {
1040 log_error("Tag number mismatch");
1045 if (JOURNAL_HEADER_CONTAINS(f->header, n_entry_arrays) &&
1046 n_entry_arrays != le64toh(f->header->n_entry_arrays)) {
1047 log_error("Entry array number mismatch");
1052 if (n_data_hash_tables != 1) {
1053 log_error("Missing data hash table");
1058 if (n_field_hash_tables != 1) {
1059 log_error("Missing field hash table");
1064 if (!found_main_entry_array) {
1065 log_error("Missing entry array");
1070 if (entry_seqnum_set &&
1071 entry_seqnum != le64toh(f->header->tail_entry_seqnum)) {
1072 log_error("Invalid tail seqnum");
1077 if (entry_monotonic_set &&
1078 (!sd_id128_equal(entry_boot_id, f->header->boot_id) ||
1079 entry_monotonic != le64toh(f->header->tail_entry_monotonic))) {
1080 log_error("Invalid tail monotonic timestamp");
1085 if (entry_realtime_set && entry_realtime != le64toh(f->header->tail_entry_realtime)) {
1086 log_error("Invalid tail realtime timestamp");
1091 /* Second iteration: we follow all objects referenced from the
1092 * two entry points: the object hash table and the entry
1093 * array. We also check that everything referenced (directly
1094 * or indirectly) in the data hash table also exists in the
1095 * entry array, and vice versa. Note that we do not care for
1096 * unreferenced objects. We only care that everything that is
1097 * referenced is consistent. */
1099 r = verify_entry_array(f,
1101 entry_fd, n_entries,
1102 entry_array_fd, n_entry_arrays,
1108 r = verify_hash_table(f,
1110 entry_fd, n_entries,
1111 entry_array_fd, n_entry_arrays,
1120 mmap_cache_close_fd(f->mmap, data_fd);
1121 mmap_cache_close_fd(f->mmap, entry_fd);
1122 mmap_cache_close_fd(f->mmap, entry_array_fd);
1124 close_nointr_nofail(data_fd);
1125 close_nointr_nofail(entry_fd);
1126 close_nointr_nofail(entry_array_fd);
1128 if (first_contained)
1129 *first_contained = le64toh(f->header->head_entry_realtime);
1131 *last_validated = last_sealed_realtime;
1133 *last_contained = le64toh(f->header->tail_entry_realtime);
1141 log_error("File corruption detected at %s:%llu (of %llu, %llu%%).",
1143 (unsigned long long) p,
1144 (unsigned long long) f->last_stat.st_size,
1145 (unsigned long long) (100 * p / f->last_stat.st_size));
1148 mmap_cache_close_fd(f->mmap, data_fd);
1149 close_nointr_nofail(data_fd);
1152 if (entry_fd >= 0) {
1153 mmap_cache_close_fd(f->mmap, entry_fd);
1154 close_nointr_nofail(entry_fd);
1157 if (entry_array_fd >= 0) {
1158 mmap_cache_close_fd(f->mmap, entry_array_fd);
1159 close_nointr_nofail(entry_array_fd);