[compiler-rt] r321803 - [scudo] s/unsigned long/size_t/ for __scudo_set_rss_limit

Kostya Kortchinsky via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 4 09:05:04 PST 2018


Author: cryptoad
Date: Thu Jan  4 09:05:04 2018
New Revision: 321803

URL: http://llvm.org/viewvc/llvm-project?rev=321803&view=rev
Log:
[scudo] s/unsigned long/size_t/ for __scudo_set_rss_limit

Summary:
`__scudo_set_rss_limit`'s `LimitMb` should really be a `size_t`. Update
accordingly the prototype. To avoid the `NOLINT` and conform with the other
Sanitizers, use the sanitizers types for the internal definition. This should
have no functional change.

Additionally, capitalize a variable name to follow the LLVM coding standards.

Reviewers: alekseyshl, flowerhack

Reviewed By: alekseyshl

Subscribers: #sanitizers, llvm-commits

Differential Revision: https://reviews.llvm.org/D41704

Modified:
    compiler-rt/trunk/include/sanitizer/scudo_interface.h
    compiler-rt/trunk/lib/scudo/scudo_allocator.cpp
    compiler-rt/trunk/lib/scudo/scudo_interface_internal.h

Modified: compiler-rt/trunk/include/sanitizer/scudo_interface.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/include/sanitizer/scudo_interface.h?rev=321803&r1=321802&r2=321803&view=diff
==============================================================================
--- compiler-rt/trunk/include/sanitizer/scudo_interface.h (original)
+++ compiler-rt/trunk/include/sanitizer/scudo_interface.h Thu Jan  4 09:05:04 2018
@@ -26,7 +26,7 @@ extern "C" {
   // the hard limit (HardLimit=1) or the soft limit (HardLimit=0). The limit
   // can be removed by setting LimitMb to 0. This function's parameters should
   // be fully trusted to avoid security mishaps.
-  void __scudo_set_rss_limit(unsigned long LimitMb, int HardLimit);
+  void __scudo_set_rss_limit(size_t LimitMb, int HardLimit);
 #ifdef __cplusplus
 }  // extern "C"
 #endif

Modified: compiler-rt/trunk/lib/scudo/scudo_allocator.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/scudo/scudo_allocator.cpp?rev=321803&r1=321802&r2=321803&view=diff
==============================================================================
--- compiler-rt/trunk/lib/scudo/scudo_allocator.cpp (original)
+++ compiler-rt/trunk/lib/scudo/scudo_allocator.cpp Thu Jan  4 09:05:04 2018
@@ -721,8 +721,8 @@ uptr __sanitizer_get_unmapped_bytes() {
   return 1;
 }
 
-uptr __sanitizer_get_estimated_allocated_size(uptr size) {
-  return size;
+uptr __sanitizer_get_estimated_allocated_size(uptr Size) {
+  return Size;
 }
 
 int __sanitizer_get_ownership(const void *Ptr) {
@@ -736,7 +736,7 @@ uptr __sanitizer_get_allocated_size(cons
 // Interface functions
 
 extern "C" {
-void __scudo_set_rss_limit(unsigned long LimitMb, int HardLimit) {  // NOLINT
+void __scudo_set_rss_limit(uptr LimitMb, s32 HardLimit) {
   if (!SCUDO_CAN_USE_PUBLIC_INTERFACE)
     return;
   Instance.setRssLimit(LimitMb, !!HardLimit);

Modified: compiler-rt/trunk/lib/scudo/scudo_interface_internal.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/scudo/scudo_interface_internal.h?rev=321803&r1=321802&r2=321803&view=diff
==============================================================================
--- compiler-rt/trunk/lib/scudo/scudo_interface_internal.h (original)
+++ compiler-rt/trunk/lib/scudo/scudo_interface_internal.h Thu Jan  4 09:05:04 2018
@@ -14,9 +14,14 @@
 #ifndef SCUDO_INTERFACE_INTERNAL_H_
 #define SCUDO_INTERFACE_INTERNAL_H_
 
+#include "sanitizer_common/sanitizer_internal_defs.h"
+
+using __sanitizer::uptr;
+using __sanitizer::s32;
+
 extern "C" {
 SANITIZER_INTERFACE_ATTRIBUTE
-void __scudo_set_rss_limit(unsigned long LimitMb, int HardLimit);  // NOLINT
+void __scudo_set_rss_limit(uptr LimitMb, s32 HardLimit);
 }  // extern "C"
 
 #endif  // SCUDO_INTERFACE_INTERNAL_H_




More information about the llvm-commits mailing list