Add compat.linux.dummy_rlimits, and disable by default.

Turns out the dummy rlimits fix prlimit(1), but break su(8)
(login-1:4.5-1ubuntu2) - although not sudo(8), for some reason.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D26814
This commit is contained in:
Edward Tomasz Napierala 2020-10-18 15:58:16 +00:00
parent c0d07d326f
commit 54669eb779
3 changed files with 9 additions and 0 deletions

View File

@ -77,6 +77,11 @@ SYSCTL_INT(_compat_linux, OID_AUTO, default_stacksize, CTLFLAG_RWTUN,
&linux_default_stacksize, 0,
"Default soft stack size resource limit, or -1 for unlimited");
int linux_dummy_rlimits = 0;
SYSCTL_INT(_compat_linux, OID_AUTO, dummy_rlimits, CTLFLAG_RWTUN,
&linux_dummy_rlimits, 0,
"Return dummy values for unsupported Linux-specific rlimits");
int linux_ignore_ip_recverr = 1;
SYSCTL_INT(_compat_linux, OID_AUTO, ignore_ip_recverr, CTLFLAG_RWTUN,
&linux_ignore_ip_recverr, 0, "Ignore enabling IP_RECVERR");

View File

@ -65,6 +65,7 @@ int linux_kernver(struct thread *td);
extern int linux_debug;
extern int linux_default_openfiles;
extern int linux_default_stacksize;
extern int linux_dummy_rlimits;
extern int linux_ignore_ip_recverr;
extern int linux_preserve_vstatus;
extern bool linux_map_sched_prio;

View File

@ -1377,6 +1377,9 @@ static bool
linux_get_dummy_limit(l_uint resource, struct rlimit *rlim)
{
if (linux_dummy_rlimits == 0)
return (false);
switch (resource) {
case LINUX_RLIMIT_LOCKS:
case LINUX_RLIMIT_SIGPENDING: