From owner-freebsd-questions@FreeBSD.ORG Sun Dec 21 23:40:16 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3F3A016A4CE for ; Sun, 21 Dec 2003 23:40:16 -0800 (PST) Received: from einet.bg (sonata3.bginter.net [217.79.32.3]) by mx1.FreeBSD.org (Postfix) with ESMTP id DAE0843D1F for ; Sun, 21 Dec 2003 23:40:10 -0800 (PST) (envelope-from tie@einet.bg) Received: from root by einet.bg with scanned-ok (Exim 4.21) id 1AYKg4-0007zZ-6U for questions@FreeBSD.org; Mon, 22 Dec 2003 09:40:32 +0200 Received: from [217.79.34.250] (helo=filipov) by einet.bg with smtp (Exim 4.21) id 1AYKfw-0007yb-0L for questions@FreeBSD.org; Mon, 22 Dec 2003 09:40:24 +0200 Message-ID: <00d701c3c85e$e4e96d50$6e00a8c0@filipov> From: "Emil Filipov" To: Date: Mon, 22 Dec 2003 09:40:27 +0200 MIME-Version: 1.0 X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.1 Subject: Problems with Freebsd 5.1, jail and php mail() function (straced) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Dec 2003 07:40:16 -0000 Hi, I have a FreeBSD 5.1 box with jails. Some of them are 'builded' (with = make world and make distribution), others I have created 'by hand' by = copying files in the jail until things start to work. In one such 'handmade' jail I have deployed ftpd, apache with php,ssmtp. = Everything seems to be working fine except for the php mail() function.=20 As usual when there is no log message or warning giving a hint what is = missing, I tried to strace the process.Started with creating a simple = enough .php page, taken directly from a php manual: I tested it out of the jail environment and it worked. Tested it in a = 'builded' jail - also works.Strace is normal. While trying to strace it while executing within such 'handmade' jail I = get some output I have never seen: # strace -ffp 43685 accept(16, {...}, 0xbfbffb6c) =3D 0 syscall_416(0x1e, 0xbfbffb10, 0xbfbffaf0) =3D 0 fcntl(0, F_SETFD, FD_CLOEXEC) =3D 0 getsockname(0, {...}, 0xbfbffb6c) =3D 0 setsockopt(0, 0x6 /* SOL_?? */, TCP_NODELAY, 0xbfbffb30, 4) =3D 0 read(0, "GET /mytest.php HTTP/1.1\r\nAccept"..., 4096) =3D 202 syscall_416(0x1e, 0xbfbfda70, 0xbfbfda50) =3D 0 gettimeofday({791289914, 1091177770}, NULL) =3D 0 stat("/site/html/mytest.php", {st_mode=3DS_IFREG|0644, st_size=3D74, = ...}) =3D 0 sigprocmask(SIG_BLOCK, NULL, []) =3D 0 umask(077) =3D 022 umask(022) =3D 077 sigprocmask(SIG_BLOCK, NULL, []) =3D 0 setitimer(ITIMER_PROF, {it_interval=3D{0, 2047}, it_value=3D{0, 0}}, = NULL) =3D 0 syscall_416(0x1b, 0xbfbff800, 0xbfbff7e0) =3D 0 sigprocmask(SIG_UNBLOCK, [], NULL) =3D 0 sigprocmask(SIG_BLOCK, NULL, []) =3D 0 __getcwd("", 4095) =3D 0 chdir("") =3D 0 lstat("", {st_mode=3D0415, st_size=3D1292785156096, ...}) =3D 0 lstat("?", {st_mode=3D0, st_size=3D408021893229, ...}) =3D 0 lstat("c", {st_mode=3D0234, st_size=3D1653562409295, ...}) =3D 0 setitimer(ITIMER_PROF, {it_interval=3D{113, 107}, it_value=3D{232, 0}}, = NULL) =3D 0 syscall_416(0x1b, 0xbfbfe3a0, 0xbfbfe380) =3D 0 sigprocmask(SIG_UNBLOCK, [], NULL) =3D 0 __getcwd("", 1024) =3D 0 lstat("", {st_mode=3D0151060, st_size=3D15960098996242, ...}) =3D 0 lstat("", {st_mode=3D0, st_size=3D2946347565072, ...}) =3D 0 lstat("", {st_mode=3D073620, st_size=3D17364553302034, ...}) =3D 0 open("/site/html/mytest.php", O_RDONLY) =3D 1 fstat(1, {st_mode=3D023, st_size=3D8070450533662672128, ...}) =3D 0 fstat(1, {st_mode=3D0162755, st_size=3D6875142181715337580, ...}) =3D 0 lseek(1, 0, SEEK_CUR) =3D 0 lseek(1, 0, SEEK_SET) =3D 0 read(1, " ") =3D 0 sigprocmask(SIG_BLOCK, NULL, []) =3D 0 sigprocmask(SIG_BLOCK, NULL, []) =3D 0 sigprocmask(SIG_BLOCK, NULL, []) =3D 0 sigprocmask(SIG_BLOCK, NULL, []) =3D 0 sigprocmask(SIG_BLOCK, NULL, []) =3D 0 sigprocmask(SIG_BLOCK, NULL, []) =3D 0 sigprocmask(SIG_BLOCK, NULL, []) =3D 0 sigprocmask(SIG_BLOCK, NULL, []) =3D 0 sigprocmask(SIG_BLOCK, NULL, []) =3D 0 sigprocmask(SIG_BLOCK, NULL, []) =3D 0 sigprocmask(SIG_BLOCK, NULL, []) =3D 0 sigprocmask(SIG_BLOCK, NULL, []) =3D 0 sigprocmask(SIG_BLOCK, NULL, []) =3D 0 sigprocmask(SIG_BLOCK, NULL, []) =3D 0 sigprocmask(SIG_BLOCK, NULL, []) =3D 0 setitimer(ITIMER_PROF, {it_interval=3D{0, 2047}, it_value=3D{0, 0}}, = NULL) =3D 0 umask(022) =3D 022 select(1, [], NULL, NULL, {0, 674295616}) =3D 0 (Timeout) write(0, "HTTP/1.1 200 OK\r\nDate: Tue, 16 D"..., 210) =3D 210 (sorry for the lenghty output) This is a trace from one of the apache processes (the one which handles = the GET request for the former page). We see that everything is fine = UNTIL it comes time to fork() and invoke the php interpreter. I don't = understand what happens when that time comes - strace cannot follow the = vfork for some reasons. Of course I have tried with other parameters = also -F -v -s 100 , but haven't obtained more information about that.=20 I have mounted /proc in the jail, but the same problem occurs. I have = also tried to run strace from within the jail - same error. I would really appreciate any hint about what might be missing. Without = strace I'm kind of blind :) P.S.: One thing I almost forgot. I can execute jls from within the jail = and see some information about the other jailed hosts. Probably = shouldn't be like that? TIA, Emil Filipov