Skip to content

Commit 0f8dddc

Browse files
committed
format, actions fix
1 parent 5506748 commit 0f8dddc

8 files changed

Lines changed: 15 additions & 15 deletions

File tree

.github/workflows/testsuite.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
runs-on: ubuntu-latest
6060
steps:
6161
- uses: actions/checkout@v2
62-
- run: sudo apt install clang clang-format
62+
- run: sudo apt install clang clang-format-12
6363
- run: make format-ci
6464
testsuite-gcc:
6565
runs-on: ubuntu-latest

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ ISO_DTOR_CLEANUP = -DISO_DTOR_CLEANUP=0
187187
## Register a signal handler for SIGSEGV that inspects si_addr
188188
## for an address managed by IsoAlloc. Optionally used when
189189
## UAF_PTR_PAGE is enabled for better crash handling
190-
SIGNAL_HANDLER = -DSIGNAL_HANDLER=1
190+
SIGNAL_HANDLER = -DSIGNAL_HANDLER=0
191191

192192
## If you know your target will have an ARMv8.1-A or newer and
193193
## supports Top Byte Ignore (TBI) then you want to enable this
@@ -411,10 +411,10 @@ install:
411411
cp -pR build/$(LIBNAME) /usr/lib/
412412

413413
format:
414-
clang-format $(SRC_DIR)/*.* tests/*.* include/*.h -i
414+
clang-format-12 $(SRC_DIR)/*.* tests/*.* include/*.h -i
415415

416416
format-ci:
417-
clang-format --Werror --dry-run $(SRC_DIR)/*.* tests/*.* include/*.h -i
417+
clang-format-12 --Werror --dry-run $(SRC_DIR)/*.* tests/*.* include/*.h -i
418418

419419
clean:
420420
rm -rf build/* tests_perf_analysis.txt big_tests_perf_analysis.txt gmon.out test_output.txt *.dSYM core* iso_alloc_profiler.data

src/iso_alloc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,7 +1401,7 @@ INTERNAL_HIDDEN void iso_free_chunk_from_zone(iso_alloc_zone_t *zone, void *rest
14011401
LOG_AND_ABORT("Chunk at 0x%p of zone[%d] is not %d byte aligned", p, zone->index, ALIGNMENT);
14021402
}
14031403

1404-
const uint64_t chunk_offset = (uint64_t)(p - UNMASK_USER_PTR(zone));
1404+
const uint64_t chunk_offset = (uint64_t) (p - UNMASK_USER_PTR(zone));
14051405
const size_t chunk_number = (chunk_offset >> zone->chunk_size_pow2);
14061406
const bit_slot_t bit_slot = (chunk_number << BITS_PER_CHUNK_SHIFT);
14071407
const bit_slot_t dwords_to_bit_slot = (bit_slot >> BITS_PER_QWORD_SHIFT);
@@ -1669,7 +1669,7 @@ INTERNAL_HIDDEN iso_alloc_zone_t *_iso_free_internal_unlocked(void *p, bool perm
16691669
/* We only need to refresh this single tag */
16701670
void *user_pages_start = UNMASK_USER_PTR(zone);
16711671
uint8_t *_mtp = (user_pages_start - g_page_size - ROUND_UP_PAGE(zone->chunk_count * MEM_TAG_SIZE));
1672-
uint64_t chunk_offset = (uint64_t)(p - user_pages_start);
1672+
uint64_t chunk_offset = (uint64_t) (p - user_pages_start);
16731673
_mtp += (chunk_offset >> zone->chunk_size_pow2);
16741674

16751675
/* Generate and write a new tag for this chunk */

src/iso_alloc_mem_tags.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ INTERNAL_HIDDEN uint8_t _iso_alloc_get_mem_tag(void *p, iso_alloc_zone_t *zone)
1414
}
1515

1616
uint8_t *_mtp = (user_pages_start - g_page_size - ROUND_UP_PAGE(zone->chunk_count * MEM_TAG_SIZE));
17-
const uint64_t chunk_offset = (uint64_t)(p - user_pages_start);
17+
const uint64_t chunk_offset = (uint64_t) (p - user_pages_start);
1818

