xref: /OK3568_Linux_fs/buildroot/package/google-breakpad/0004-Fix-for-non-constant-SIGSTKSZ.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunFrom 4a332d01186b09a9d46390b845024d914d9149cb Mon Sep 17 00:00:00 2001
2*4882a593SmuzhiyunFrom: Michel Alexandre Salim <michel@michel-slm.name>
3*4882a593SmuzhiyunDate: Sun, 21 Mar 2021 13:17:00 -0700
4*4882a593SmuzhiyunSubject: [PATCH] Fix for non-constant SIGSTKSZ
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunOn glibc > 2.33, `SIGSTKSZ` might not be constant (in which case
7*4882a593Smuzhiyunit expands to a call to `sysconf` which returns a `long int`); see
8*4882a593Smuzhiyunhttp://sourceware-org.1504.n7.nabble.com/PATCH-sysconf-Add-SC-MINSIGSTKSZ-SC-SIGSTKSZ-BZ-20305-td650948.html
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunCast the two arguments to `max` to `unsigned`, which is the type of the variable
11*4882a593Smuzhiyunwe're storing the result in anyway, so that it works both with the old-style constant
12*4882a593Smuzhiyun`SIGSTKSZ` and the new configurable one.
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunSigned-off-by: Michel Alexandre Salim <michel@michel-slm.name>
15*4882a593SmuzhiyunChange-Id: I3d87048561a87c6b9fcdbb14b3d53dd45b0a00f0
16*4882a593Smuzhiyun
17*4882a593Smuzhiyun[Retrieved from:
18*4882a593Smuzhiyunhttps://chromium-review.googlesource.com/c/breakpad/breakpad/+/2776379]
19*4882a593SmuzhiyunSigned-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
20*4882a593Smuzhiyun---
21*4882a593Smuzhiyun
22*4882a593Smuzhiyundiff --git a/src/client/linux/handler/exception_handler.cc b/src/client/linux/handler/exception_handler.cc
23*4882a593Smuzhiyunindex ca353c4..3788829 100644
24*4882a593Smuzhiyun--- a/src/client/linux/handler/exception_handler.cc
25*4882a593Smuzhiyun+++ b/src/client/linux/handler/exception_handler.cc
26*4882a593Smuzhiyun@@ -138,7 +138,7 @@
27*4882a593Smuzhiyun   // SIGSTKSZ may be too small to prevent the signal handlers from overrunning
28*4882a593Smuzhiyun   // the alternative stack. Ensure that the size of the alternative stack is
29*4882a593Smuzhiyun   // large enough.
30*4882a593Smuzhiyun-  static const unsigned kSigStackSize = std::max(16384, SIGSTKSZ);
31*4882a593Smuzhiyun+  static const unsigned kSigStackSize = std::max((unsigned) 16384, (unsigned) SIGSTKSZ);
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun   // Only set an alternative stack if there isn't already one, or if the current
34*4882a593Smuzhiyun   // one is too small.
35