[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

llvm-svn: 321803
This commit is contained in:
Kostya Kortchinsky 2018-01-04 17:05:04 +00:00
parent dce4a9aa59
commit 541c5a0797
3 changed files with 10 additions and 5 deletions

View File

@ -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

View File

@ -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(const void *Ptr) {
// 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);

View File

@ -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_