Date: Mon, 08 Apr 2024 06:51:25 +0000 From: bugzilla-noreply@freebsd.org To: jail@FreeBSD.org Subject: [Bug 278195] daemon in jail is exiting without informing that it failed to execute Message-ID: <bug-278195-29815-yxPdxxcljS@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-278195-29815@https.bugs.freebsd.org/bugzilla/> References: <bug-278195-29815@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D278195 --- Comment #3 from Zhenlei Huang <zlei@FreeBSD.org> --- Another truss(1) that show what happens when the `--close-fds` option is supplied. ``` # truss -f /tmp/daemon -fSl daemon echo OK ... 955: connect(3,{ AF_UNIX "/var/run/logpriv" },106) =3D 0 (0x0) 955: open("/dev/null",O_RDWR,00) =3D 4 (0x4) 955: sigaction(SIGHUP,{ SIG_IGN 0x0 ss_t },{ SIG_IGN SA_RESTART ss_t }) = =3D 0 (0x0) 956: <new process> 955: fork() =3D 956 (0x3bc) 956: setsid() =3D 956 (0x3bc) 956: sigaction(SIGHUP,{ SIG_IGN SA_RESTART ss_t },0x0) =3D 0 (0x0) 956: dup2(4,0) =3D 0 (0x0) 956: dup2(4,1) =3D 1 (0x1) 956: dup2(4,2) =3D 2 (0x2) 956: close(4) =3D 0 (0x0) 956: madvise(0x0,0,MADV_PROTECT) =3D 0 (0x0) 956: pipe2(0x7fffffffe950,0) =3D 0 (0x0) 956: write(2,"ld-elf.so.1: ",13) =3D 13 (0xd) 956: write(2,"/tmp/daemon: Undefined symbol "k"...,48) =3D 48 (0x30) 956: write(2,"\n",1) =3D 1 (0x1) 956: exit(0x1)=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 956: process exit, rval =3D 1 955: exit(0x0)=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 955: process exit, rval =3D 0 ``` So simply put, when `--close-fds` option is present, daemon(3) closes fd 0,= 1,2 and these fds are redirected to /dev/null but logfile or syslog is opened t= oo late to catch error messages. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-278195-29815-yxPdxxcljS>