Solved Setting ulimit -s results in segmentation fault - expected behaviour or a bug?

Hi,

I recently moved few of my Plex systems to FreeBSD 12.2-RELEASE-p1 and noticed that the startup script tries to enforce a stack size of 3000 using ulimit:

Code:
root@abyss:~ # grep -i ulimit /usr/local/etc/rc.d/plexmediaserver_plexpass
    ulimit -s 3000

So when I try to start/stop/restart it will crash with segmentation fault:

Code:
root@abyss:~ # /usr/local/etc/rc.d/plexmediaserver_plexpass restart
plexmediaserver_plexpass not running? (check /var/run/plex/plex.pid).
Segmentation fault (core dumped)

Trying to set the ulimit -s 3000 manually in the current root shell results in the same outcome:

Code:
root@abyss:~ # truss ulimit -s 3000
mmap(0x0,131072,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34368991232 (0x8008d3000)
mprotect(0x2f333056000,4096,PROT_READ)         = 0 (0x0)
issetugid()                     = 0 (0x0)
openat(AT_FDCWD,"/etc/libmap.conf",O_RDONLY|O_CLOEXEC,00) = 3 (0x3)
fstat(3,{ mode=-rw-r--r-- ,inode=79,size=122,blksize=4096 }) = 0 (0x0)
read(3,"# $FreeBSD: releng/12.2/libexec/"...,122) = 122 (0x7a)
close(3)                     = 0 (0x0)
open("/usr/local/etc/libmap.d",O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC,0165) ERR#2 'No such file or directory'
openat(AT_FDCWD,"/var/run/ld-elf.so.hints",O_RDONLY|O_CLOEXEC,00) = 3 (0x3)
read(3,"Ehnt\^A\0\0\0\M^@\0\0\0k\0\0\0\0"...,128) = 128 (0x80)
fstat(3,{ mode=-r--r--r-- ,inode=164097,size=235,blksize=4096 }) = 0 (0x0)
pread(3,"/lib:/usr/lib:/usr/lib/compat:/u"...,107,0x80) = 107 (0x6b)
close(3)                     = 0 (0x0)
openat(AT_FDCWD,"/lib/libedit.so.7",O_RDONLY|O_CLOEXEC|O_VERIFY,00) = 3 (0x3)
fstat(3,{ mode=-r--r--r-- ,inode=15052,size=216448,blksize=131072 }) = 0 (0x0)
mmap(0x0,4096,PROT_READ,MAP_PRIVATE|MAP_PREFAULT_READ,3,0x0) = 34400579584 (0x8026f3000)
mmap(0x0,241664,PROT_NONE,MAP_GUARD,-1,0x0)     = 34376548352 (0x801008000)
mmap(0x801008000,86016,PROT_READ,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE|MAP_PREFAULT_READ,3,0x0) = 34376548352 (0x801008000)
mmap(0x80101d000,126976,PROT_READ|PROT_EXEC,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE|MAP_PREFAULT_READ,3,0x14000) = 34376634368 (0x80101d000)
mmap(0x80103c000,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ,3,0x32000) = 34376761344 (0x80103c000)
mmap(0x80103e000,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ,3,0x33000) = 34376769536 (0x80103e000)
mmap(0x80103f000,16384,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_ANON,-1,0x0) = 34376773632 (0x80103f000)
munmap(0x8026f3000,4096)             = 0 (0x0)
close(3)                     = 0 (0x0)
openat(AT_FDCWD,"/lib/libc.so.7",O_RDONLY|O_CLOEXEC|O_VERIFY,00) = 3 (0x3)
fstat(3,{ mode=-r--r--r-- ,inode=15057,size=1952200,blksize=131072 }) = 0 (0x0)
mmap(0x0,4096,PROT_READ,MAP_PRIVATE|MAP_PREFAULT_READ,3,0x0) = 34399858688 (0x802643000)
mmap(0x0,4153344,PROT_NONE,MAP_GUARD,-1,0x0)     = 34391998464 (0x801ec4000)
mmap(0x801ec4000,520192,PROT_READ,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE|MAP_PREFAULT_READ,3,0x0) = 34391998464 (0x801ec4000)
mmap(0x801f43000,1310720,PROT_READ|PROT_EXEC,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE|MAP_PREFAULT_READ,3,0x7e000) = 34392518656 (0x801f43000)
mmap(0x802083000,40960,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ,3,0x1bd000) = 34393829376 (0x802083000)
mmap(0x80208d000,28672,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ,3,0x1c6000) = 34393870336 (0x80208d000)
mmap(0x802094000,2252800,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_ANON,-1,0x0) = 34393899008 (0x802094000)
munmap(0x802643000,4096)             = 0 (0x0)
close(3)                     = 0 (0x0)
openat(AT_FDCWD,"/lib/libncursesw.so.8",O_RDONLY|O_CLOEXEC|O_VERIFY,00) = 3 (0x3)
fstat(3,{ mode=-r--r--r-- ,inode=15039,size=385968,blksize=131072 }) = 0 (0x0)
mmap(0x0,4096,PROT_READ,MAP_PRIVATE|MAP_PREFAULT_READ,3,0x0) = 34417123328 (0x8036ba000)
mmap(0x0,401408,PROT_NONE,MAP_GUARD,-1,0x0)     = 34400092160 (0x80267c000)
mmap(0x80267c000,167936,PROT_READ,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE|MAP_PREFAULT_READ,3,0x0) = 34400092160 (0x80267c000)
mmap(0x8026a5000,204800,PROT_READ|PROT_EXEC,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE|MAP_PREFAULT_READ,3,0x28000) = 34400260096 (0x8026a5000)
mmap(0x8026d7000,16384,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ,3,0x59000) = 34400464896 (0x8026d7000)
mmap(0x8026db000,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ,3,0x5c000) = 34400481280 (0x8026db000)
mmap(0x8026dd000,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_ANON,-1,0x0) = 34400489472 (0x8026dd000)
munmap(0x8036ba000,4096)             = 0 (0x0)
close(3)                     = 0 (0x0)
mprotect(0x80103c000,8192,PROT_READ)         = 0 (0x0)
mprotect(0x802083000,36864,PROT_READ)         = 0 (0x0)
mprotect(0x8026d7000,16384,PROT_READ)         = 0 (0x0)
sigprocmask(SIG_BLOCK,{ SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2 },{ }) = 0 (0x0)
mprotect(0x802083000,36864,PROT_READ|PROT_WRITE) = 0 (0x0)
sigprocmask(SIG_SETMASK,{ },0x0)         = 0 (0x0)
sigprocmask(SIG_BLOCK,{ SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2 },{ }) = 0 (0x0)
mprotect(0x802083000,36864,PROT_READ)         = 0 (0x0)
sigprocmask(SIG_SETMASK,{ },0x0)         = 0 (0x0)
readlink("/etc/malloc.conf",0x7fffff6e8df0,1024) ERR#2 'No such file or directory'
issetugid()                     = 0 (0x0)
__sysctl("vm.overcommit",2,0x7fffff6e8d54,0x7fffff6e8d60,0x0,0) = 0 (0x0)
mmap(0x0,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34412871680 (0x8032ac000)
madvise(0x8032ac000,4096,MADV_FREE)         = 0 (0x0)
munmap(0x8032ac000,4096)             = 0 (0x0)
mmap(0x0,2097152,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34414612480 (0x803455000)
munmap(0x803455000,2097152)             = 0 (0x0)
mmap(0x0,4190208,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34408714240 (0x802eb5000)
munmap(0x802eb5000,1355776)             = 0 (0x0)
munmap(0x803200000,737280)             = 0 (0x0)
cap_getmode({ 0 })                 = 0 (0x0)
open("/dev/hpet0",O_RDONLY,00)             = 3 (0x3)
mmap(0x0,4096,PROT_READ,MAP_SHARED,3,0x0)     = 34424750080 (0x803e00000)
close(3)                     = 0 (0x0)
mmap(0x0,32768,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34436943872 (0x8049a1000)
mmap(0x0,4194304,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34441744384 (0x804e35000)
munmap(0x804e35000,4194304)             = 0 (0x0)
mmap(0x0,6287360,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34447642624 (0x8053d5000)
munmap(0x8053d5000,176128)             = 0 (0x0)
munmap(0x805800000,1916928)             = 0 (0x0)
mmap(0x0,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34457088000 (0x805cd7000)
sigprocmask(SIG_BLOCK,{ SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2 },{ }) = 0 (0x0)
sigprocmask(SIG_SETMASK,{ },0x0)         = 0 (0x0)
sigprocmask(SIG_BLOCK,{ SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2 },{ }) = 0 (0x0)
sigprocmask(SIG_SETMASK,{ },0x0)         = 0 (0x0)
sigprocmask(SIG_BLOCK,{ SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2 },{ }) = 0 (0x0)
sigprocmask(SIG_SETMASK,{ },0x0)         = 0 (0x0)
sigprocmask(SIG_BLOCK,{ SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2 },{ }) = 0 (0x0)
mprotect(0x228000,4096,PROT_READ)         = 0 (0x0)
sigprocmask(SIG_SETMASK,{ },0x0)         = 0 (0x0)
mmap(0x0,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34460663808 (0x806040000)
open("/usr/share/locale/en_US.UTF-8/LC_COLLATE",O_RDONLY,013720646057) = 3 (0x3)
fstat(3,{ mode=-r--r--r-- ,inode=5169,size=79692,blksize=79872 }) = 0 (0x0)
mmap(0x0,79692,PROT_READ,MAP_PRIVATE,3,0x0)     = 34460667904 (0x806041000)
close(3)                     = 0 (0x0)
open("/usr/share/locale/en_US.UTF-8/LC_CTYPE",O_RDONLY,013720646057) = 3 (0x3)
fstat(3,{ mode=-r--r--r-- ,inode=5577,size=49880,blksize=50176 }) = 0 (0x0)
mmap(0x0,49880,PROT_READ,MAP_PRIVATE,3,0x0)     = 34477527040 (0x807055000)
close(3)                     = 0 (0x0)
mmap(0x0,102400,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34479525888 (0x80723d000)
munmap(0x807055000,49880)             = 0 (0x0)
open("/usr/share/locale/en_US.UTF-8/LC_MONETARY",O_RDONLY|O_CLOEXEC,07613270000) = 3 (0x3)
fstat(3,{ mode=-r--r--r-- ,inode=5167,size=32,blksize=4096 }) = 0 (0x0)
mmap(0x0,12288,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34461368320 (0x8060ec000)
read(3,"USD \n$\n.\n,\n3\n\n-\n2\n2\n1\n"...,32) = 32 (0x20)
close(3)                     = 0 (0x0)
open("/usr/share/locale/en_US.UTF-8/LC_NUMERIC",O_RDONLY|O_CLOEXEC,016334640400) = 3 (0x3)
fstat(3,{ mode=-r--r--r-- ,inode=5166,size=6,blksize=4096 }) = 0 (0x0)
mmap(0x0,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34461847552 (0x806161000)
read(3,".\n,\n3\n",6)                 = 6 (0x6)
close(3)                     = 0 (0x0)
open("/usr/share/locale/en_US.UTF-8/LC_TIME",O_RDONLY|O_CLOEXEC,071400) = 3 (0x3)
fstat(3,{ mode=-r--r--r-- ,inode=5168,size=377,blksize=4096 }) = 0 (0x0)
mmap(0x0,28672,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34465710080 (0x806510000)
read(3,"Jan\nFeb\nMar\nApr\nMay\nJun\nJu"...,377) = 377 (0x179)
close(3)                     = 0 (0x0)
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES",O_RDONLY|O_CLOEXEC,011320443400) = 3 (0x3)
fstat(3,{ mode=-r--r--r-- ,inode=5170,size=74,blksize=4096 }) = 0 (0x0)
mmap(0x0,12288,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34496335872 (0x808245000)
read(3,"^(([yY]([eE][sS])?)|([yY]))\n^(("...,74) = 74 (0x4a)
close(3)                     = 0 (0x0)
getpid()                     = 68802 (0x10cc2)
geteuid()                     = 0 (0x0)
getppid()                     = 68220 (0x10a7c)
mmap(0x0,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34506371072 (0x808bd7000)
mmap(0x0,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34510057472 (0x808f5b000)
mmap(0x0,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34523156480 (0x809bd9000)
mmap(0x0,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34533208064 (0x80a56f000)
mmap(0x0,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34546909184 (0x80b280000)
mmap(0x0,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34562580480 (0x80c172000)
mmap(0x0,20480,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34565861376 (0x80c493000)
mmap(0x0,12288,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34576060416 (0x80ce4d000)
getuid()                     = 0 (0x0)
geteuid()                     = 0 (0x0)
getgid()                     = 0 (0x0)
getegid()                     = 0 (0x0)
openat(AT_FDCWD,"/usr/bin/ulimit",O_RDONLY|O_CLOEXEC,00) = 3 (0x3)
fcntl(3,F_DUPFD_CLOEXEC,0xa)             = 10 (0xa)
close(3)                     = 0 (0x0)
sigaction(SIGINT,0x0,{ SIG_DFL SA_RESTART ss_t }) = 0 (0x0)
sigaction(SIGINT,{ 0x2247e0 0x0 ss_t },0x0)     = 0 (0x0)
sigaction(SIGQUIT,0x0,{ SIG_DFL SA_RESTART ss_t }) = 0 (0x0)
sigaction(SIGQUIT,{ 0x2247e0 0x0 ss_t },0x0)     = 0 (0x0)
sigaction(SIGTERM,0x0,{ SIG_DFL 0x0 ss_t })     = 0 (0x0)
sigaction(SIGTERM,{ SIG_DFL 0x0 ss_t },0x0)     = 0 (0x0)
fstatat(AT_FDCWD,".",{ mode=drwx------ ,inode=11,size=14,blksize=4096 },0x0) = 0 (0x0)
fstatat(AT_FDCWD,"/root",{ mode=drwx------ ,inode=11,size=14,blksize=4096 },0x0) = 0 (0x0)
read(10,"#!/bin/sh\n# $FreeBSD: releng/12"...,1024) = 162 (0xa2)
mmap(0x0,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34583330816 (0x80d53c000)
mmap(0x0,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34597056512 (0x80e253000)
getrlimit(RLIMIT_STACK,{ cur=536870912,max=536870912 }) = 0 (0x0)
setrlimit(RLIMIT_STACK,{ cur=3072000,max=3072000 }) = 0 (0x0)
SIGNAL 11 (SIGSEGV) code=SEGV_ACCERR trapno=12 addr=0x7fffff6e9e98
process killed, signal = 11 (core dumped)
root@abyss:~ #

Analyzing the core dump is not very helpful as well:

Code:
root@abyss:~ # lldb -c sh.core
(lldb) target create --core "sh.core"
Core file '/root/sh.core' (x86_64) was loaded.
(lldb) thread backtrace all
* thread #1, name = 'sh', stop reason = signal SIGSEGV
  * frame #0: 0x0000000801f87370
(lldb)

As far as I can see it kicks memory protection since it tries to access memory which is already allocated but why? Ulimit -s is supposed to set a stack size limit not try to limit the current stack size of any already running program?

Here are the sysctl params on those systems, they also have sufficient amount of memory - I tested with 4GB, 8GB same issue.

Code:
root@abyss:~ # cat /etc/sysctl.conf
#
#  This file is read when going to multi-user and its contents piped thru
#  ``sysctl'' to adjust kernel values.  ``man 5 sysctl.conf'' for details.
#

### ZFS
vfs.zfs.min_auto_ashift=12         # ZFS 4k alignment for newly created pools (default 9)

### Security

#General
kern.randompid=1
security.bsd.see_other_uids=0            #Unprivileged processes may not see subjects/objects with different real uid
security.bsd.see_other_gids=0            #Unprivileged processes may not see subjects/objects with different real gid
security.bsd.see_jail_proc=0             #Unprivileged processes may not see subjects/objects with different jail ids
security.bsd.unprivileged_read_msgbuf=0  #Unprivileged processes may not read the kernel message buffer
security.bsd.unprivileged_proc_debug=0   #Unprivileged processes may use process debugging facilities
security.bsd.hardlink_check_gid=1        #Unprivileged processes cannot create hard links to files owned by other groups
security.bsd.hardlink_check_uid=1        #Unprivileged processes cannot create hard links to files owned by other users
security.jail.sysvipc_allowed=0
security.bsd.stack_guard_page=0 #1

#Ip
net.inet6.ip6.use_tempaddr=1
net.inet6.ip6.prefer_tempaddr=1
net.inet.sctp.blackhole=2
net.inet.udp.blackhole=1
net.inet.tcp.blackhole=2
net.inet.icmp.drop_redirect=1
net.inet.tcp.icmp_may_rst=0
net.inet.ip.maxfragpackets=0
net.inet.ip.maxfragsperpacket=0
net.inet.ip.check_interface=1
net.inet.ip.process_options=0
net.inet.ip.random_id=1
net.inet.ip.redirect=0
net.inet.tcp.cc.algorithm=htcp
net.inet.tcp.icmp_may_rst=0

#Adres map randomization
kern.elf32.aslr.pie_enable=1
kern.elf32.aslr.enable=1
kern.elf64.aslr.pie_enable=1
kern.elf64.aslr.enable=1

### Network tuning
kern.ipc.maxsockbuf=16777216
kern.ipc.nmbclusters=32768
kern.ipc.somaxconn=32768
kern.maxfiles=65536
kern.maxfilesperproc=32768
kern.maxvnodes=800000
net.inet.tcp.delayed_ack=0
net.inet.tcp.inflight.enable=0
net.inet.tcp.path_mtu_discovery=0
net.inet.tcp.recvbuf_auto=1
net.inet.tcp.recvbuf_inc=524288
net.inet.tcp.recvbuf_max=16777216
net.inet.tcp.recvspace=65536
net.inet.tcp.rfc1323=1
net.inet.tcp.sendbuf_auto=1
net.inet.tcp.sendbuf_inc=524288
net.inet.tcp.sendspace=65536
net.inet.udp.maxdgram=57344
net.inet.udp.recvspace=65536
net.local.stream.recvspace=65536
net.inet.tcp.sendbuf_max=16777216
net.inet.tcp.mssdflt=1460

Is that a bug or I am missing something?
 
There must be something wrong with your system, no core dump here:
Code:
# truss ulimit -s 3000
...
exit(0x0)
process exit, rval = 0
root-on-ZFS, fresh installed, not upgraded:
Code:
freebsd-version -kru
12.2-RELEASE-p1
12.2-RELEASE-p1
12.2-RELEASE-p2
Checked your sysctl(8) security tuning's settings, no core dump, but not the others, those a lot. You could try to disable them all, and enable block wise, see if it makes a difference.
 
Thanks for the help, found the culprit - memory ASLR when enabled is casing ulimit to crash:

Code:
root@abyss:~ # sysctl kern.elf64.aslr.enable=0
kern.elf64.aslr.enable: 1 -> 0
root@abyss:~ # ulimit -s 3000
root@abyss:~ # ulimit -s 3000
root@abyss:~ # ulimit -s 3000
root@abyss:~ # ulimit -s 3000
root@abyss:~ # ulimit -s 3000
root@abyss:~ # sysctl kern.elf64.aslr.enable=1
kern.elf64.aslr.enable: 0 -> 1
root@abyss:~ # ulimit -s 3000
Segmentation fault (core dumped)

I am wondering if I should open a PR for that? ASLR should not interfere with stack limits so there is probably a bug in the ulimit implementation?

EDIT: Created PR anyway - PR 252109
Topic solved, thanks for the help!
 
Back
Top