forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-02-17 557c24d082b6ecb9bfe5407b77ae43fa7650a5dc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From 66a2b6e4ba8e2b49115043127ce4aa0fcd71ad1e Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 11 May 2021 11:12:35 -0700
Subject: [PATCH] exception_handler.cc: Match the types for SIGSTKSZ
 
In glibc 2.34, SIGSTKSZ is a syscall which returns a long int, therefore
current check fails
 
| ../git/src/client/linux/handler/exception_handler.cc:141:49: error: no matching function for call to 'max(int, long int)'
|   141 |   static const unsigned kSigStackSize = std::max(16384, SIGSTKSZ);
|       |                                         ~~~~~~~~^~~~~~~~~~~~~~~~~
 
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
  third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc | 2 +-
  sandbox/linux/services/credentials.cc | 4 +++-
 
diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
index ca353c40..c5bb00a7 100644
--- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
@@ -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);
+  static const unsigned kSigStackSize = std::max(static_cast<unsigned>(16384), static_cast<unsigned>(SIGSTKSZ));
 
   // Only set an alternative stack if there isn't already one, or if the current
   // one is too small.
 
diff --git a/sandbox/linux/services/credentials.cc b/sandbox/linux/services/credentials.cc
index ca6b5954798e4..52e4ce2c989dc 100644
--- a/sandbox/linux/services/credentials.cc
+++ b/sandbox/linux/services/credentials.cc
@@ -100,7 +100,9 @@ bool ChrootToSafeEmptyDir() {
   // TODO(crbug.com/1247458) Broken in MSan builds after LLVM f1bb30a4956f.
   clone_flags |= CLONE_VM | CLONE_VFORK | CLONE_SETTLS;
 
-  char tls_buf[PTHREAD_STACK_MIN] = {0};
+  const std::size_t pthread_stack_min = PTHREAD_STACK_MIN;
+  char tls_buf[pthread_stack_min];
+  memset(tls_buf, 0, pthread_stack_min);
   tls = tls_buf;
 #endif