[PATCH] D41704: [scudo] s/unsigned long/size_t/ for __scudo_set_rss_limit
Kostya Kortchinsky via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 3 10:21:57 PST 2018
cryptoad created this revision.
cryptoad added reviewers: alekseyshl, flowerhack.
Herald added a subscriber: Sanitizers.
`__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.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D41704
Files:
include/sanitizer/scudo_interface.h
lib/scudo/scudo_allocator.cpp
lib/scudo/scudo_interface_internal.h
Index: lib/scudo/scudo_interface_internal.h
===================================================================
--- lib/scudo/scudo_interface_internal.h
+++ lib/scudo/scudo_interface_internal.h
@@ -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_
Index: lib/scudo/scudo_allocator.cpp
===================================================================
--- lib/scudo/scudo_allocator.cpp
+++ lib/scudo/scudo_allocator.cpp
@@ -721,8 +721,8 @@
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 @@
// 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);
Index: include/sanitizer/scudo_interface.h
===================================================================
--- include/sanitizer/scudo_interface.h
+++ include/sanitizer/scudo_interface.h
@@ -26,7 +26,7 @@
// 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41704.128538.patch
Type: text/x-patch
Size: 1950 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180103/fd4a6aa5/attachment.bin>
More information about the llvm-commits
mailing list