Skip to content

Commit

Permalink
stack_clash: Guard functions used only in 64bit
Browse files Browse the repository at this point in the history
To avoid "defined but not used" warnings when compiled on 32bit.

Link: https://lore.kernel.org/ltp/[email protected]/
Reviewed-by: Cyril Hrubis <[email protected]>
Signed-off-by: Petr Vorel <[email protected]>
  • Loading branch information
pevik committed Oct 26, 2023
1 parent 3967218 commit c18b982
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions testcases/cve/stack_clash.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ void segv_handler(int sig, siginfo_t *info, void *data LTP_ATTRIBUTE_UNUSED)
_exit(EXIT_SUCCESS);
}

#ifdef __x86_64__
static void force_bottom_up(void)
{
FILE *fh;
Expand Down Expand Up @@ -134,6 +135,7 @@ static void force_bottom_up(void)
out:
SAFE_FCLOSE(fh);
}
#endif

unsigned long read_stack_addr_from_proc(unsigned long *stack_size)
{
Expand Down Expand Up @@ -187,6 +189,7 @@ void __attribute__((noinline)) preallocate_stack(unsigned long required)
garbage[0] = garbage[required - 1] = '\0';
}

#ifdef __x86_64__
static void do_mmap_placement_test(unsigned long stack_addr, unsigned long gap)
{
void *map_test_gap;
Expand All @@ -208,6 +211,7 @@ static void do_mmap_placement_test(unsigned long stack_addr, unsigned long gap)
SAFE_MUNMAP(map_test_gap, MAPPED_LEN);
}
}
#endif

void do_child(void)
{
Expand Down

0 comments on commit c18b982

Please sign in to comment.