1919
/* Ensure the pointer is a multiple of chunk size */
2020
if(UNLIKELY((chunk_offset & (zone->chunk_size - 1)) != 0)) {

src/iso_alloc_profiler.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ INTERNAL_HIDDEN uint64_t _iso_alloc_zone_leak_detector(iso_alloc_zone_t *zone, b
160160

161161
if(profile == false) {
162162
LOG("Zone[%d] Total number of %d byte chunks(%d) used and free'd (%d) (%d percent), in use = %d", zone->index, zone->chunk_size, zone->chunk_count,
163-
was_used, (int32_t)((float) was_used / zone->chunk_count) * 100, in_use);
163+
was_used, (int32_t) ((float) was_used / zone->chunk_count) * 100, in_use);
164164
}
165165

166166
MASK_ZONE_PTRS(zone);
@@ -172,7 +172,7 @@ INTERNAL_HIDDEN uint64_t _iso_alloc_zone_leak_detector(iso_alloc_zone_t *zone, b
172172
* in use and previously used by this zone */
173173
if(profile == true) {
174174
uint64_t total = (in_use + was_used);
175-
return (uint64_t)((float) (total / zone->chunk_count) * 100.0);
175+
return (uint64_t) ((float) (total / zone->chunk_count) * 100.0);
176176
}
177177
#endif
178178
return in_use;
@@ -395,7 +395,7 @@ INTERNAL_HIDDEN void _iso_alloc_profile(size_t size) {
395395
used = _iso_alloc_zone_leak_detector(zone, true);
396396
}
397397

398-
used = (int32_t)((float) (used / zone->chunk_count) * 100.0);
398+
used = (int32_t) ((float) (used / zone->chunk_count) * 100.0);
399399

400400
if(used > CHUNK_USAGE_THRESHOLD) {
401401
_zone_profiler_map[zone->chunk_size].count++;

src/iso_alloc_search.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ INTERNAL_HIDDEN void *_iso_alloc_ptr_search(void *n, bool poison) {
2525
return search;
2626
} else {
2727
#if UAF_PTR_PAGE
28-
*(uint64_t *) search = (uint64_t)(_root->uaf_ptr_page);
28+
*(uint64_t *) search = (uint64_t) (_root->uaf_ptr_page);
2929
return search;
3030
#endif
3131
}
@@ -82,7 +82,7 @@ INTERNAL_HIDDEN void _iso_alloc_search_stack(uint8_t *stack_start) {
8282
LOG_AND_ABORT("Chunk at 0x%p of zone[%d] is not %d byte aligned", p, zone->index, ALIGNMENT);
8383
}
8484

85-
uint64_t chunk_offset = (uint64_t)(p - (uint64_t *) zone->user_pages_start);
85+
uint64_t chunk_offset = (uint64_t) (p - (uint64_t *) zone->user_pages_start);
8686
LOG("zone[%d] user_pages_start=%p value=%p %lu %d", zone->index, zone->user_pages_start, p, chunk_offset, zone->chunk_size);
8787

8888
/* Ensure the pointer is a multiple of chunk size */

src/iso_alloc_signal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
#if SIGNAL_HANDLER
77
INTERNAL_HIDDEN void handle_signal(int sig, siginfo_t *si, void *ctx) {
8-
#if UAF_PTR_PAGE
98
void *crash_addr = si->si_addr;
109

10+
#if UAF_PTR_PAGE
1111
if(si->si_addr == NULL) {
1212
LOG_AND_ABORT("si->si_addr == NULL");
1313
}
@@ -18,8 +18,8 @@ INTERNAL_HIDDEN void handle_signal(int sig, siginfo_t *si, void *ctx) {
1818
crash_addr <= _root->uaf_ptr_page + (g_page_size * 2)) {
1919
LOG_AND_ABORT("Use after free detected! Crashed at _root->uaf_ptr_page 0x%x", si->si_addr);
2020
}
21+
#endif
2122

2223
LOG_AND_ABORT("Unknown segmentation fault @ 0x%p", crash_addr);
23-
#endif
2424
}
2525
#endif

src/iso_alloc_util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,5 +190,5 @@ INTERNAL_HIDDEN uint32_t _log2(uint32_t v) {
190190
v |= v >> 4;
191191
v |= v >> 8;
192192
v |= v >> 16;
193-
return _log_table[(uint32_t)(v * 0x07C4ACDD) >> 27];
193+
return _log_table[(uint32_t) (v * 0x07C4ACDD) >> 27];
194194
}

0 commit comments

Comments
 (0)