Skip to content

Commit

Permalink
Fix for non-constant SIGSTKSZ
Browse files Browse the repository at this point in the history
On glibc > 2.33, `SIGSTKSZ` might not be constant (in which case
it expands to a call to `sysconf` which returns a `long int`); see
https://sourceware.org/pipermail/libc-alpha/2020-October/118513.html

Pass unsigned explicitly to std::max, to avoid relying on template
argument deduction. This works both with the old-style constant
`SIGSTKSZ` and the new configurable one.

Initially based on https://chromium-review.googlesource.com/c/2776379

Change-Id: I9fc95337f973e871b84735ce822b5e11ba73ea8c
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3340721
Reviewed-by: Mark Mentovai <mark@chromium.org>
  • Loading branch information
dfaure-kdab authored and markmentovai committed Dec 15, 2021
1 parent 3846f6d commit 605c51e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/client/linux/handler/exception_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void InstallAlternateStackLocked() {
// SIGSTKSZ may be too small to prevent the signal handlers from overrunning
// the alternative stack. Ensure that the size of the alternative stack is
// large enough.
static const unsigned kSigStackSize = std::max(16384, SIGSTKSZ);
const unsigned kSigStackSize = std::max<unsigned>(16384, SIGSTKSZ);

// Only set an alternative stack if there isn't already one, or if the current
// one is too small.
Expand Down

0 comments on commit 605c51e

Please sign in to comment.