From owner-freebsd-emulation@FreeBSD.ORG Sun Jul 27 08:22:21 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D05BB1065673 for ; Sun, 27 Jul 2008 08:22:21 +0000 (UTC) (envelope-from ady@ady.ro) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.175]) by mx1.freebsd.org (Postfix) with ESMTP id AD7B98FC17 for ; Sun, 27 Jul 2008 08:22:21 +0000 (UTC) (envelope-from ady@ady.ro) Received: by wf-out-1314.google.com with SMTP id 24so3035621wfg.7 for ; Sun, 27 Jul 2008 01:22:21 -0700 (PDT) Received: by 10.143.1.12 with SMTP id d12mr1155099wfi.297.1217146940963; Sun, 27 Jul 2008 01:22:20 -0700 (PDT) Received: by 10.142.54.14 with HTTP; Sun, 27 Jul 2008 01:22:20 -0700 (PDT) Message-ID: <78cb3d3f0807270122r4d2377d9gbf4e3ed5386918fa@mail.gmail.com> Date: Sun, 27 Jul 2008 11:22:20 +0300 From: "Adrian Penisoara" Sender: ady@ady.ro To: freebsd-database@freebsd.org, freebsd-emulation@freebsd.org, freebsd-ports@freebsd.org In-Reply-To: <78cb3d3f0807260841k336f20a9jce857189c55adb16@mail.gmail.com> MIME-Version: 1.0 References: <78cb3d3f0807260841k336f20a9jce857189c55adb16@mail.gmail.com> X-Google-Sender-Auth: 303984bfe21e394a Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: rofug@rofug.ro Subject: Q: Is there any use for Oracle database port installation under Linux compat root ? X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2008 08:22:22 -0000 Hi, I am working on a FreeBSD port for Oracle's XE database package[1] (Linux binaries) and I stumbled upon some issues related to USE_LINUX_PREFIX. Before going any further trying to support (as an option) installing the Oracle XE directly under the /compat/linux hierarchy (like the database/linux-oracle-instantclient-* ports are doing), I have to ask ask around the following: (1) Is there any real need/benefit to have an Oracle DB installation rooted under /compat/linux (e.g. /compat/linux/usr/lib/oracle/xe/...) ? Side note: in this case all shell scripts will need to be ran under /compat/linux/bin/bash. (2) How does one deal with installing manual pages and shared files with USE_LINUX_PREFIX -- do they also have to go under /compat/linux ? Using ${MANPREFIX} as a template gives wrong results in this case... PS: The port will try to install by default under /usr/lib/oracle/xe, per Oracle's Linux packaging specs (all of the shell/SQL scripts use this hardcoded path). References: [1] http://www.oracle.com/technology/products/database/xe/index.html Thank you for your time, Adrian Penisoara ROFUG / EnterpriseBSD From owner-freebsd-emulation@FreeBSD.ORG Sun Jul 27 08:38:49 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1FF1F106564A for ; Sun, 27 Jul 2008 08:38:49 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from redbull.bpaserver.net (redbullneu.bpaserver.net [213.198.78.217]) by mx1.freebsd.org (Postfix) with ESMTP id B91898FC08 for ; Sun, 27 Jul 2008 08:38:48 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from outgoing.leidinger.net (p54A55DC2.dip.t-dialin.net [84.165.93.194]) by redbull.bpaserver.net (Postfix) with ESMTP id 3E2972E4E7; Sat, 26 Jul 2008 09:17:22 +0200 (CEST) Received: from deskjail (deskjail.Leidinger.net [192.168.1.109]) by outgoing.leidinger.net (Postfix) with ESMTP id B59A26CAFA; Sat, 26 Jul 2008 09:10:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=Leidinger.net; s=outgoing-alex; t=1217056236; bh=0eVn/wXgW2lHAUtUNyZTTMI2UYmA7rBdw b1IktoTW6c=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To: References:Mime-Version:Content-Type:Content-Transfer-Encoding; b=n5rGspdncQ0vxvSAvNrkeseMILj56aYnMxBk53IZDPgrp0fvRTTuvHNEQScOVQKxi 3wGEwuVn/MfMxGq48+bOYjrWbK4SWXSqKaFopQogiWk0sDGcSFbj80Wjhe2t/I+tIqr eA662Y4RvThOZaR0hVcreMxPeimQ/hdFQxzgVGhzQ0awx4UFI43al3fVnF8eRonHFkm Bs8N1ffoOFHTpXBDxgu+ITLndnMUZ+Yv2l9o77+hif09lnrK0ZcEp+Jk3q+YDBApooR lM3H8notsweyyfIsapCelRztt2tNUVeGsR/BXcr607QASZ5nQl+MLKowtsweJH6VPXI gy9zbnpXw== Date: Sat, 26 Jul 2008 09:10:45 +0200 From: Alexander Leidinger To: Chagin Dmitry Message-ID: <20080726091045.4c617dc7@deskjail> In-Reply-To: <200807250700.m6P70FSF036132@freefall.freebsd.org> References: <200807250700.m6P70FSF036132@freefall.freebsd.org> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.11; i686-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BPAnet-MailScanner-Information: Please contact the ISP for more information X-MailScanner-ID: 3E2972E4E7.A6BDE X-BPAnet-MailScanner: Found to be clean X-BPAnet-MailScanner-SpamCheck: not spam, ORDB-RBL, SpamAssassin (not cached, score=-14.823, required 6, BAYES_00 -15.00, DKIM_SIGNED 0.00, DKIM_VERIFIED -0.00, RDNS_DYNAMIC 0.10, TW_BD 0.08) X-BPAnet-MailScanner-From: alexander@leidinger.net X-Spam-Status: No Cc: freebsd-emulation@FreeBSD.org Subject: Re: kern/117010: [linux] linux_getdents() get somethinng like buffer overflow X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2008 08:38:49 -0000 Quoting Chagin Dmitry (Fri, 25 Jul 2008 07:00:15 GMT): > The following reply was made to PR kern/117010; it has been noted by GNATS. > > From: Chagin Dmitry > To: bug-followup@freebsd.org, samflanker@gmail.com > Cc: > Subject: Re: kern/117010: [linux] linux_getdents() get somethinng like buffer > overflow > Date: Fri, 25 Jul 2008 10:22:46 +0400 (MSD) > > Please, try a patch below: > > diff --git a/src/sys/compat/linux/linux_file.c b/src/sys/compat/linux/linux_file > index 303bc3f..d88f95f 100644 > --- a/src/sys/compat/linux/linux_file.c > +++ b/src/sys/compat/linux/linux_file.c > @@ -303,8 +303,8 @@ struct l_dirent64 { > char d_name[LINUX_NAME_MAX + 1]; > }; > > -#define LINUX_RECLEN(de,namlen) \ > - ALIGN((((char *)&(de)->d_name - (char *)de) + (namlen) + 1)) > +#define LINUX_RECLEN(de,namlen,trail) \ > + ALIGN((((char *)&(de)->d_name - (char *)de) + (namlen) + trail)) The start of de->d_name minus the start of de should be the same as the offset of d_name in de, so I would expect that this is expressed with the offsetof maro instead of handmade. So the result of this is the offset plus a len + something. > #define LINUX_DIRBLKSIZ 512 > > @@ -436,8 +436,8 @@ again: > } I try to understand the code before this. There's "if (reclen & 3)" error out. Does it mean it has to be a multiple of 4? If yes it should be changed to some modulo calculation to make it obvious (the compiler should be able to do such micro optimisations, but I doubt the error case needs to be micro optimized). > linuxreclen = (is64bit) > - ? LINUX_RECLEN(&linux_dirent64, bdp->d_namlen) > - : LINUX_RECLEN(&linux_dirent, bdp->d_namlen); > + ? LINUX_RECLEN(&linux_dirent64, bdp->d_namlen, 1) > + : LINUX_RECLEN(&linux_dirent, bdp->d_namlen, 2); Translated: The length of the linux record is the offset plus the FreeBSD size plus something. Doesn't make sense to me. sizeof(linux_dirent) sound more suitable for this variable name. From the code it can not be the length of the linux record, but the size of a linux dirent struct which would be required to put all info inside (+ some more space... very suspicious). > if (reclen > len || resid < linuxreclen) { > outp++; First part: if the length of the current record is larger than the remaining free space (if it does not fit) go out of the loop... ok. Second part: if the length (in bytes?) is smaller than the theoretical size of the linux struct, go out of the loop. Ouch. Please tell me this is wrong (I didn't had breakfast yet, I really hope I misanalysed this because of this fact). I smell buffer mismanagement because of the strange 1 or 2 being added to the size, and I smell some convoluted logic there. Instead of trying to poke the thing until it works, I suggest to step back and have a look at the big picture if the entire part of the function can be improved. > it solves getdents() problem (at least at x86_64 emulation with > linux_base-f8) > > ps, be not bared, linux really has such features... What I would expect is to compare the strlen of the FreeBSD record with the size of the place in linux_dirent. If the FreeBSD record does not fit, fail (ENAMETOOLONG?). Compare the remaining space with the size of linux_dirent, if it is '<=' fill in the data into the fixed size struct. Bye, Alexander. -- The best way to inspire fresh thoughts is to seal the letter. http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 From owner-freebsd-emulation@FreeBSD.ORG Sun Jul 27 08:39:39 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9768F106566C; Sun, 27 Jul 2008 08:39:39 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from redbull.bpaserver.net (redbullneu.bpaserver.net [213.198.78.217]) by mx1.freebsd.org (Postfix) with ESMTP id 6B3608FC15; Sun, 27 Jul 2008 08:39:36 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from outgoing.leidinger.net (p54A55DC2.dip.t-dialin.net [84.165.93.194]) by redbull.bpaserver.net (Postfix) with ESMTP id 42B032E4BB; Sat, 26 Jul 2008 08:37:49 +0200 (CEST) Received: from deskjail (deskjail.Leidinger.net [192.168.1.109]) by outgoing.leidinger.net (Postfix) with ESMTP id 0BB6A6B3C4; Sat, 26 Jul 2008 08:31:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=Leidinger.net; s=outgoing-alex; t=1217053862; bh=phEj+3remF9kicmCZRRWDBPA+l7EhxMqh uUyHpm/8jk=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To: References:Mime-Version:Content-Type:Content-Transfer-Encoding; b=jRa+rIeH11mu+dHXJV9D9A9UOTR9bLAy5mbwV90yUWIAaCeoaOp8iPQKXhnynQCmt PJ3SoIvzLjP8mkpdV5XasV4I6OoAMp9u/XW7tmdb+Tq4yA43hXEs8qyYyXkPu6sVb6a 9spKIiGR4TC4RKMow1kLJRTYgqohpq6WFyoz+Aad3hQ86lgQmFlm0BzwRVdp4mYmGKc jYooPJx65DUaEQaMi773FPNC+gUiEEupHi4/ULhEGH3yLbreSs2gFt8aWyVQ4XcD+Pg /rZFulkJM3weHzV9FftcV86PRoPuzMEbHLCDCoq44CGZkyJ7sk3UbO/Un6iE+hzOCBH 3fNY1h1fA== Date: Sat, 26 Jul 2008 08:31:10 +0200 From: Alexander Leidinger To: "Sean C. Farley" Message-ID: <20080726083110.5d932695@deskjail> In-Reply-To: References: <20080723184450.GA25356@freebsd.org> <20080725082156.GA41887@freebsd.org> <20080725083122.GA42835@freebsd.org> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.11; i686-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BPAnet-MailScanner-Information: Please contact the ISP for more information X-MailScanner-ID: 42B032E4BB.44D85 X-BPAnet-MailScanner: Found to be clean X-BPAnet-MailScanner-SpamCheck: not spam, ORDB-RBL, SpamAssassin (not cached, score=-14.9, required 6, BAYES_00 -15.00, DKIM_SIGNED 0.00, DKIM_VERIFIED -0.00, RDNS_DYNAMIC 0.10) X-BPAnet-MailScanner-From: alexander@leidinger.net X-Spam-Status: No Cc: Roman Divacky , freebsd-emulation@FreeBSD.org, Chagin Dmitry Subject: Re: kern/122318 (CMake core dumping, chroot exiting) X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2008 08:39:39 -0000 Quoting "Sean C. Farley" (Fri, 25 Jul 2008 15:36:52 -0500 (CDT)): > On Fri, 25 Jul 2008, Chagin Dmitry wrote: > > uname must work on all supported linuxulators > > I agree, and it does work until I start playing with the Linux version. Don't play with the linux version while linux programs are running. Changing the version from 2.4.x to 2.6.x and vice versa while a program is running is not supported at all and known to cause havoc. Roman, do we have the possibility to make an easy check in the sysctl handler if a linux program is still running and return an error from the handler? Did I forgot something which makes it impossible to switch when a program was run under 2.6 and stopped? Sean, can you rule out the possibility that a program was still running under another version when you've seen the problems with uname? Bye, Alexander. -- BOFH excuse #37: heavy gravity fluctuation, move computer to floor rapidly http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 From owner-freebsd-emulation@FreeBSD.ORG Sun Jul 27 09:04:21 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CF421065685 for ; Sun, 27 Jul 2008 09:04:21 +0000 (UTC) (envelope-from ady@ady.ro) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.168]) by mx1.freebsd.org (Postfix) with ESMTP id 2C4768FC19 for ; Sun, 27 Jul 2008 09:04:21 +0000 (UTC) (envelope-from ady@ady.ro) Received: by wf-out-1314.google.com with SMTP id 24so3040912wfg.7 for ; Sun, 27 Jul 2008 02:04:20 -0700 (PDT) Received: by 10.142.128.6 with SMTP id a6mr958085wfd.68.1217086907231; Sat, 26 Jul 2008 08:41:47 -0700 (PDT) Received: by 10.142.54.14 with HTTP; Sat, 26 Jul 2008 08:41:47 -0700 (PDT) Message-ID: <78cb3d3f0807260841k336f20a9jce857189c55adb16@mail.gmail.com> Date: Sat, 26 Jul 2008 18:41:47 +0300 From: "Adrian Penisoara" Sender: ady@ady.ro To: freebsd-database@freebsd.org, freebsd-emulation , freebsd-ports@freebsd.org MIME-Version: 1.0 X-Google-Sender-Auth: bef1ad3e93073192 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: rofug@rofug.ro Subject: Q: Is there any use for Oracle database port installation under Linux compat root ? X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2008 09:04:21 -0000 Hi, I am working on a FreeBSD port for Oracle's XE database package[1] (Linux binaries) and I stumbled upon some issues related to USE_LINUX_PREFIX. Before going any further trying to support (as an option) installing the Oracle XE directly under the /compat/linux hierarchy (like the database/linux-oracle-instantclient-* ports are doing), I have to ask ask around the following: (1) Is there any real need/benefit to have an Oracle DB installation rooted under /compat/linux (e.g. /compat/linux/usr/lib/oracle/xe/...) ? Side note: in this case all shell scripts will need to be ran under /compat/linux/bin/bash. (2) How does one deal with installing manual pages and shared files with USE_LINUX_PREFIX -- do they also have to go under /compat/linux ? Using ${MANPREFIX} as a template gives wrong results in this case... PS: The port will try to install by default under /usr/lib/oracle/xe, per Oracle's Linux packaging specs (all of the shell/SQL scripts use this hardcoded path). References: [1] http://www.oracle.com/technology/products/database/xe/index.html Thank you for your time, Adrian Penisoara ROFUG / EnterpriseBSD From owner-freebsd-emulation@FreeBSD.ORG Sun Jul 27 09:04:26 2008 Return-Path: Delivered-To: freebsd-emulation@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2C02106567A; Sun, 27 Jul 2008 09:04:26 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (vlk.vlakno.cz [62.168.28.247]) by mx1.freebsd.org (Postfix) with ESMTP id 757A68FC0A; Sun, 27 Jul 2008 09:04:26 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id EEEC767A632; Sun, 27 Jul 2008 11:03:11 +0200 (CEST) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (vlk.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Z95RZ1CUxTtn; Sun, 27 Jul 2008 11:03:10 +0200 (CEST) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 97F4167A440; Sun, 27 Jul 2008 11:03:10 +0200 (CEST) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.2/8.14.2/Submit) id m6R93A7f063415; Sun, 27 Jul 2008 11:03:10 +0200 (CEST) (envelope-from rdivacky) Date: Sun, 27 Jul 2008 11:03:10 +0200 From: Roman Divacky To: Alexander Leidinger Message-ID: <20080727090309.GA63345@freebsd.org> References: <20080725082156.GA41887@freebsd.org> <20080725083122.GA42835@freebsd.org> <20080726083110.5d932695@deskjail> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080726083110.5d932695@deskjail> User-Agent: Mutt/1.4.2.3i Cc: freebsd-emulation@FreeBSD.org, "Sean C. Farley" , Chagin Dmitry Subject: Re: kern/122318 (CMake core dumping, chroot exiting) X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2008 09:04:26 -0000 On Sat, Jul 26, 2008 at 08:31:10AM +0200, Alexander Leidinger wrote: > Quoting "Sean C. Farley" (Fri, 25 Jul 2008 15:36:52 > -0500 (CDT)): > > > On Fri, 25 Jul 2008, Chagin Dmitry wrote: > > > > uname must work on all supported linuxulators > > > > I agree, and it does work until I start playing with the Linux version. > > Don't play with the linux version while linux programs are running. > Changing the version from 2.4.x to 2.6.x and vice versa while a program > is running is not supported at all and known to cause havoc. Roman, do > we have the possibility to make an easy check in the sysctl handler if > a linux program is still running and return an error from the handler? > Did I forgot something which makes it impossible to switch when a > program was run under 2.6 and stopped? I'll submit a patch that makes it impossible to switch the veresion when programs are running... it's not hard (elf{32}_brand_inuse() for every elf brand the linuxulator registered) From owner-freebsd-emulation@FreeBSD.ORG Sun Jul 27 09:22:12 2008 Return-Path: Delivered-To: freebsd-emulation@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6680106566B; Sun, 27 Jul 2008 09:22:12 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (vlk.vlakno.cz [62.168.28.247]) by mx1.freebsd.org (Postfix) with ESMTP id 892558FC15; Sun, 27 Jul 2008 09:22:12 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id C818867A632; Sun, 27 Jul 2008 11:20:58 +0200 (CEST) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (vlk.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tNuflPNAxFYU; Sun, 27 Jul 2008 11:20:55 +0200 (CEST) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id AC95467292A; Sun, 27 Jul 2008 11:20:55 +0200 (CEST) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.2/8.14.2/Submit) id m6R9Kt2a064333; Sun, 27 Jul 2008 11:20:55 +0200 (CEST) (envelope-from rdivacky) Date: Sun, 27 Jul 2008 11:20:55 +0200 From: Roman Divacky To: Alexander Leidinger Message-ID: <20080727092055.GA64264@freebsd.org> References: <20080725082156.GA41887@freebsd.org> <20080725083122.GA42835@freebsd.org> <20080726083110.5d932695@deskjail> <20080727090309.GA63345@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080727090309.GA63345@freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: freebsd-emulation@FreeBSD.org, "Sean C. Farley" , Chagin Dmitry Subject: [PATCH]: Re: kern/122318 (CMake core dumping, chroot exiting) X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2008 09:22:12 -0000 On Sun, Jul 27, 2008 at 11:03:10AM +0200, Roman Divacky wrote: > On Sat, Jul 26, 2008 at 08:31:10AM +0200, Alexander Leidinger wrote: > > Quoting "Sean C. Farley" (Fri, 25 Jul 2008 15:36:52 > > -0500 (CDT)): > > > > > On Fri, 25 Jul 2008, Chagin Dmitry wrote: > > > > > > uname must work on all supported linuxulators > > > > > > I agree, and it does work until I start playing with the Linux version. > > > > Don't play with the linux version while linux programs are running. > > Changing the version from 2.4.x to 2.6.x and vice versa while a program > > is running is not supported at all and known to cause havoc. Roman, do > > we have the possibility to make an easy check in the sysctl handler if > > a linux program is still running and return an error from the handler? > > Did I forgot something which makes it impossible to switch when a > > program was run under 2.6 and stopped? > > I'll submit a patch that makes it impossible to switch the veresion when > programs are running... it's not hard (elf{32}_brand_inuse() for every > elf brand the linuxulator registered) here it is: Index: linux_mib.c =================================================================== --- linux_mib.c (revision 180831) +++ linux_mib.c (working copy) @@ -251,8 +251,17 @@ { struct prison *pr; struct linux_prison *lpr; + Elf32_Brandinfo **brandinfo; int use26; + for (brandinfo = &linux_brandlist[0]; *brandinfo != NULL; + ++brandinfo) + if (elf32_brand_inuse(*brandinfo)) { + printf("Cannot change osrelease while Linux binaries are running.\r\n"); + return (EBUSY); + } + + use26 = (strlen(osrelease) >= 3 && osrelease[2] == '6'); pr = linux_get_prison(td); it's a copy'n'paste from i386/linux/linux_sysvec.c so I didnt bother to test it ;) but I guess it works :) roman From owner-freebsd-emulation@FreeBSD.ORG Sun Jul 27 10:15:15 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD45C1065674; Sun, 27 Jul 2008 10:15:15 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from redbull.bpaserver.net (redbullneu.bpaserver.net [213.198.78.217]) by mx1.freebsd.org (Postfix) with ESMTP id 65BA98FC13; Sun, 27 Jul 2008 10:15:15 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from outgoing.leidinger.net (p54A552B2.dip.t-dialin.net [84.165.82.178]) by redbull.bpaserver.net (Postfix) with ESMTP id 536F82E06F; Sun, 27 Jul 2008 12:15:07 +0200 (CEST) Received: from deskjail (deskjail.Leidinger.net [192.168.1.109]) by outgoing.leidinger.net (Postfix) with ESMTP id 1D56614E750; Sun, 27 Jul 2008 12:15:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=Leidinger.net; s=outgoing-alex; t=1217153704; bh=TjZHJtHIqLXVa17RqrJe376hpwPASM4K5 YSdyFnpCZI=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To: References:Mime-Version:Content-Type:Content-Transfer-Encoding; b=RTDmJUStvNNQjY7AoO0LIO4gzptBl9/EighdTdowRMlPGZKwTFh0/R4zIG5Q8JoX3 eyD1FSTMn7VpZSctJCMWtULunSTeNiNly6WlxGQK6BP1Tw1TDaXWTWyPpSjAHOcLEOM 1nNpxpnxOkXob4ivTn0VVRHAmABLMjEb14gvKqLHbGLfpKofrkqkP/pRhucQN77EdH8 b27hhxo+5SoxGv8FqTXCAk20seB5SKFyzExWtvqbPX/69f00XxPqw1/FWW6yHaCgtSr wO8UBpLgVXxd3RtyuunM1lclgruHnrkI27FUs6jmZB04LoxZB/y1uo4XEBFhAPraZCN K/QQAZhrw== Date: Sun, 27 Jul 2008 12:15:03 +0200 From: Alexander Leidinger To: "Adrian Penisoara" Message-ID: <20080727121503.679bc598@deskjail> In-Reply-To: <78cb3d3f0807270122r4d2377d9gbf4e3ed5386918fa@mail.gmail.com> References: <78cb3d3f0807260841k336f20a9jce857189c55adb16@mail.gmail.com> <78cb3d3f0807270122r4d2377d9gbf4e3ed5386918fa@mail.gmail.com> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.11; i686-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BPAnet-MailScanner-Information: Please contact the ISP for more information X-MailScanner-ID: 536F82E06F.6696C X-BPAnet-MailScanner: Found to be clean X-BPAnet-MailScanner-SpamCheck: not spam, ORDB-RBL, SpamAssassin (not cached, score=-14.9, required 6, BAYES_00 -15.00, DKIM_SIGNED 0.00, DKIM_VERIFIED -0.00, RDNS_DYNAMIC 0.10) X-BPAnet-MailScanner-From: alexander@leidinger.net X-Spam-Status: No Cc: freebsd-database@freebsd.org, freebsd-emulation@freebsd.org, rofug@rofug.ro, freebsd-ports@freebsd.org Subject: Re: Q: Is there any use for Oracle database port installation under Linux compat root ? X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2008 10:15:16 -0000 Quoting "Adrian Penisoara" (Sun, 27 Jul 2008 11:22:20 +0300): > Hi, > > I am working on a FreeBSD port for Oracle's XE database package[1] (Linux > binaries) and I stumbled upon some issues related to USE_LINUX_PREFIX. > Before going any further trying to support (as an option) installing the > Oracle XE directly under the /compat/linux hierarchy (like the > database/linux-oracle-instantclient-* ports are doing), I have to ask ask > around the following: > > (1) Is there any real need/benefit to have an Oracle DB installation rooted > under /compat/linux (e.g. /compat/linux/usr/lib/oracle/xe/...) ? Side note: > in this case all shell scripts will need to be ran under > /compat/linux/bin/bash. > > (2) How does one deal with installing manual pages and shared files with > USE_LINUX_PREFIX -- do they also have to go under /compat/linux ? Using > ${MANPREFIX} as a template gives wrong results in this case... A port has to install into LINUXPREFIX, if it is an infrastructure port (no part has to go outside this location). It has to install into the default location (PREFIX/LOCALBASE), if it is an enduser port. That's the easy part. Now the classification, what is what, is the hard part. The linux png/jpeg or whatever lib is for sure infrastructure. If this would land in the default FreeBSD lib path, rest assured it would hurt. A linux acroread port is an enduser application, a user will call it directly to work with it. It also does not come with libs in the default FreeBSD locations, so everything will be fine if it is installed in the default location. For the Oracle stuff I can imagine that it is a hard question. If it doesn't put libs into a FreeBSD lib directory (a subdirectory of a lib directory is ok, as it will not cause immediate problems), there are no immediate objections to putting it into the default FreeBSD location (and as the DBA as an enduser would use it, this would fit into the description above). But we also have the rule that nothing is allowed to be put into the basesystem (/usr/Y instead of /usr/local/Y). Think about jails where the base is mounted read-only and only additional programs are in a RW part. In the end it comes down to what you are able to do and how hard the software is to port. Maybe it is easy to install everything into LINUXBASE and install a wrapper into LOCALBASE (/usr/local/bin/Y would be a script with #!/compat/linux/bin/bash and start whatever is needed to start /compat/linux/bin/Y). Maybe the installation of the software allows to install into /usr/local/softwarename and you can make links from /usr/local/bin/ to it. The rules for this are strong suggestions. If it is possible to do, do everything you can to follow the rules, if you don't know how to make something follow the rules, ask specific questions on ports if someone has in idea. If there's no idea, forget the rule and try to do something as close as possible to the goal of the rule (and document what/why). Bye, Alexander. -- Absolutely nothing in the world is friendlier than a wet dog. http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 From owner-freebsd-emulation@FreeBSD.ORG Sun Jul 27 17:03:05 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F12FE106567C for ; Sun, 27 Jul 2008 17:03:05 +0000 (UTC) (envelope-from ady@ady.ro) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.171]) by mx1.freebsd.org (Postfix) with ESMTP id CC7A78FC21 for ; Sun, 27 Jul 2008 17:03:05 +0000 (UTC) (envelope-from ady@ady.ro) Received: by wf-out-1314.google.com with SMTP id 24so3118014wfg.7 for ; Sun, 27 Jul 2008 10:03:05 -0700 (PDT) Received: by 10.142.222.4 with SMTP id u4mr1273943wfg.329.1217178185235; Sun, 27 Jul 2008 10:03:05 -0700 (PDT) Received: by 10.142.54.14 with HTTP; Sun, 27 Jul 2008 10:03:05 -0700 (PDT) Message-ID: <78cb3d3f0807271003q3f5ab72dr2147cf7b1a3348fc@mail.gmail.com> Date: Sun, 27 Jul 2008 20:03:05 +0300 From: "Adrian Penisoara" Sender: ady@ady.ro To: "Alexander Leidinger" In-Reply-To: <20080727121503.679bc598@deskjail> MIME-Version: 1.0 References: <78cb3d3f0807260841k336f20a9jce857189c55adb16@mail.gmail.com> <78cb3d3f0807270122r4d2377d9gbf4e3ed5386918fa@mail.gmail.com> <20080727121503.679bc598@deskjail> X-Google-Sender-Auth: 7cff4f34a5921255 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-database@freebsd.org, freebsd-emulation@freebsd.org, rofug@rofug.ro, freebsd-ports@freebsd.org Subject: Re: Q: Is there any use for Oracle database port installation under Linux compat root ? X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2008 17:03:06 -0000 Hi, On Sun, Jul 27, 2008 at 1:15 PM, Alexander Leidinger < Alexander@leidinger.net> wrote: > Quoting "Adrian Penisoara" (Sun, 27 Jul 2008 11:22:20 > +0300): > > > Hi, > > > > I am working on a FreeBSD port for Oracle's XE database package[1] > (Linux > > binaries) and I stumbled upon some issues related to USE_LINUX_PREFIX. > > Before going any further trying to support (as an option) installing the > > Oracle XE directly under the /compat/linux hierarchy (like the > > database/linux-oracle-instantclient-* ports are doing), I have to ask ask > > around the following: > > > > (1) Is there any real need/benefit to have an Oracle DB installation > rooted > > under /compat/linux (e.g. /compat/linux/usr/lib/oracle/xe/...) ? Side > note: > > in this case all shell scripts will need to be ran under > > /compat/linux/bin/bash. > > > > (2) How does one deal with installing manual pages and shared files with > > USE_LINUX_PREFIX -- do they also have to go under /compat/linux ? Using > > ${MANPREFIX} as a template gives wrong results in this case... > > A port has to install into LINUXPREFIX, if it is an infrastructure > port (no part has to go outside this location). It has to install into > the default location (PREFIX/LOCALBASE), if it is an enduser port. > That's the easy part. Good pointer, I was missing this bit. Thanks. > > > Now the classification, what is what, is the hard part. The linux > png/jpeg or whatever lib is for sure infrastructure. If this would land > in the default FreeBSD lib path, rest assured it would hurt. A linux > acroread port is an enduser application, a user will call it directly > to work with it. It also does not come with libs in the default FreeBSD > locations, so everything will be fine if it is installed in the default > location. > > For the Oracle stuff I can imagine that it is a hard question. If it > doesn't put libs into a FreeBSD lib directory (a subdirectory of a lib > directory is ok, as it will not cause immediate problems), there are no > immediate objections to putting it into the default FreeBSD location > (and as the DBA as an enduser would use it, this would fit into the > description above). But we also have the rule that nothing is allowed > to be put into the basesystem (/usr/Y instead of /usr/local/Y). Think > about jails where the base is mounted read-only and only additional > programs are in a RW part. In the default configuration the binaries (and I mean all of them!) would be placed under /usr/lib/oracle, since this is a hardcoded path in all places. I will also offer a "WITH_BSDHIER" option which will root the installation into /usr/local/oracle and just make a symlink under /usr/lib. Should I rather make this the default ? ;) There are no libraries (or other binaries for that fact) installed outside the Oracle hierarchy (this is the general strategy for Oracle RDBMS products at least). So I guess it very nicely fits into the "enduser" picture you describe above. I'm just wandering whether a /compat/linux rooted installation would make sense. I am still interested to hear opinions from Oracle DBAs/users on this subject -- would you need this option ? > > > In the end it comes down to what you are able to do and how hard the > software is to port. Maybe it is easy to install everything into > LINUXBASE and install a wrapper into LOCALBASE (/usr/local/bin/Y would > be a script with #!/compat/linux/bin/bash and start whatever is needed > to start /compat/linux/bin/Y). Maybe the installation of the software > allows to install into /usr/local/softwarename and you can make links > from /usr/local/bin/ to it. > > The rules for this are strong suggestions. If it is possible to do, > do everything you can to follow the rules, if you don't know how to > make something follow the rules, ask specific questions on ports if > someone has in idea. If there's no idea, forget the rule and try to do > something as close as possible to the goal of the rule (and document > what/why). > > Bye, > Alexander. > > Thank you for your time. Adrian. From owner-freebsd-emulation@FreeBSD.ORG Sun Jul 27 17:05:37 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8DA4106567A for ; Sun, 27 Jul 2008 17:05:37 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: from fk-out-0910.google.com (fk-out-0910.google.com [209.85.128.186]) by mx1.freebsd.org (Postfix) with ESMTP id 41AC58FC1F for ; Sun, 27 Jul 2008 17:05:37 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: by fk-out-0910.google.com with SMTP id k31so3888336fkk.11 for ; Sun, 27 Jul 2008 10:05:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:to:cc:subject :in-reply-to:message-id:references:user-agent:mime-version :content-type:from; bh=pZtGCrFupf4QN/Q88ohJrh7cPzCommpXuUQBikNBN9w=; b=SmCP/cLyuhjqH1+1rsSBwBbtUalxxgf0B8iNdO7wkVPFi/8SuYTilBsHOKlL752WtF GUwRSJANj4r9kt9QMKYSgQmxRUKaaiAlkjQBVItBI1N7n4zaSTrYmvtQ44y+qYniep3N GAL3Ai3L/gIVP8bE4zHQ398pieA/I4nDV8f/s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:to:cc:subject:in-reply-to:message-id:references:user-agent :mime-version:content-type:from; b=lt0+YqYuvEexfGZalkgnQ4iR4L+12Ed4822JvuDkShqBpHeQ+JTfKlN5Mt5CSOoAq9 ZG3BTvxAZSQoqz6oF8JBXUrNezmJMjOLLGkx8GM+jFMLRLNTSkFSlhRC1azLB0uexHGL 6cD8aQrPUpfGqAIEwxG9FcD4gy9dItn5vaKmg= Received: by 10.180.235.10 with SMTP id i10mr1016924bkh.56.1217178335441; Sun, 27 Jul 2008 10:05:35 -0700 (PDT) Received: from ora.chd.net ( [78.107.232.239]) by mx.google.com with ESMTPS id 35sm2507675fkt.12.2008.07.27.10.05.33 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 27 Jul 2008 10:05:34 -0700 (PDT) Date: Sun, 27 Jul 2008 21:05:03 +0400 (MSD) To: Alexander Leidinger In-Reply-To: <20080726091045.4c617dc7@deskjail> Message-ID: References: <200807250700.m6P70FSF036132@freefall.freebsd.org> <20080726091045.4c617dc7@deskjail> User-Agent: Alpine 1.10 (BSF 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed From: Chagin Dmitry Cc: freebsd-emulation@freebsd.org, Chagin Dmitry Subject: Re: kern/117010: [linux] linux_getdents() get somethinng like buffer overflow X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2008 17:05:37 -0000 On Sat, 26 Jul 2008, Alexander Leidinger wrote: > Quoting Chagin Dmitry (Fri, 25 Jul 2008 07:00:15 GMT): > >> The following reply was made to PR kern/117010; it has been noted by GNATS. >> >> From: Chagin Dmitry >> To: bug-followup@freebsd.org, samflanker@gmail.com >> Cc: >> Subject: Re: kern/117010: [linux] linux_getdents() get somethinng like buffer >> overflow >> Date: Fri, 25 Jul 2008 10:22:46 +0400 (MSD) >> >> Please, try a patch below: >> >> diff --git a/src/sys/compat/linux/linux_file.c b/src/sys/compat/linux/linux_file >> index 303bc3f..d88f95f 100644 >> --- a/src/sys/compat/linux/linux_file.c >> +++ b/src/sys/compat/linux/linux_file.c >> @@ -303,8 +303,8 @@ struct l_dirent64 { >> char d_name[LINUX_NAME_MAX + 1]; >> }; >> >> -#define LINUX_RECLEN(de,namlen) \ >> - ALIGN((((char *)&(de)->d_name - (char *)de) + (namlen) + 1)) >> +#define LINUX_RECLEN(de,namlen,trail) \ >> + ALIGN((((char *)&(de)->d_name - (char *)de) + (namlen) + trail)) > > > The start of de->d_name minus the start of de should be the same as the offset of d_name in de, so I would expect that this is expressed with the offsetof maro instead of handmade. > > So the result of this is the offset plus a len + something. > well... agree. >> #define LINUX_DIRBLKSIZ 512 >> >> @@ -436,8 +436,8 @@ again: >> } > > I try to understand the code before this. There's "if (reclen & 3)" error out. Does it mean it has to be a multiple of 4? If yes it should be changed to some modulo calculation to make it obvious (the compiler should be able to do such micro optimisations, but I doubt the error case needs to be micro optimized). > this code looks as a workaround... exists since v1.1, I don't understand what is it. >> linuxreclen = (is64bit) >> - ? LINUX_RECLEN(&linux_dirent64, bdp->d_namlen) >> - : LINUX_RECLEN(&linux_dirent, bdp->d_namlen); >> + ? LINUX_RECLEN(&linux_dirent64, bdp->d_namlen, 1) >> + : LINUX_RECLEN(&linux_dirent, bdp->d_namlen, 2); > > Translated: The length of the linux record is the offset plus the FreeBSD size plus something. Doesn't make sense to me. sizeof(linux_dirent) sound more suitable for this variable name. From the code it can not be the length of the linux record, but the size of a linux dirent struct which would be required to put all info inside (+ some more space... very suspicious). > >> if (reclen > len || resid < linuxreclen) { >> outp++; > > First part: if the length of the current record is larger than the remaining free space (if it does not fit) go out of the loop... ok. > no, here reclen is the length of FreeBSD record and len is the remaining space in FreeBSD records buffer. > Second part: if the length (in bytes?) is smaller than the theoretical size of the linux struct, go out of the loop. Ouch. Please tell me this is wrong (I didn't had breakfast yet, I really hope I misanalysed this because of this fact). > no, resid is the free space in Linux records buffer, linuxreclen is the length of the Linux record. > I smell buffer mismanagement because of the strange 1 or 2 being added to the size, and I smell some convoluted logic there. Instead of trying to poke the thing until it works, I suggest to step back and have a look at the big picture if the entire part of the function can be improved. This is the Linux, as Roman says - linux is a really strange :) See linux source fs/readdir.c implementation of filldir functions > >> it solves getdents() problem (at least at x86_64 emulation with >> linux_base-f8) >> >> ps, be not bared, linux really has such features... > > What I would expect is to compare the strlen of the FreeBSD record with the size of the place in linux_dirent. If the FreeBSD record does not fit, fail (ENAMETOOLONG?). Compare the remaining space with the size of linux_dirent, if it is '<=' fill in the data into the fixed size struct. > It's done in the 'Second part' thnx! -- Have fun! chd From owner-freebsd-emulation@FreeBSD.ORG Sun Jul 27 17:16:35 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D83D91065674 for ; Sun, 27 Jul 2008 17:16:35 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: from fk-out-0910.google.com (fk-out-0910.google.com [209.85.128.187]) by mx1.freebsd.org (Postfix) with ESMTP id 619648FC15 for ; Sun, 27 Jul 2008 17:16:35 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: by fk-out-0910.google.com with SMTP id k31so3893772fkk.11 for ; Sun, 27 Jul 2008 10:16:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:to:cc:subject :in-reply-to:message-id:references:user-agent:mime-version :content-type:from; bh=UmA02ZXJxzCl6RC4h5RcCCiOdVp9V6rRasSMqHBCWtw=; b=MApHfopU9rl8Istn9e9G6F164rbNpTqjGtfzEuCA39UoKOPCnhz9V85JuFjzViVTVl AjeSaeWWzJTSq22Bqq71E9E8bDwR/MMG+mONjZqSV6/46vADctSFK/3SiwY60u445Fj+ Ts6Vdbz8mPVL24uSRHgjH4A47r0USkPrh+rnU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:to:cc:subject:in-reply-to:message-id:references:user-agent :mime-version:content-type:from; b=vxhVusl+N41s7/bHd1SywCZZ2GhsXzgPwC/nJAphItqW463d09uYx90LKs9FLm72GJ 20e8KXAVjTguFJ+1eULfthY8tOvwmlbO2FsLrVURk7b872OGMBoBBrNinDyMTtZPKt1l IAaB53qx78QAJSfaqZZAf/AAOKGhOcUwt6jtg= Received: by 10.181.4.17 with SMTP id g17mr1023282bki.67.1217178993839; Sun, 27 Jul 2008 10:16:33 -0700 (PDT) Received: from ora.chd.net ( [78.107.232.239]) by mx.google.com with ESMTPS id 13sm22486973fks.6.2008.07.27.10.16.29 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 27 Jul 2008 10:16:30 -0700 (PDT) Date: Sun, 27 Jul 2008 21:16:05 +0400 (MSD) To: Adrian Penisoara In-Reply-To: <78cb3d3f0807271003q3f5ab72dr2147cf7b1a3348fc@mail.gmail.com> Message-ID: References: <78cb3d3f0807260841k336f20a9jce857189c55adb16@mail.gmail.com> <78cb3d3f0807270122r4d2377d9gbf4e3ed5386918fa@mail.gmail.com> <20080727121503.679bc598@deskjail> <78cb3d3f0807271003q3f5ab72dr2147cf7b1a3348fc@mail.gmail.com> User-Agent: Alpine 1.10 (BSF 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed From: Chagin Dmitry Cc: freebsd-database@freebsd.org, Alexander Leidinger , freebsd-emulation@freebsd.org, rofug@rofug.ro, freebsd-ports@freebsd.org Subject: Re: Q: Is there any use for Oracle database port installation under Linux compat root ? X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2008 17:16:35 -0000 On Sun, 27 Jul 2008, Adrian Penisoara wrote: > Hi, > > On Sun, Jul 27, 2008 at 1:15 PM, Alexander Leidinger < > Alexander@leidinger.net> wrote: > >> Quoting "Adrian Penisoara" (Sun, 27 Jul 2008 11:22:20 >> +0300): >> >>> Hi, >>> >>> I am working on a FreeBSD port for Oracle's XE database package[1] >> (Linux >>> binaries) and I stumbled upon some issues related to USE_LINUX_PREFIX. >>> Before going any further trying to support (as an option) installing the >>> Oracle XE directly under the /compat/linux hierarchy (like the >>> database/linux-oracle-instantclient-* ports are doing), I have to ask ask >>> around the following: >>> >>> (1) Is there any real need/benefit to have an Oracle DB installation >> rooted >>> under /compat/linux (e.g. /compat/linux/usr/lib/oracle/xe/...) ? Side >> note: >>> in this case all shell scripts will need to be ran under >>> /compat/linux/bin/bash. >>> >>> (2) How does one deal with installing manual pages and shared files with >>> USE_LINUX_PREFIX -- do they also have to go under /compat/linux ? Using >>> ${MANPREFIX} as a template gives wrong results in this case... >> >> A port has to install into LINUXPREFIX, if it is an infrastructure >> port (no part has to go outside this location). It has to install into >> the default location (PREFIX/LOCALBASE), if it is an enduser port. >> That's the easy part. > > > Good pointer, I was missing this bit. Thanks. > > >> >> >> Now the classification, what is what, is the hard part. The linux >> png/jpeg or whatever lib is for sure infrastructure. If this would land >> in the default FreeBSD lib path, rest assured it would hurt. A linux >> acroread port is an enduser application, a user will call it directly >> to work with it. It also does not come with libs in the default FreeBSD >> locations, so everything will be fine if it is installed in the default >> location. >> >> For the Oracle stuff I can imagine that it is a hard question. If it >> doesn't put libs into a FreeBSD lib directory (a subdirectory of a lib >> directory is ok, as it will not cause immediate problems), there are no >> immediate objections to putting it into the default FreeBSD location >> (and as the DBA as an enduser would use it, this would fit into the >> description above). But we also have the rule that nothing is allowed >> to be put into the basesystem (/usr/Y instead of /usr/local/Y). Think >> about jails where the base is mounted read-only and only additional >> programs are in a RW part. > > > In the default configuration the binaries (and I mean all of them!) would > be placed under /usr/lib/oracle, since this is a hardcoded path in all > places. > I will also offer a "WITH_BSDHIER" option which will root the installation > into /usr/local/oracle and just make a symlink under /usr/lib. Should I > rather make this the default ? ;) > > There are no libraries (or other binaries for that fact) installed outside > the Oracle hierarchy (this is the general strategy for Oracle RDBMS products > at least). So I guess it very nicely fits into the "enduser" picture you > describe above. I'm just wandering whether a /compat/linux rooted > installation would make sense. > > I am still interested to hear opinions from Oracle DBAs/users on this > subject -- would you need this option ? > hi! I think that ora DBAs will tell that the best place it /home/ORAUSERNAME and this user should have shell /compat/linux/bin/bash thnx! > >> >> >> In the end it comes down to what you are able to do and how hard the >> software is to port. Maybe it is easy to install everything into >> LINUXBASE and install a wrapper into LOCALBASE (/usr/local/bin/Y would >> be a script with #!/compat/linux/bin/bash and start whatever is needed >> to start /compat/linux/bin/Y). Maybe the installation of the software >> allows to install into /usr/local/softwarename and you can make links >> from /usr/local/bin/ to it. >> >> The rules for this are strong suggestions. If it is possible to do, >> do everything you can to follow the rules, if you don't know how to >> make something follow the rules, ask specific questions on ports if >> someone has in idea. If there's no idea, forget the rule and try to do >> something as close as possible to the goal of the rule (and document >> what/why). >> >> Bye, >> Alexander. >> >> > Thank you for your time. > Adrian. > _______________________________________________ > freebsd-emulation@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-emulation > To unsubscribe, send any mail to "freebsd-emulation-unsubscribe@freebsd.org" > -- Have fun! chd From owner-freebsd-emulation@FreeBSD.ORG Sun Jul 27 18:41:34 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFECA1065675 for ; Sun, 27 Jul 2008 18:41:34 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (vlk.vlakno.cz [62.168.28.247]) by mx1.freebsd.org (Postfix) with ESMTP id 7546C8FC12 for ; Sun, 27 Jul 2008 18:41:33 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 568B567BA68; Sun, 27 Jul 2008 20:40:19 +0200 (CEST) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (vlk.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2MRp-iLEYKCu; Sun, 27 Jul 2008 20:40:07 +0200 (CEST) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 691C867AA9D; Sun, 27 Jul 2008 20:40:07 +0200 (CEST) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.2/8.14.2/Submit) id m6RIe65g099404; Sun, 27 Jul 2008 20:40:06 +0200 (CEST) (envelope-from rdivacky) Date: Sun, 27 Jul 2008 20:40:06 +0200 From: Roman Divacky To: Chagin Dmitry Message-ID: <20080727184006.GA99255@freebsd.org> References: <200807250700.m6P70FSF036132@freefall.freebsd.org> <20080726091045.4c617dc7@deskjail> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: Alexander Leidinger , freebsd-emulation@freebsd.org Subject: Re: kern/117010: [linux] linux_getdents() get somethinng like buffer overflow X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2008 18:41:34 -0000 On Sun, Jul 27, 2008 at 09:05:03PM +0400, Chagin Dmitry wrote: > On Sat, 26 Jul 2008, Alexander Leidinger wrote: > > >Quoting Chagin Dmitry (Fri, 25 Jul 2008 07:00:15 > >GMT): > > > >>The following reply was made to PR kern/117010; it has been noted by > >>GNATS. > >> > >>From: Chagin Dmitry > >>To: bug-followup@freebsd.org, samflanker@gmail.com > >>Cc: > >>Subject: Re: kern/117010: [linux] linux_getdents() get somethinng like > >>buffer > >> overflow > >>Date: Fri, 25 Jul 2008 10:22:46 +0400 (MSD) > >> > >> Please, try a patch below: > >> > >> diff --git a/src/sys/compat/linux/linux_file.c > >> b/src/sys/compat/linux/linux_file > >> index 303bc3f..d88f95f 100644 > >> --- a/src/sys/compat/linux/linux_file.c > >> +++ b/src/sys/compat/linux/linux_file.c > >> @@ -303,8 +303,8 @@ struct l_dirent64 { > >> char d_name[LINUX_NAME_MAX + 1]; > >> }; > >> > >> -#define LINUX_RECLEN(de,namlen) \ > >> - ALIGN((((char *)&(de)->d_name - (char *)de) + (namlen) + 1)) > >> +#define LINUX_RECLEN(de,namlen,trail) \ > >> + ALIGN((((char *)&(de)->d_name - (char *)de) + (namlen) + trail)) > > > > > >The start of de->d_name minus the start of de should be the same as the > >offset of d_name in de, so I would expect that this is expressed with the > >offsetof maro instead of handmade. > > > >So the result of this is the offset plus a len + something. > > > > well... agree. > > >> #define LINUX_DIRBLKSIZ 512 > >> > >> @@ -436,8 +436,8 @@ again: > >> } > > > >I try to understand the code before this. There's "if (reclen & 3)" error > >out. Does it mean it has to be a multiple of 4? If yes it should be > >changed to some modulo calculation to make it obvious (the compiler should > >be able to do such micro optimisations, but I doubt the error case needs > >to be micro optimized). > > > > this code looks as a workaround... exists since v1.1, I don't understand > what is it. > > > >> linuxreclen = (is64bit) > >> - ? LINUX_RECLEN(&linux_dirent64, bdp->d_namlen) > >> - : LINUX_RECLEN(&linux_dirent, bdp->d_namlen); > >> + ? LINUX_RECLEN(&linux_dirent64, bdp->d_namlen, 1) > >> + : LINUX_RECLEN(&linux_dirent, bdp->d_namlen, 2); > > > >Translated: The length of the linux record is the offset plus the FreeBSD > >size plus something. Doesn't make sense to me. sizeof(linux_dirent) sound > >more suitable for this variable name. From the code it can not be the > >length of the linux record, but the size of a linux dirent struct which > >would be required to put all info inside (+ some more space... very > >suspicious). > > > >> if (reclen > len || resid < linuxreclen) { > >> outp++; > > > >First part: if the length of the current record is larger than the > >remaining free space (if it does not fit) go out of the loop... ok. > > > > no, here reclen is the length of FreeBSD record and len is the remaining > space in FreeBSD records buffer. > > > >Second part: if the length (in bytes?) is smaller than the theoretical > >size of the linux struct, go out of the loop. Ouch. Please tell me this is > >wrong (I didn't had breakfast yet, I really hope I misanalysed this > >because of this fact). > > > > no, resid is the free space in Linux records buffer, linuxreclen is the > length of the Linux record. > > >I smell buffer mismanagement because of the strange 1 or 2 being added to > >the size, and I smell some convoluted logic there. Instead of trying to > >poke the thing until it works, I suggest to step back and have a look at > >the big picture if the entire part of the function can be improved. > > This is the Linux, as Roman says - linux is a really strange :) > See linux source fs/readdir.c implementation of filldir functions I'll look at the readdir.c implementation, analyze it but I guess Dmitry's version is ok. if I find it correct I think we should wait for someone to test it but if noone does I think it can be commited with just Dmitry's testing and my analysis :) roman From owner-freebsd-emulation@FreeBSD.ORG Mon Jul 28 06:54:15 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8EBD31065679 for ; Mon, 28 Jul 2008 06:54:15 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from redbull.bpaserver.net (redbullneu.bpaserver.net [213.198.78.217]) by mx1.freebsd.org (Postfix) with ESMTP id ECFB38FC1E for ; Mon, 28 Jul 2008 06:54:14 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from outgoing.leidinger.net (p54A547B7.dip.t-dialin.net [84.165.71.183]) by redbull.bpaserver.net (Postfix) with ESMTP id C097F2E0A5; Mon, 28 Jul 2008 08:54:07 +0200 (CEST) Received: from webmail.leidinger.net (webmail.leidinger.net [192.168.1.102]) by outgoing.leidinger.net (Postfix) with ESMTP id 041F968B3D; Mon, 28 Jul 2008 08:54:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=Leidinger.net; s=outgoing-alex; t=1217228044; bh=zqq/p7YLel3bfUPC0omhQ0CF4830F0kIg BH+lMe69ow=; h=Message-ID:Date:From:To:Cc:Subject:References: In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=n6BP+z6BwFlrMy7sajdUQy56iaqH+vk9sntG8/fgi5Eap43AWlSQqnnSHl3drGFA7 lztiLp7grihvemvhFry5RRxJk4iMny2L6VF3lL0iq1U/a/wZUyzCa/DzLSLmgVwiT/M 6fWxpcf+CxfNebjobbQw/nrdtdshl53Igi8xf/yo5kBcYJrNCL3EVd+Rk1JXtUrFAeK 4Uc11N+KawFwYWYx0B9JooScrL0EaQ4bbb8Fm5g+dnNKPxQsZtmub1ySGhBhdk3qp7W d0dsBlxfEu3PPH3xDEkoqVBqY6GnBoAjDCrKJvyDs8W21TYrK+ow9PnUuvNT5Rdz0NN UwgL5/lig== Received: (from www@localhost) by webmail.leidinger.net (8.14.2/8.13.8/Submit) id m6S6s3R3055386; Mon, 28 Jul 2008 08:54:03 +0200 (CEST) (envelope-from Alexander@Leidinger.net) Received: from pslux.cec.eu.int (pslux.cec.eu.int [158.169.9.14]) by webmail.leidinger.net (Horde Framework) with HTTP; Mon, 28 Jul 2008 08:54:03 +0200 Message-ID: <20080728085403.58063b2gbchdjtic@webmail.leidinger.net> X-Priority: 3 (Normal) Date: Mon, 28 Jul 2008 08:54:03 +0200 From: "Alexander Leidinger" To: "Chagin Dmitry" References: <200807250700.m6P70FSF036132@freefall.freebsd.org> <20080726091045.4c617dc7@deskjail> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable User-Agent: Internet Messaging Program (IMP) H3 (4.2) / FreeBSD-8.0 X-BPAnet-MailScanner-Information: Please contact the ISP for more information X-MailScanner-ID: C097F2E0A5.0D198 X-BPAnet-MailScanner: Found to be clean X-BPAnet-MailScanner-SpamCheck: not spam, ORDB-RBL, SpamAssassin (not cached, score=-13.927, required 6, BAYES_00 -15.00, DKIM_SIGNED 0.00, DKIM_VERIFIED -0.00, MIME_QP_LONG_LINE 1.40, RDNS_DYNAMIC 0.10, SMILEY -0.50, TW_BD 0.08) X-BPAnet-MailScanner-From: alexander@leidinger.net X-Spam-Status: No Cc: freebsd-emulation@freebsd.org Subject: Re: kern/117010: [linux] linux_getdents() get somethinng like buffer overflow X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2008 06:54:15 -0000 Quoting "Chagin Dmitry" (from Sun, 27 Jul =20 2008 21:05:03 +0400 (MSD)): > On Sat, 26 Jul 2008, Alexander Leidinger wrote: > >> Quoting Chagin Dmitry (Fri, 25 Jul 2008 =20 >> 07:00:15 GMT): >> >>> The following reply was made to PR kern/117010; it has been noted by GNA= TS. >>> >>> From: Chagin Dmitry >>> To: bug-followup@freebsd.org, samflanker@gmail.com >>> Cc: >>> Subject: Re: kern/117010: [linux] linux_getdents() get somethinng =20 >>> like buffer >>> overflow >>> Date: Fri, 25 Jul 2008 10:22:46 +0400 (MSD) >>> >>> Please, try a patch below: >>> >>> diff --git a/src/sys/compat/linux/linux_file.c =20 >>> b/src/sys/compat/linux/linux_file >>> index 303bc3f..d88f95f 100644 >>> --- a/src/sys/compat/linux/linux_file.c >>> +++ b/src/sys/compat/linux/linux_file.c >>> @@ -303,8 +303,8 @@ struct l_dirent64 { >>> =09char d_name[LINUX_NAME_MAX + 1]; >>> }; >>> >>> -#define LINUX_RECLEN(de,namlen) \ >>> - ALIGN((((char *)&(de)->d_name - (char *)de) + (namlen) + 1)) >>> +#define LINUX_RECLEN(de,namlen,trail) \ >>> + ALIGN((((char *)&(de)->d_name - (char *)de) + (namlen) + trail)) >> >> >> The start of de->d_name minus the start of de should be the same as =20 >> the offset of d_name in de, so I would expect that this is =20 >> expressed with the offsetof maro instead of handmade. >> >> So the result of this is the offset plus a len + something. >> > > well... agree. > >>> #define LINUX_DIRBLKSIZ 512 >>> >>> @@ -436,8 +436,8 @@ again: >>> =09=09} >> >> I try to understand the code before this. There's "if (reclen & 3)" =20 >> error out. Does it mean it has to be a multiple of 4? If yes it =20 >> should be changed to some modulo calculation to make it obvious =20 >> (the compiler should be able to do such micro optimisations, but I =20 >> doubt the error case needs to be micro optimized). >> > > this code looks as a workaround... exists since v1.1, I don't =20 > understand what is it. When you look at the FreeBSD manpage of dirent, it's not that surprising: ---snip--- /* * The dirent structure defines the format of directory entries =20 returned by * the getdirentries(2) system call. * * A directory entry has a struct dirent at the front of it, =20 containing its * inode number, the length of the entry, and the length of the name * contained in the entry. These are followed by the name padded to a= 4 * byte boundary with null bytes. All names are guaranteed null =20 terminated. * The maximum length of a name in a directory is MAXNAMLEN. */ ---snip--- >>> =09=09linuxreclen =3D (is64bit) >>> - ? LINUX_RECLEN(&linux_dirent64, bdp->d_namlen) >>> - : LINUX_RECLEN(&linux_dirent, bdp->d_namlen); >>> + ? LINUX_RECLEN(&linux_dirent64, bdp->d_namlen, 1) >>> + : LINUX_RECLEN(&linux_dirent, bdp->d_namlen, 2); >> >> Translated: The length of the linux record is the offset plus the =20 >> FreeBSD size plus something. Doesn't make sense to me. =20 >> sizeof(linux_dirent) sound more suitable for this variable name. =20 >> From the code it can not be the length of the linux record, but the =20 >> size of a linux dirent struct which would be required to put all =20 >> info inside (+ some more space... very suspicious). >> >>> =09=09if (reclen > len || resid < linuxreclen) { >>> =09=09=09outp++; >> >> First part: if the length of the current record is larger than the =20 >> remaining free space (if it does not fit) go out of the loop... ok. >> > > no, here reclen is the length of FreeBSD record and len is the =20 > remaining space in FreeBSD records buffer. len is the memory region where you construct the linux response, isn't it? >> Second part: if the length (in bytes?) is smaller than the =20 >> theoretical size of the linux struct, go out of the loop. Ouch. =20 >> Please tell me this is wrong (I didn't had breakfast yet, I really =20 >> hope I misanalysed this because of this fact). >> > > no, resid is the free space in Linux records buffer, linuxreclen is =20 > the length of the Linux record. Seems there was a part missing above... "lenght in bytes" =3D remaining =20 length in bytes. The important part is the use of the macro. The linux =20 reclen macro calculates some linux stuff + some freebsd stuff without =20 any limit checks. What happens if the size of the name member of the =20 struct changes in FreeBSD!?! Even if they _may_ be the same currently, =20 this is dangerous. >> I smell buffer mismanagement because of the strange 1 or 2 being =20 >> added to the size, and I smell some convoluted logic there. Instead =20 >> of trying to poke the thing until it works, I suggest to step back =20 >> and have a look at the big picture if the entire part of the =20 >> function can be improved. > > This is the Linux, as Roman says - linux is a really strange :) > See linux source fs/readdir.c implementation of filldir functions When I look at this, I even see more dragons in our code. In linux =20 (2.6 kernel) linux_dirent is playing the ARRAY[1] + size trick, in =20 FreeBSD it isn't. Some things are handled like in linux, but because =20 the trick is not done in FreeBSD, those can not be handled like in =20 linux. When I look at the patch you proposed, I also see a pitfall. In linux =20 in the 64bit case, it's "int reclen =3D ALIGN(NAME_OFFSET(dirent) + =20 namlen + 1, sizeof(u64));", in the 32bit case it's "int reclen =3D =20 ALIGN(NAME_OFFSET(dirent) + namlen + 2, sizeof(long));". This means =20 the length is aligned to 64bit for the 64bit case and 32bit in the =20 32bit case. >>> it solves getdents() problem (at least at x86_64 emulation with >>> linux_base-f8) >>> >>> ps, be not bared, linux really has such features... >> >> What I would expect is to compare the strlen of the FreeBSD record =20 >> with the size of the place in linux_dirent. If the FreeBSD record =20 >> does not fit, fail (ENAMETOOLONG?). Compare the remaining space =20 >> with the size of linux_dirent, if it is '<=3D' fill in the data into =20 >> the fixed size struct. >> > > It's done in the 'Second part' There should be a check before data is copied to the place. As the =20 size is already available, it doesn't cost much. I try to get some time this week to produce a patch which addresses my =20 concerns. Bye, Alexander. --=20 Moebius always does it on the same side. http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID =3D B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID =3D 72077137 From owner-freebsd-emulation@FreeBSD.ORG Mon Jul 28 07:00:14 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A72A91065671; Mon, 28 Jul 2008 07:00:14 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from redbull.bpaserver.net (redbullneu.bpaserver.net [213.198.78.217]) by mx1.freebsd.org (Postfix) with ESMTP id 532D28FC1A; Mon, 28 Jul 2008 07:00:14 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from outgoing.leidinger.net (p54A547B7.dip.t-dialin.net [84.165.71.183]) by redbull.bpaserver.net (Postfix) with ESMTP id ACE692E21C; Mon, 28 Jul 2008 09:00:08 +0200 (CEST) Received: from webmail.leidinger.net (webmail.leidinger.net [192.168.1.102]) by outgoing.leidinger.net (Postfix) with ESMTP id E876568CF4; Mon, 28 Jul 2008 09:00:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=Leidinger.net; s=outgoing-alex; t=1217228406; bh=edEFbomkHhl5IA8x8p5dLE9Ymd1l8/kCr 8K5vqNx9P0=; h=Message-ID:Date:From:To:Cc:Subject:References: In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=Qw3aAIR08P9TkozucGpGP7NuFILdH5bopUklW+dGZaktQJ4bJ+UPZ7qLfBYly+Nbn 7Bfjy4U6pppjJv/ain3JlH4XkVbF8bEbeyNF4LIP2EUgXbnyYsJZVoKKG1C3SMTSouT pfGYPXk2BzwrlIlUmk0V+Tf7VJ5tlwrWOiKjjmiP83PB8XtlH1lJTzwUHl/6W2lFLBK 6P+Iqryid/QxlHQcsnVb6gA27zO2qZi4F02A1tWnbDGtqnqnbZ3ErvDYmNYETTWYImf C2UkwI4tB8GgO7t6GuUyZmPQuQ4u+0OgqTYE9oLeDA5yzEiPFFnUZluVeZSWuxUDRPP cZZjkwRpQ== Received: (from www@localhost) by webmail.leidinger.net (8.14.2/8.13.8/Submit) id m6S705X0056682; Mon, 28 Jul 2008 09:00:05 +0200 (CEST) (envelope-from Alexander@Leidinger.net) Received: from pslux.cec.eu.int (pslux.cec.eu.int [158.169.9.14]) by webmail.leidinger.net (Horde Framework) with HTTP; Mon, 28 Jul 2008 09:00:05 +0200 Message-ID: <20080728090005.17761bm27kjkasg0@webmail.leidinger.net> X-Priority: 3 (Normal) Date: Mon, 28 Jul 2008 09:00:05 +0200 From: "Alexander Leidinger" To: "Roman Divacky" References: <200807250700.m6P70FSF036132@freefall.freebsd.org> <20080726091045.4c617dc7@deskjail> <20080727184006.GA99255@freebsd.org> In-Reply-To: <20080727184006.GA99255@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Internet Messaging Program (IMP) H3 (4.2) / FreeBSD-8.0 X-BPAnet-MailScanner-Information: Please contact the ISP for more information X-MailScanner-ID: ACE692E21C.C7A83 X-BPAnet-MailScanner: Found to be clean X-BPAnet-MailScanner-SpamCheck: not spam, ORDB-RBL, SpamAssassin (not cached, score=-15.4, required 6, autolearn=not spam, BAYES_00 -15.00, DKIM_SIGNED 0.00, DKIM_VERIFIED -0.00, RDNS_DYNAMIC 0.10, SMILEY -0.50) X-BPAnet-MailScanner-From: alexander@leidinger.net X-Spam-Status: No Cc: freebsd-emulation@freebsd.org, Chagin Dmitry Subject: Re: kern/117010: [linux] linux_getdents() get somethinng like buffer overflow X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2008 07:00:14 -0000 Quoting "Roman Divacky" (from Sun, 27 Jul 2008 20:40:06 +0200): > I'll look at the readdir.c implementation, analyze it but I guess > Dmitry's version is ok. if I find it correct I think we should > wait for someone to test it but if noone does I think it can be > commited with just Dmitry's testing and my analysis :) Can you confirm or deny http://www.cs.helsinki.fi/linux/linux-kernel/2001-02/1076.html ? Please give me a week, I try to come up with patches for review which address my concerns as expressed in my reply today to Dmitry. Bye, Alexander. -- There is hopeful symbolism in the fact that flags do not wave in a vacuum. -- Arthur C. Clarke http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 From owner-freebsd-emulation@FreeBSD.ORG Mon Jul 28 10:23:22 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF1451065674 for ; Mon, 28 Jul 2008 10:23:22 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: from fk-out-0910.google.com (fk-out-0910.google.com [209.85.128.187]) by mx1.freebsd.org (Postfix) with ESMTP id 26B0E8FC16 for ; Mon, 28 Jul 2008 10:23:21 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: by fk-out-0910.google.com with SMTP id k31so4415981fkk.11 for ; Mon, 28 Jul 2008 03:23:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:to:cc:subject :in-reply-to:message-id:references:user-agent:mime-version :content-type:from; bh=WrnaihLZ3P9g5dVWswQJATOVtZimkKq6w5EXxS7LLGY=; b=nDNb6wkNaAszS9thM/yqNY0w5dkI9QIeFfeGvorzVglDJQP0r+yKOTBC9Xqcx0PVhU 9KjKD12GeabIHgdE1I7RpKuH6x8apKzTo8XBL0KRaTq1M60gXNhhBvYi5B1K2bvsgVhV t5aCKw12O3UlDGLTdwOgop+pUoC+Yg2aeYLok= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:to:cc:subject:in-reply-to:message-id:references:user-agent :mime-version:content-type:from; b=BewoPtUqwe3VaR1hMFznqlSY0y8IunOYAvhYRtWoninIDSsPq9jkvMQCHSCukHIqe6 LHSQ1EG3sMqkISrPZH76UfeXolIpskMUDLVkWxN/CJOUK8g9FwVCjJdMa2u35M7h5LZK V7u1hBiaXi7ixpxkxXKRgS4djhE7HbxkbT4k4= Received: by 10.180.231.20 with SMTP id d20mr1327204bkh.11.1217240600102; Mon, 28 Jul 2008 03:23:20 -0700 (PDT) Received: from ora.chd.net ( [78.107.232.239]) by mx.google.com with ESMTPS id 28sm3056426fkx.1.2008.07.28.03.23.17 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 28 Jul 2008 03:23:19 -0700 (PDT) Date: Mon, 28 Jul 2008 14:23:03 +0400 (MSD) To: Alexander Leidinger In-Reply-To: <20080728085403.58063b2gbchdjtic@webmail.leidinger.net> Message-ID: References: <200807250700.m6P70FSF036132@freefall.freebsd.org> <20080726091045.4c617dc7@deskjail> <20080728085403.58063b2gbchdjtic@webmail.leidinger.net> User-Agent: Alpine 1.10 (BSF 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII From: Chagin Dmitry Cc: freebsd-emulation@freebsd.org, Chagin Dmitry Subject: Re: kern/117010: [linux] linux_getdents() get somethinng like buffer overflow X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2008 10:23:22 -0000 On Mon, 28 Jul 2008, Alexander Leidinger wrote: > Quoting "Chagin Dmitry" (from Sun, 27 Jul 2008 > 21:05:03 +0400 (MSD)): > >> On Sat, 26 Jul 2008, Alexander Leidinger wrote: >> >>> Quoting Chagin Dmitry (Fri, 25 Jul 2008 07:00:15 >>> GMT): >>> >>>> The following reply was made to PR kern/117010; it has been noted by >>>> GNATS. >>>> >>>> From: Chagin Dmitry >>>> To: bug-followup@freebsd.org, samflanker@gmail.com >>>> Cc: >>>> Subject: Re: kern/117010: [linux] linux_getdents() get somethinng like >>>> buffer >>>> overflow >>>> Date: Fri, 25 Jul 2008 10:22:46 +0400 (MSD) >>>> >>>> Please, try a patch below: >>>> >>>> diff --git a/src/sys/compat/linux/linux_file.c >>>> b/src/sys/compat/linux/linux_file >>>> index 303bc3f..d88f95f 100644 >>>> --- a/src/sys/compat/linux/linux_file.c >>>> +++ b/src/sys/compat/linux/linux_file.c >>>> @@ -303,8 +303,8 @@ struct l_dirent64 { >>>> char d_name[LINUX_NAME_MAX + 1]; >>>> }; >>>> >>>> -#define LINUX_RECLEN(de,namlen) \ >>>> - ALIGN((((char *)&(de)->d_name - (char *)de) + (namlen) + 1)) >>>> +#define LINUX_RECLEN(de,namlen,trail) \ >>>> + ALIGN((((char *)&(de)->d_name - (char *)de) + (namlen) + trail)) >>> >>> >>> The start of de->d_name minus the start of de should be the same as the >>> offset of d_name in de, so I would expect that this is expressed with the >>> offsetof maro instead of handmade. >>> >>> So the result of this is the offset plus a len + something. >>> >> >> well... agree. >> >>>> #define LINUX_DIRBLKSIZ 512 >>>> >>>> @@ -436,8 +436,8 @@ again: >>>> } >>> >>> I try to understand the code before this. There's "if (reclen & 3)" error >>> out. Does it mean it has to be a multiple of 4? If yes it should be >>> changed to some modulo calculation to make it obvious (the compiler should >>> be able to do such micro optimisations, but I doubt the error case needs >>> to be micro optimized). >>> >> >> this code looks as a workaround... exists since v1.1, I don't understand >> what is it. > > When you look at the FreeBSD manpage of dirent, it's not that surprising: > ---snip--- > /* > * The dirent structure defines the format of directory entries returned > by > * the getdirentries(2) system call. > * > * A directory entry has a struct dirent at the front of it, containing > its > * inode number, the length of the entry, and the length of the name > * contained in the entry. These are followed by the name padded to a 4 > * byte boundary with null bytes. All names are guaranteed null > terminated. > * The maximum length of a name in a directory is MAXNAMLEN. > */ > ---snip--- > ups... tnhx!, but what for we do here this check? IMO, it is excessive. >>>> linuxreclen = (is64bit) >>>> - ? LINUX_RECLEN(&linux_dirent64, bdp->d_namlen) >>>> - : LINUX_RECLEN(&linux_dirent, bdp->d_namlen); >>>> + ? LINUX_RECLEN(&linux_dirent64, bdp->d_namlen, 1) >>>> + : LINUX_RECLEN(&linux_dirent, bdp->d_namlen, 2); >>> >>> Translated: The length of the linux record is the offset plus the FreeBSD >>> size plus something. Doesn't make sense to me. sizeof(linux_dirent) sound >>> more suitable for this variable name. From the code it can not be the >>> length of the linux record, but the size of a linux dirent struct which >>> would be required to put all info inside (+ some more space... very >>> suspicious). >>> >>>> if (reclen > len || resid < linuxreclen) { >>>> outp++; >>> >>> First part: if the length of the current record is larger than the >>> remaining free space (if it does not fit) go out of the loop... ok. >>> >> >> no, here reclen is the length of FreeBSD record and len is the remaining >> space in FreeBSD records buffer. > > len is the memory region where you construct the linux response, isn't it? > you are mistaken here, len points to FreeBSD buffer filled by vop_readdir >>> Second part: if the length (in bytes?) is smaller than the theoretical >>> size of the linux struct, go out of the loop. Ouch. Please tell me this is >>> wrong (I didn't had breakfast yet, I really hope I misanalysed this >>> because of this fact). >>> >> >> no, resid is the free space in Linux records buffer, linuxreclen is the >> length of the Linux record. > > Seems there was a part missing above... "lenght in bytes" = remaining length > in bytes. The important part is the use of the macro. The linux reclen macro > calculates some linux stuff + some freebsd stuff without any limit checks. > What happens if the size of the name member of the struct changes in > FreeBSD!?! Even if they _may_ be the same currently, this is dangerous. > agree, we should do check before calculating linuxreclen, like: if (bdp->d_namlen > LINUX_NAME_MAX) { error = ENAMETOOLONG; goto out; } >>> I smell buffer mismanagement because of the strange 1 or 2 being added to >>> the size, and I smell some convoluted logic there. Instead of trying to >>> poke the thing until it works, I suggest to step back and have a look at >>> the big picture if the entire part of the function can be improved. >> >> This is the Linux, as Roman says - linux is a really strange :) >> See linux source fs/readdir.c implementation of filldir functions > > When I look at this, I even see more dragons in our code. In linux (2.6 > kernel) linux_dirent is playing the ARRAY[1] + size trick, in FreeBSD it > isn't. Some things are handled like in linux, but because the trick is not > done in FreeBSD, those can not be handled like in linux. > > When I look at the patch you proposed, I also see a pitfall. In linux in the > 64bit case, it's "int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, > sizeof(u64));", in the 32bit case it's "int reclen = > ALIGN(NAME_OFFSET(dirent) + namlen + 2, sizeof(long));". This means the > length is aligned to 64bit for the 64bit case and 32bit in the 32bit case. > ah.., getdents64 on all $arch's uses 64bit alignment, we should follow this behaviour. >>>> it solves getdents() problem (at least at x86_64 emulation with >>>> linux_base-f8) >>>> >>>> ps, be not bared, linux really has such features... >>> >>> What I would expect is to compare the strlen of the FreeBSD record with >>> the size of the place in linux_dirent. If the FreeBSD record does not fit, >>> fail (ENAMETOOLONG?). Compare the remaining space with the size of >>> linux_dirent, if it is '<=' fill in the data into the fixed size struct. >>> >> >> It's done in the 'Second part' > > There should be a check before data is copied to the place. As the size is > already available, it doesn't cost much. > > I try to get some time this week to produce a patch which addresses my > concerns. > ok, I shall test on amd64 :) thnx! -- Have fun! chd From owner-freebsd-emulation@FreeBSD.ORG Mon Jul 28 10:28:43 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CDE93106568A for ; Mon, 28 Jul 2008 10:28:43 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (vlk.vlakno.cz [62.168.28.247]) by mx1.freebsd.org (Postfix) with ESMTP id 7EAD38FC0C for ; Mon, 28 Jul 2008 10:28:43 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 4739967ECCB; Mon, 28 Jul 2008 12:27:28 +0200 (CEST) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (vlk.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mw4kolSRYeq5; Mon, 28 Jul 2008 12:27:19 +0200 (CEST) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 5E3756733CA; Mon, 28 Jul 2008 12:27:18 +0200 (CEST) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.2/8.14.2/Submit) id m6SARGwJ079364; Mon, 28 Jul 2008 12:27:16 +0200 (CEST) (envelope-from rdivacky) Date: Mon, 28 Jul 2008 12:27:15 +0200 From: Roman Divacky To: Chagin Dmitry Message-ID: <20080728102715.GA78842@freebsd.org> References: <200807250700.m6P70FSF036132@freefall.freebsd.org> <20080726091045.4c617dc7@deskjail> <20080728085403.58063b2gbchdjtic@webmail.leidinger.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: Alexander Leidinger , freebsd-emulation@freebsd.org Subject: Re: kern/117010: [linux] linux_getdents() get somethinng like buffer overflow X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2008 10:28:43 -0000 [snip of technical discussion] while I agree with the attitude that it should be fixed properly, we are in a situation where a simple patch fixes a problem. and the fix is correct. I think we should just commit Dmitry's patch and then talk about how to change linux_getdents() further. I looked at the Linux code and the alignment is really +2 for 32bit and +1 for 64 bit as Dmitry's patch does. do you guys agree that fixing the problem the simplest/fastest way now and then changing other things is the correct way? roman From owner-freebsd-emulation@FreeBSD.ORG Mon Jul 28 11:06:55 2008 Return-Path: Delivered-To: freebsd-emulation@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2930B106566B for ; Mon, 28 Jul 2008 11:06:55 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 106218FC18 for ; Mon, 28 Jul 2008 11:06:55 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m6SB6s6t078876 for ; Mon, 28 Jul 2008 11:06:54 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m6SB6sd2078872 for freebsd-emulation@FreeBSD.org; Mon, 28 Jul 2008 11:06:54 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 28 Jul 2008 11:06:54 GMT Message-Id: <200807281106.m6SB6sd2078872@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-emulation@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-emulation@FreeBSD.org X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2008 11:06:55 -0000 Current FreeBSD problem reports Critical problems Serious problems S Tracker Resp. Description -------------------------------------------------------------------------------- o kern/21463 emulation [linux] Linux compatability mode should not allow setu o kern/97326 emulation [linux] file descriptor leakage in linux emulation o kern/117010 emulation [linux] linux_getdents() get something like buffer ove 3 problems total. Non-critical problems S Tracker Resp. Description -------------------------------------------------------------------------------- o kern/11165 emulation [ibcs2] IBCS2 doesn't work correctly with PID_MAX 9999 o kern/29698 emulation [linux] [patch] linux ipcs doesn'work o kern/39201 emulation [linux] [patch] ptrace(2) and rfork(RFLINUXTHPN) confu o kern/41543 emulation [patch] [request] easier wine/w23 support a kern/72920 emulation [linux]: path "prefixing" is not done on unix domain s o kern/73777 emulation [linux] [patch] linux emulation: root dir special hand o kern/91293 emulation [svr4] [patch] *Experimental* Update to the SVR4 emula o ports/91318 emulation [fix] graphics/linux_dri: works on amd64 too o ports/121800 emulation x11-toolkits/linux-openmotif - OpenMotif upgrade to 2. o kern/122318 emulation [linux] [cmake]: Segmentation fault when running Linux o ports/123960 emulation Port fix: archivers/linux-par2cmdline - better handlin o ports/123964 emulation Mk fix: bsd.linux-rpm.mk - Handling of NOPORTDOCS 12 problems total. From owner-freebsd-emulation@FreeBSD.ORG Mon Jul 28 11:12:47 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B08010656D1 for ; Mon, 28 Jul 2008 11:12:47 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: from fk-out-0910.google.com (fk-out-0910.google.com [209.85.128.188]) by mx1.freebsd.org (Postfix) with ESMTP id B12378FC12 for ; Mon, 28 Jul 2008 11:12:46 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: by fk-out-0910.google.com with SMTP id k31so4445549fkk.11 for ; Mon, 28 Jul 2008 04:12:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:to:cc:subject :in-reply-to:message-id:references:user-agent:mime-version :content-type:from; bh=ZpmC9qaqCsZKj6NwR2Nys1UL6iEM+cAD5uDtQanojrc=; b=wwIvd15cowAMNyz8+CVmLvXe2AdnkdVsHpRXssJGege+3jlFH76zKbHDVpMuG4swK2 Wc1KX0U8nUe02GwciXd9v4SVEClzqNqccAniSMyYQqZNTlV1VWMz7O6Ev6AR++YEgUA6 ZZip1XYGnUjppX5DD8WJIF8BT5sD0RJ75MSCM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:to:cc:subject:in-reply-to:message-id:references:user-agent :mime-version:content-type:from; b=xuc+Zuk7PZFUUISDR7JWmXE8nKoiQ0H4vSBUCqKGbTVWrFaeM+5gAQzG6rnUuBNplp 0sQmGIB4qi9Akp/hhu5kUfFL/z0C1fv/UoX47gwyxuDX8CH6y7YgBjl11FzJ5Ty9ctq/ KC9tlrCnTIcEp6FYkQIfRWc4IKaIPATOSQXhI= Received: by 10.181.22.8 with SMTP id z8mr1348958bki.78.1217243565279; Mon, 28 Jul 2008 04:12:45 -0700 (PDT) Received: from ora.chd.net ( [78.107.232.239]) by mx.google.com with ESMTPS id 13sm23663406fks.6.2008.07.28.04.12.43 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 28 Jul 2008 04:12:44 -0700 (PDT) Date: Mon, 28 Jul 2008 15:12:31 +0400 (MSD) To: Chagin Dmitry In-Reply-To: Message-ID: References: <200807250700.m6P70FSF036132@freefall.freebsd.org> <20080726091045.4c617dc7@deskjail> <20080728085403.58063b2gbchdjtic@webmail.leidinger.net> User-Agent: Alpine 1.10 (BSF 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed From: Chagin Dmitry Cc: Alexander Leidinger , freebsd-emulation@freebsd.org Subject: Re: kern/117010: [linux] linux_getdents() get somethinng like buffer overflow X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2008 11:12:47 -0000 On Mon, 28 Jul 2008, Chagin Dmitry wrote: > > agree, we should do check before calculating linuxreclen, like: > > if (bdp->d_namlen > LINUX_NAME_MAX) { > error = ENAMETOOLONG; > goto out; > } > d_namlen declared as uint8_t, so comparison is always false. lets's leave it will not changed FreeBSD d_namlen type? -- Have fun! chd From owner-freebsd-emulation@FreeBSD.ORG Mon Jul 28 11:37:23 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7B6B106564A; Mon, 28 Jul 2008 11:37:23 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from redbull.bpaserver.net (redbullneu.bpaserver.net [213.198.78.217]) by mx1.freebsd.org (Postfix) with ESMTP id 2D7428FC18; Mon, 28 Jul 2008 11:37:23 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from outgoing.leidinger.net (p54A575C9.dip.t-dialin.net [84.165.117.201]) by redbull.bpaserver.net (Postfix) with ESMTP id 1461F2E15B; Mon, 28 Jul 2008 13:37:20 +0200 (CEST) Received: from webmail.leidinger.net (webmail.leidinger.net [192.168.1.102]) by outgoing.leidinger.net (Postfix) with ESMTP id 6999A6B3C1; Mon, 28 Jul 2008 13:37:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=Leidinger.net; s=outgoing-alex; t=1217245036; bh=+wBCjiJGSYf05RVHZwVPMRRUAYtg0acsh MkGF4Q+uic=; h=Message-ID:Date:From:To:Cc:Subject:References: In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=Q9YTfZTgBexubee+hSrihcnFaqCKSKmbo74Jwzgp2ETCnSY7HsVrVD12VV1TYacAY qd/xWYT2QrHXBJmwGZggbS9DI5UQh8sbK5JJrgMpsZib1t6r2CoN7IoPmVN5czRJvsE Iin+Ipbyhm75iUljSb7VehpKTW/bsi/de0/O7xnSfmVUX2Q28X/fk9qaEqMy8slOPy1 2k/mVwRguvpKUjZaoeewPw6fAhWpX1UskbVYnWBwnssqtSJekohNirxqMZeTPatgsaY NIGXUvl9vwrYhTUycEbphUyV1QCtUP8PNUlcZl6Dbg2X16PqvzW1/xcK20S1YeQ6IY6 TFCezBg5w== Received: (from www@localhost) by webmail.leidinger.net (8.14.2/8.13.8/Submit) id m6SBbGXJ003619; Mon, 28 Jul 2008 13:37:16 +0200 (CEST) (envelope-from Alexander@Leidinger.net) Received: from pslux.cec.eu.int (pslux.cec.eu.int [158.169.9.14]) by webmail.leidinger.net (Horde Framework) with HTTP; Mon, 28 Jul 2008 13:37:15 +0200 Message-ID: <20080728133715.1670576xbp279u04@webmail.leidinger.net> X-Priority: 3 (Normal) Date: Mon, 28 Jul 2008 13:37:15 +0200 From: "Alexander Leidinger" To: "Roman Divacky" References: <200807250700.m6P70FSF036132@freefall.freebsd.org> <20080726091045.4c617dc7@deskjail> <20080728085403.58063b2gbchdjtic@webmail.leidinger.net> <20080728102715.GA78842@freebsd.org> In-Reply-To: <20080728102715.GA78842@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable User-Agent: Internet Messaging Program (IMP) H3 (4.2) / FreeBSD-8.0 X-BPAnet-MailScanner-Information: Please contact the ISP for more information X-MailScanner-ID: 1461F2E15B.7F977 X-BPAnet-MailScanner: Found to be clean X-BPAnet-MailScanner-SpamCheck: not spam, ORDB-RBL, SpamAssassin (not cached, score=-13.504, required 6, BAYES_00 -15.00, DKIM_SIGNED 0.00, DKIM_VERIFIED -0.00, MIME_QP_LONG_LINE 1.40, RDNS_DYNAMIC 0.10) X-BPAnet-MailScanner-From: alexander@leidinger.net X-Spam-Status: No Cc: freebsd-emulation@freebsd.org, Chagin Dmitry Subject: Re: kern/117010: [linux] linux_getdents() get somethinng like buffer overflow X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2008 11:37:23 -0000 Quoting "Roman Divacky" (from Mon, 28 Jul 2008 =20 12:27:15 +0200): > > [snip of technical discussion] > > while I agree with the attitude that it should be fixed properly, we are > in a situation where a simple patch fixes a problem. and the fix is correc= t. > > I think we should just commit Dmitry's patch and then talk about how =20 > to change > linux_getdents() further. I looked at the Linux code and the =20 > alignment is really > +2 for 32bit and +1 for 64 bit as Dmitry's patch does. That's not the alignment, that's some simple but mandatory padding (a =20 comment should be written there what this is, for the "1" it's the =20 null byte of the name, for the second "1" (in the case of using "2"), =20 I don't know yet what it is). I haven't checked yet if the size =20 calculation (which has the wrong macro name ALIGN, it doesn't align, =20 it just used in the align process) does the right thing on 64bit =20 (padding to a 64bit boundary, so that the next entry starts at a 64bit =20 boundary =3D alignment of the structure). > do you guys agree that fixing the problem the simplest/fastest way =20 > now and then > changing other things is the correct way? It may fix the problem of some specific test cases, but I'm not sure =20 it fixes all use cases. I see this as a partial fix to allow people to =20 do some more tests in other areas of the linuxulator while someone is =20 looking into a complete fix. I don't object if you commit it, but =20 don't think dirent is bugfree after this (I would call it a temporary =20 workaround). Bye, Alexander. --=20 A day without sunshine .... is like ... night! http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID =3D B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID =3D 72077137 From owner-freebsd-emulation@FreeBSD.ORG Mon Jul 28 11:40:49 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B380A1065677 for ; Mon, 28 Jul 2008 11:40:49 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from redbull.bpaserver.net (redbullneu.bpaserver.net [213.198.78.217]) by mx1.freebsd.org (Postfix) with ESMTP id 555EF8FC18 for ; Mon, 28 Jul 2008 11:40:48 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from outgoing.leidinger.net (p54A575C9.dip.t-dialin.net [84.165.117.201]) by redbull.bpaserver.net (Postfix) with ESMTP id 4403F2E15A; Mon, 28 Jul 2008 13:40:40 +0200 (CEST) Received: from webmail.leidinger.net (webmail.leidinger.net [192.168.1.102]) by outgoing.leidinger.net (Postfix) with ESMTP id B35746B4B1; Mon, 28 Jul 2008 13:40:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=Leidinger.net; s=outgoing-alex; t=1217245237; bh=qLwd/uUWO4D6l2xDGlNrY/dOvwuxpC0on 9Z0sbEro/w=; h=Message-ID:Date:From:To:Cc:Subject:References: In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=IyEbD7gxXmD820PI6wxoedy3jBispnr/Y9EJmxlzUTMidxf81RPa7OJmGhO5GazLn x9M0mSoaGOyKfrYH0E6UMx8U9ApyPCByrzg0EHXx6sOZHPFDz+v+uj2VEgKukTxIvU6 20j1xPFrPcDh2sZGypQvbo0RKZg7OzooqoBrjpZPlsg4atwSamkUF3nh97fWS8txCh+ ohyZ4CllreFm87CBUv8LEg8uMT80xuM8cFEB2I51h3b1bictkbk8ateLDhQS3FSrwjI eB3AQYdW3TFFIVFy96B68IdbTLsY9KA9TeMEa/zQPBYfYdsff43o99FaeE0ZCnAG441 sVGkxl67A== Received: (from www@localhost) by webmail.leidinger.net (8.14.2/8.13.8/Submit) id m6SBebFm004238; Mon, 28 Jul 2008 13:40:37 +0200 (CEST) (envelope-from Alexander@Leidinger.net) Received: from pslux.cec.eu.int (pslux.cec.eu.int [158.169.9.14]) by webmail.leidinger.net (Horde Framework) with HTTP; Mon, 28 Jul 2008 13:40:37 +0200 Message-ID: <20080728134037.545016bbrhzspi68@webmail.leidinger.net> X-Priority: 3 (Normal) Date: Mon, 28 Jul 2008 13:40:37 +0200 From: "Alexander Leidinger" To: "Chagin Dmitry" References: <200807250700.m6P70FSF036132@freefall.freebsd.org> <20080726091045.4c617dc7@deskjail> <20080728085403.58063b2gbchdjtic@webmail.leidinger.net> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Internet Messaging Program (IMP) H3 (4.2) / FreeBSD-8.0 X-BPAnet-MailScanner-Information: Please contact the ISP for more information X-MailScanner-ID: 4403F2E15A.A2B4D X-BPAnet-MailScanner: Found to be clean X-BPAnet-MailScanner-SpamCheck: not spam, ORDB-RBL, SpamAssassin (not cached, score=-14.9, required 6, BAYES_00 -15.00, DKIM_SIGNED 0.00, DKIM_VERIFIED -0.00, RDNS_DYNAMIC 0.10) X-BPAnet-MailScanner-From: alexander@leidinger.net X-Spam-Status: No Cc: freebsd-emulation@freebsd.org Subject: Re: kern/117010: [linux] linux_getdents() get somethinng like buffer overflow X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2008 11:40:49 -0000 Quoting "Chagin Dmitry" (from Mon, 28 Jul 2008 15:12:31 +0400 (MSD)): > On Mon, 28 Jul 2008, Chagin Dmitry wrote: > >> >> agree, we should do check before calculating linuxreclen, like: >> >> if (bdp->d_namlen > LINUX_NAME_MAX) { >> error = ENAMETOOLONG; >> goto out; >> } >> > > d_namlen declared as uint8_t, so comparison is always false. lets's > leave it will not changed FreeBSD d_namlen type? In the kernel I prefer defensive programming. Better safe than sorry. As long as there's no evidence that it is a performance bottleneck, there's no need to micro-optimize. Bye, Alexander. -- Capitalism can exist in one of only two states: welfare or warfare. http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 From owner-freebsd-emulation@FreeBSD.ORG Sat Aug 2 16:02:10 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6EDE81065674 for ; Sat, 2 Aug 2008 16:02:10 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: from fk-out-0910.google.com (fk-out-0910.google.com [209.85.128.191]) by mx1.freebsd.org (Postfix) with ESMTP id DC5448FC0C for ; Sat, 2 Aug 2008 16:02:09 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: by fk-out-0910.google.com with SMTP id k31so2001002fkk.11 for ; Sat, 02 Aug 2008 09:02:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:to:cc:subject :in-reply-to:message-id:references:user-agent:mime-version :content-type:from; bh=tIyaTxkPaGbIqc2USbCpqL8hr9Nt8z0QfTUKPRYYcq8=; b=f3lTX6aI2N5usE7Y8TqPe1CwqSb61Iungy7gfBtfMEzSYNm7ltOnz0nhM4gCN4odNt n7iaDU+3EhXEL6FZfL/TmqC0vdrUKqeiBteqDiR2aVm5RwLns0qCCNZdCeIaZ0noSYTN Jpj+voP7oBRIyAL8/Qg0UAleyKRpe9mH28U00= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:to:cc:subject:in-reply-to:message-id:references:user-agent :mime-version:content-type:from; b=vKTvUXACKvrVbXPffsao01wG4rCP9ZCzANXfvv3ceesRFOZucm/8+4P5LSkBFTrnCR jtZKOEaebL1psMpCR4YwiMva1zR5u86uQHozvc40mx9daJNKuNMOzCx51B3LARPxNzZN PI4uQy5bAKA1ufgf+ist2dtj1G3LQKuNPmx00= Received: by 10.181.27.7 with SMTP id e7mr4457220bkj.17.1217692928605; Sat, 02 Aug 2008 09:02:08 -0700 (PDT) Received: from ora.chd.net ( [78.107.232.239]) by mx.google.com with ESMTPS id 22sm2498099fkr.4.2008.08.02.09.02.06 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 02 Aug 2008 09:02:07 -0700 (PDT) Date: Sat, 2 Aug 2008 20:02:00 +0400 (MSD) To: "Sean C. Farley" In-Reply-To: Message-ID: References: <20080723184450.GA25356@freebsd.org> <20080725082156.GA41887@freebsd.org> <20080725083122.GA42835@freebsd.org> User-Agent: Alpine 1.10 (BSF 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed From: Chagin Dmitry Cc: freebsd-emulation@freebsd.org, Chagin Dmitry Subject: Re: kern/122318 (CMake core dumping, chroot exiting) X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2008 16:02:10 -0000 On Fri, 25 Jul 2008, Sean C. Farley wrote: >>> 1. http://www.farley.org/freebsd/tmp/ktrace.out.bz2 >> >> I can't use it on -current, ktrace abi was changed. please, make >> itself linux_kdump :) > > Picky, picky! :) Here[2] you go. > > Sean > 2. http://www.farley.org/freebsd/tmp/ktrace.txt > Hi Sean, please try: http://78.107.232.239/linux_rt.patch I can't test it on i386, but on amd64@compat32 it works :) thnx! -- Have fun! chd From owner-freebsd-emulation@FreeBSD.ORG Sat Aug 2 20:54:44 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B97011065787 for ; Sat, 2 Aug 2008 20:54:44 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.154]) by mx1.freebsd.org (Postfix) with ESMTP id 400B18FC17 for ; Sat, 2 Aug 2008 20:54:44 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: by fg-out-1718.google.com with SMTP id l26so1945812fgb.35 for ; Sat, 02 Aug 2008 13:54:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:to:cc:subject :in-reply-to:message-id:references:user-agent:mime-version :content-type:from; bh=4/XaTIjrWg/hy/cVbU0m41F84YY7Wuc/QLQ69yaCrSU=; b=jeAZOBrXWvpZzBlHgkzzaExTSJzdFtUO9hRAeRegPfyAqX6pi0B5H3AtSMBMg7he9m pBI7WrCXSBYTmlOUCBMvtG54fduRVudesTt6sK5sfaXvCkPH38ZJX+7cjnMm6LLkl3aJ cMB7UN8wHUnvFGiMJ8gNz7c7IDKJqBI5ST7M8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:to:cc:subject:in-reply-to:message-id:references:user-agent :mime-version:content-type:from; b=dAkSYxT0BVGYm7h+KHxn5n3RFD2xnNjyDLowabXdk0PW+6ajFOOgyPZgvUGTiPj7+B zYDC7/bo5Uz2Vvzx2rqzoDv7TkRpsxbtNMISsDGyaBUdAblihEasZTZWljgBJaUW1O/m tQQ5nRhkmVrGvvGk9S0ITfufxlzffblPtbNB4= Received: by 10.86.95.20 with SMTP id s20mr8742594fgb.49.1217710475898; Sat, 02 Aug 2008 13:54:35 -0700 (PDT) Received: from ora.chd.net ( [78.107.232.239]) by mx.google.com with ESMTPS id l12sm3814291fgb.6.2008.08.02.13.54.34 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 02 Aug 2008 13:54:35 -0700 (PDT) Date: Sun, 3 Aug 2008 00:53:58 +0400 (MSD) To: "Sean C. Farley" In-Reply-To: Message-ID: References: User-Agent: Alpine 1.10 (BSF 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII From: Chagin Dmitry Cc: freebsd-emulation@freebsd.org Subject: [PATCH]Re: kern/122318 (CMake core dumping, chroot exiting) X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2008 20:54:44 -0000 On Wed, 23 Jul 2008, Sean C. Farley wrote: > I am seeing if anyone has any insight on this PR (kern/122318[1]). It > would be nice to once again build using cmake within a Linux chroot. :) > > Basically, the bug is that not only that cmake is dumping core; it is > also forcing the user out of the chroot environment. Here is the > command used to start the chroot: > /compat/linux/usr/sbin/chroot su - > > Thank you. > > Sean > 1. http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/122318 > here patches for -current and releng_7: http://78.107.232.239/rt_signals-current.patch http://78.107.232.239/rt_signals-releng_7.patch what patch do: - rt sigtramp code works (this solves PR) - align stack pointers - remove kern_sigaltstack() at the end of rt_sigreturn(), it's a bogus. Here there is some information on it: http://www.ussg.iu.edu/hypermail/linux/kernel/0405.2/1283.html thnx! -- Have fun! chd From owner-freebsd-emulation@FreeBSD.ORG Sat Aug 2 22:17:23 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53CBB106567B; Sat, 2 Aug 2008 22:17:23 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (vlk.vlakno.cz [62.168.28.247]) by mx1.freebsd.org (Postfix) with ESMTP id F15D78FC1C; Sat, 2 Aug 2008 22:17:21 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 6A51A68B494; Sun, 3 Aug 2008 00:16:03 +0200 (CEST) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (vlk.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ti2C65ujDcpI; Sun, 3 Aug 2008 00:16:02 +0200 (CEST) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 29A8F68B487; Sun, 3 Aug 2008 00:16:02 +0200 (CEST) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.2/8.14.2/Submit) id m72MG1Ab077958; Sun, 3 Aug 2008 00:16:01 +0200 (CEST) (envelope-from rdivacky) Date: Sun, 3 Aug 2008 00:16:01 +0200 From: Roman Divacky To: Chagin Dmitry Message-ID: <20080802221601.GA77929@freebsd.org> References: <20080725082156.GA41887@freebsd.org> <20080725083122.GA42835@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: freebsd-emulation@freebsd.org Subject: Re: kern/122318 (CMake core dumping, chroot exiting) X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2008 22:17:23 -0000 On Sat, Aug 02, 2008 at 08:02:00PM +0400, Chagin Dmitry wrote: > On Fri, 25 Jul 2008, Sean C. Farley wrote: > > >>> 1. http://www.farley.org/freebsd/tmp/ktrace.out.bz2 > >> > >>I can't use it on -current, ktrace abi was changed. please, make > >>itself linux_kdump :) > > > >Picky, picky! :) Here[2] you go. > > > >Sean > > 2. http://www.farley.org/freebsd/tmp/ktrace.txt > > > > Hi Sean, > please try: > > http://78.107.232.239/linux_rt.patch great! can you point me at linux sources file/line-no where did you find that it should be like this? anyway.. great work! roman From owner-freebsd-emulation@FreeBSD.ORG Sat Aug 2 22:22:40 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9644106567D; Sat, 2 Aug 2008 22:22:40 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (vlk.vlakno.cz [62.168.28.247]) by mx1.freebsd.org (Postfix) with ESMTP id 6956E8FC16; Sat, 2 Aug 2008 22:22:40 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 414D768B494; Sun, 3 Aug 2008 00:21:23 +0200 (CEST) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (vlk.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id P6dZ+wxT71A3; Sun, 3 Aug 2008 00:21:09 +0200 (CEST) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id BB6CC68B487; Sun, 3 Aug 2008 00:21:09 +0200 (CEST) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.2/8.14.2/Submit) id m72ML9W0078238; Sun, 3 Aug 2008 00:21:09 +0200 (CEST) (envelope-from rdivacky) Date: Sun, 3 Aug 2008 00:21:09 +0200 From: Roman Divacky To: Chagin Dmitry Message-ID: <20080802222109.GA78151@freebsd.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: freebsd-emulation@freebsd.org Subject: Re: [PATCH]Re: kern/122318 (CMake core dumping, chroot exiting) X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2008 22:22:40 -0000 On Sun, Aug 03, 2008 at 12:53:58AM +0400, Chagin Dmitry wrote: > On Wed, 23 Jul 2008, Sean C. Farley wrote: > > >I am seeing if anyone has any insight on this PR (kern/122318[1]). It > >would be nice to once again build using cmake within a Linux chroot. :) > > > >Basically, the bug is that not only that cmake is dumping core; it is > >also forcing the user out of the chroot environment. Here is the > >command used to start the chroot: > >/compat/linux/usr/sbin/chroot su - > > > >Thank you. > > > >Sean > > 1. http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/122318 > > > > here patches for -current and releng_7: > http://78.107.232.239/rt_signals-current.patch > http://78.107.232.239/rt_signals-releng_7.patch > > what patch do: > - rt sigtramp code works (this solves PR) > - align stack pointers > - remove kern_sigaltstack() at the end of rt_sigreturn(), it's a bogus. > Here there is some information on it: > http://www.ussg.iu.edu/hypermail/linux/kernel/0405.2/1283.html I quickly skimmed over it and it looks correct, but please avoid making gratuitous changes like moving stuff before comment after the comment etc. I will do a little more thorough review but so far it looks good great work dmitry! roman From owner-freebsd-emulation@FreeBSD.ORG Sat Aug 2 22:55:01 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F22111065676 for ; Sat, 2 Aug 2008 22:55:01 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.156]) by mx1.freebsd.org (Postfix) with ESMTP id 78EFA8FC1C for ; Sat, 2 Aug 2008 22:55:01 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: by fg-out-1718.google.com with SMTP id l26so1985074fgb.35 for ; Sat, 02 Aug 2008 15:55:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:to:cc:subject :in-reply-to:message-id:references:user-agent:mime-version :content-type:from; bh=DkCi81vRhoynSMZ8MRUhHle+WDsOeO4LCSAPf3QYK9Y=; b=bAHRa4FDZgIaNeMKKJ45fTCA/R17wzkofxYg2PPYZ9w8V13N0As8KCfCHCAzqWliE5 UrBgIs91wHxX7ZelFcLwvz3ZD8mmG/sgCQUfTKeyEmtYL7h9jzdFhCnECNcoVdUZsxmx ua6QklPbBKjPDJj3J8fsnddhyykvNaisd4ltc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:to:cc:subject:in-reply-to:message-id:references:user-agent :mime-version:content-type:from; b=YmnnOVkV1I4aXqwlt5YO5t559HV9jFyFllc2SRZ/fMv4SE5MTyZqPDYiDMYbnKq/qu 62b0kMqf9/+5VFzciVsu3U+ejFjAO/zd7xrmwMZHkKSymaAYsj+733O8qw2MIxSgNaL0 KrxEqNsk70bfeqn3EsSFIGejzzbHbES8d2OPc= Received: by 10.86.82.16 with SMTP id f16mr8858173fgb.9.1217717700125; Sat, 02 Aug 2008 15:55:00 -0700 (PDT) Received: from ora.chd.net ( [78.107.232.239]) by mx.google.com with ESMTPS id 4sm2623903fge.5.2008.08.02.15.54.58 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 02 Aug 2008 15:54:59 -0700 (PDT) Date: Sun, 3 Aug 2008 02:54:53 +0400 (MSD) To: Roman Divacky In-Reply-To: <20080802222109.GA78151@freebsd.org> Message-ID: References: <20080802222109.GA78151@freebsd.org> User-Agent: Alpine 1.10 (BSF 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed From: Chagin Dmitry Cc: freebsd-emulation@freebsd.org, Chagin Dmitry Subject: Re: [PATCH]Re: kern/122318 (CMake core dumping, chroot exiting) X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2008 22:55:02 -0000 On Sun, 3 Aug 2008, Roman Divacky wrote: > On Sun, Aug 03, 2008 at 12:53:58AM +0400, Chagin Dmitry wrote: >> On Wed, 23 Jul 2008, Sean C. Farley wrote: >> >>> I am seeing if anyone has any insight on this PR (kern/122318[1]). It >>> would be nice to once again build using cmake within a Linux chroot. :) >>> >>> Basically, the bug is that not only that cmake is dumping core; it is >>> also forcing the user out of the chroot environment. Here is the >>> command used to start the chroot: >>> /compat/linux/usr/sbin/chroot su - >>> >>> Thank you. >>> >>> Sean >>> 1. http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/122318 >>> >> >> here patches for -current and releng_7: >> http://78.107.232.239/rt_signals-current.patch >> http://78.107.232.239/rt_signals-releng_7.patch >> >> what patch do: >> - rt sigtramp code works (this solves PR) >> - align stack pointers >> - remove kern_sigaltstack() at the end of rt_sigreturn(), it's a bogus. >> Here there is some information on it: >> http://www.ussg.iu.edu/hypermail/linux/kernel/0405.2/1283.html > > I quickly skimmed over it and it looks correct, but please avoid > making gratuitous changes like moving stuff before comment after > the comment etc. > I have simply transferred a line on place where it should be :) > I will do a little more thorough review but so far it looks good > and please, test it on i386. -- Have fun! chd