Re: [PATCH] objtool: Fix stack overflow in validate_branch()
From: David Laight
Date: Wed Dec 03 2025 - 06:02:30 EST
On Tue, 2 Dec 2025 15:01:17 -0800
Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
...
> + while (fgets(line, sizeof(line), fp)) {
> + if (strstr(line, "[stack]")) {
> + if (sscanf(line, "%lx-%lx", &stack_start, &stack_end) != 2) {
> + ERROR_GLIBC("sscanf");
> + ret = -1;
> + goto done;
> + }
> + stack_limit = stack_end - rlim.rlim_cur;
> + goto done;
That assumes 'stack grows down'.
Someone will copy the code onto a 'backwards stack' system one day.
(I can't remember which ones they are.)
David