setrlimit(R_DATA, ...) requires absurd values for rlim_max on Monterey M1

Originator:hans
Number:rdar://FB9794137 Date Originated:03/12/2021
Status:Open Resolved:No
Product:MacOS Product Version:12.1
Classification:Bug Reproducible:Yes
 
For a simple progam using setrlimit(R_DATA), ...) with rlim_max=410_000_000_000 fails.

Testcase:
--- snip ---
#include <stdio.h>
#include <sys/resource.h>

int main() {
 struct rlimit lim = {410*1000*1000*1000ull, 410*1000*1000*1000ull}; // does not work
 // struct rlimit lim = {420*1000*1000*1000ull, 420*1000*1000*1000ull}; // works

 if (setrlimit(RLIMIT_DATA, &lim) == 0)
   printf("it worked\n");
 else
   printf("it failed\n");
}
--- snip ---

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!