Report forwarded to debian-bugs-dist@lists.debian.org, GNU Hurd Maintainers <bug-hurd@gnu.org>:
Bug#102437; Package hurd.   debian-bugs-dist@lists.debian.orgGNU Hurd Maintainers  Subject: Bug#102437: proc leaks memory with the bootstrap filesystem entry Reply-To: Marcus Brinkmann , 102437@bugs.debian.org Resent-From: Marcus Brinkmann Resent-To: debian-bugs-dist@lists.debian.org Resent-CC: GNU Hurd Maintainers Resent-Date: Wed, 27 Jun 2001 02:05:04 GMT Resent-Message-ID: Resent-Sender: owner@bugs.debian.org X-Debian-PR-Message: report 102437 X-Debian-PR-Package: hurd X-Debian-PR-Keywords: X-Loop: owner@bugs.debian.org Received: via spool by submit@bugs.debian.org id=B.99360716015484 (code B ref -1); Wed, 27 Jun 2001 02:05:04 GMT Date: Wed, 27 Jun 2001 03:59:03 +0200 To: submit@bugs.debian.org Message-ID: <20010627035903.A3552@212.23.136.22> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i From: Marcus Brinkmann Delivered-To: submit@bugs.debian.org Package: hurd Version: current Hi, this is really a nice obscure bug. Calling proc_getprocinfo on PID 4 (root filesystem server) causes proc to leak a couple of kilobytes (pages?) each time. This can easily be reproduced by ps -F hurd 0 ps -F hurd 4 ps -F hurd 0 etc. Do this right after booting, so RSS for proc is still under 1 MB (this makes it easier to see). To prove that PID 4 is the only process with this problem, the below program iterates over all pids. If you specify any command line arguments, it will skip PID 4. In this case, no memory is leaked. This is most certainly a bootstrap issue. Interestingly, the same behaviour is exposed in a sub hurd (for the sub hurds root filesystem and the sub hurds proc server). I have no concrete idea yet to what the actual bug is. Any hints, as always, appreciated. BTW, fork() makes proc leak memory as well. Reproduce with "forks 1000 10000". This seems to be an unrelated bug, which I plan to investigate after this one is fixed. Thanks, Marcus   Acknowledgement sent to Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>:
New Bug report received and forwarded. Copy sent to GNU Hurd Maintainers <bug-hurd@gnu.org>.   -t  From: owner@bugs.debian.org (Debian Bug Tracking System) To: Marcus Brinkmann Subject: Bug#102437: Acknowledgement (proc leaks memory with the bootstrap filesystem entry) Message-ID: In-Reply-To: <20010627035903.A3552@212.23.136.22> References: <20010627035903.A3552@212.23.136.22> X-Debian-PR-Message: ack 102437 Thank you for the problem report you have sent regarding Debian. This is an automatically generated reply, to let you know your message has been received. It is being forwarded to the developers mailing list for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): GNU Hurd Maintainers If you wish to submit further information on your problem, please send it to 102437@bugs.debian.org (and *not* to submit@bugs.debian.org). Please do not reply to the address at the top of this message, unless you wish to report a problem with the Bug-tracking system. Darren Benham (administrator, Debian Bugs database)   Received: (at submit) by bugs.debian.org; 27 Jun 2001 01:59:20 +0000 From Marcus.Brinkmann@ruhr-uni-bochum.de Tue Jun 26 20:59:20 2001 Return-path: Received: from (ulysses.g10code.de) [::ffff:212.23.136.22] by master.debian.org with esmtp (Exim 3.12 1 (Debian)) id 15F4bv-00041Z-00; Tue, 26 Jun 2001 20:59:20 -0500 Received: from marcus by ulysses.g10code.de with local (Exim 3.16 #3 (Debian)) id 15F4bg-0001lN-00 for ; Wed, 27 Jun 2001 03:59:04 +0200 Date: Wed, 27 Jun 2001 03:59:03 +0200 To: submit@bugs.debian.org Subject: proc leaks memory with the bootstrap filesystem entry Message-ID: <20010627035903.A3552@212.23.136.22> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i From: Marcus Brinkmann Delivered-To: submit@bugs.debian.org Package: hurd Version: current Hi, this is really a nice obscure bug. Calling proc_getprocinfo on PID 4 (root filesystem server) causes proc to leak a couple of kilobytes (pages?) each time. This can easily be reproduced by ps -F hurd 0 ps -F hurd 4 ps -F hurd 0 etc. Do this right after booting, so RSS for proc is still under 1 MB (this makes it easier to see). To prove that PID 4 is the only process with this problem, the below program iterates over all pids. If you specify any command line arguments, it will skip PID 4. In this case, no memory is leaked. This is most certainly a bootstrap issue. Interestingly, the same behaviour is exposed in a sub hurd (for the sub hurds root filesystem and the sub hurds proc server). I have no concrete idea yet to what the actual bug is. Any hints, as always, appreciated. BTW, fork() makes proc leak memory as well. Reproduce with "forks 1000 10000". This seems to be an unrelated bug, which I plan to investigate after this one is fixed. Thanks, Marcus   Information forwarded to debian-bugs-dist@lists.debian.org, GNU Hurd Maintainers <bug-hurd@gnu.org>:
Bug#102437; Package hurd.   debian-bugs-dist@lists.debian.orgGNU Hurd Maintainers  Subject: Bug#102437: proc leaks memory with the bootstrap filesystem entry Reply-To: Marcus Brinkmann , 102437@bugs.debian.org Resent-From: Marcus Brinkmann Orignal-Sender: Marcus Brinkmann Resent-To: debian-bugs-dist@lists.debian.org Resent-CC: GNU Hurd Maintainers Resent-Date: Wed, 27 Jun 2001 10:14:21 GMT Resent-Message-ID: Resent-Sender: owner@bugs.debian.org X-Debian-PR-Message: report 102437 X-Debian-PR-Package: hurd X-Debian-PR-Keywords: X-Loop: owner@bugs.debian.org Received: via spool by 102437-submit@bugs.debian.org id=B102437.9936340266215 (code B ref 102437); Wed, 27 Jun 2001 10:14:21 GMT Date: Wed, 27 Jun 2001 11:26:53 +0200 From: Marcus Brinkmann To: 102437@bugs.debian.org Message-ID: <20010627112653.B480@212.23.136.22> References: <20010627035903.A3552@212.23.136.22> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010627035903.A3552@212.23.136.22> User-Agent: Mutt/1.3.18i Sender: Marcus Brinkmann Delivered-To: 102437@bugs.debian.org On Wed, Jun 27, 2001 at 03:59:03AM +0200, Marcus Brinkmann wrote: > To prove that PID 4 is the only process with this > problem, the below program iterates over all pids. If you specify any command > line arguments, it will skip PID 4. In this case, no memory is leaked. #define _GNU_SOURCE #include #include int main (int argc, char *argv[]) { int i; int err; mach_port_t proc = getproc(); pid_t *pids; int pidslen; int flags = PI_FETCH_THREADS | PI_FETCH_THREAD_BASIC; int *piarray; int picount = 0; char *waits; int waitslen = 0; pids = 0; pidslen = 0; err = proc_getallpids (proc, &pids, &pidslen); if (err) { printf ("%s: proc_getallpids(): %s\n", argv[0], strerror(errno)); exit (1); } for (i = 0; i < pidslen; i++) { /* Specify an argument, and the symptoms go away. */ if (argc >= 2 && i == 4) continue; piarray = waits = picount = waitslen = 0; err = proc_getprocinfo (proc, pids[i], &flags, &piarray, &picount, &waits, &waitslen); if (err) { printf ("%s: proc_getprocinfo() for %i: %s\n", argv[0], pids[i], strerror(errno)); exit (1); } printf ("%i: %i, %i\n", pids[i], picount, waitslen); if (piarray) munmap (piarray, sizeof(int) * picount); if (waits) munmap (waits, sizeof(char) * waitslen); } } -- `Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org Marcus.Brinkmann@ruhr-uni-bochum.de http://www.marcus-brinkmann.de   Acknowledgement sent to Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>:
Extra info received and forwarded to list. Copy sent to GNU Hurd Maintainers <bug-hurd@gnu.org>.   -t  From: owner@bugs.debian.org (Debian Bug Tracking System) To: Marcus Brinkmann Subject: Bug#102437: Info received (was Bug#102437: proc leaks memory with the bootstrap filesystem entry) Message-ID: In-Reply-To: <20010627112653.B480@212.23.136.22> References: <20010627112653.B480@212.23.136.22> X-Debian-PR-Message: ack-info-maintonly 102437 Thank you for the additional information you have supplied regarding this problem report. It has been forwarded to the developer(s) and to the developers mailing list to accompany the original report. Your message has been sent to the package maintainer(s): GNU Hurd Maintainers If you wish to continue to submit further information on your problem, please send it to 102437@bugs.debian.org, as before. Please do not reply to the address at the top of this message, unless you wish to report a problem with the Bug-tracking system. Darren Benham (administrator, Debian Bugs database)   Received: (at 102437) by bugs.debian.org; 27 Jun 2001 09:27:06 +0000 From Marcus.Brinkmann@ruhr-uni-bochum.de Wed Jun 27 04:27:06 2001 Return-path: Received: from (localhost) [::ffff:212.23.136.22] by master.debian.org with esmtp (Exim 3.12 1 (Debian)) id 15FBbF-0001cC-00; Wed, 27 Jun 2001 04:27:06 -0500 Received: from marcus by localhost with local (Exim 3.22 #1 (Debian)) id 15FBb3-00009a-00 for <102437@bugs.debian.org>; Wed, 27 Jun 2001 11:26:53 +0200 Date: Wed, 27 Jun 2001 11:26:53 +0200 From: Marcus Brinkmann To: 102437@bugs.debian.org Subject: Re: Bug#102437: proc leaks memory with the bootstrap filesystem entry Message-ID: <20010627112653.B480@212.23.136.22> References: <20010627035903.A3552@212.23.136.22> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010627035903.A3552@212.23.136.22> User-Agent: Mutt/1.3.18i Sender: Marcus Brinkmann Delivered-To: 102437@bugs.debian.org On Wed, Jun 27, 2001 at 03:59:03AM +0200, Marcus Brinkmann wrote: > To prove that PID 4 is the only process with this > problem, the below program iterates over all pids. If you specify any command > line arguments, it will skip PID 4. In this case, no memory is leaked. #define _GNU_SOURCE #include #include int main (int argc, char *argv[]) { int i; int err; mach_port_t proc = getproc(); pid_t *pids; int pidslen; int flags = PI_FETCH_THREADS | PI_FETCH_THREAD_BASIC; int *piarray; int picount = 0; char *waits; int waitslen = 0; pids = 0; pidslen = 0; err = proc_getallpids (proc, &pids, &pidslen); if (err) { printf ("%s: proc_getallpids(): %s\n", argv[0], strerror(errno)); exit (1); } for (i = 0; i < pidslen; i++) { /* Specify an argument, and the symptoms go away. */ if (argc >= 2 && i == 4) continue; piarray = waits = picount = waitslen = 0; err = proc_getprocinfo (proc, pids[i], &flags, &piarray, &picount, &waits, &waitslen); if (err) { printf ("%s: proc_getprocinfo() for %i: %s\n", argv[0], pids[i], strerror(errno)); exit (1); } printf ("%i: %i, %i\n", pids[i], picount, waitslen); if (piarray) munmap (piarray, sizeof(int) * picount); if (waits) munmap (waits, sizeof(char) * waitslen); } } -- `Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org Marcus.Brinkmann@ruhr-uni-bochum.de http://www.marcus-brinkmann.de   Information forwarded to debian-bugs-dist@lists.debian.org, GNU Hurd Maintainers <bug-hurd@gnu.org>:
Bug#102437; Package hurd.   debian-bugs-dist@lists.debian.orgGNU Hurd Maintainers  Subject: Bug#102437: dealloc missing on out parameters (was: Re: Bug#102437: proc leaks memory with the bootstrap filesystem entry Reply-To: Marcus Brinkmann , 102437@bugs.debian.org Resent-From: Marcus Brinkmann Orignal-Sender: Marcus Brinkmann Resent-To: debian-bugs-dist@lists.debian.org Resent-CC: GNU Hurd Maintainers Resent-Date: Wed, 27 Jun 2001 10:48:14 GMT Resent-Message-ID: Resent-Sender: owner@bugs.debian.org X-Debian-PR-Message: report 102437 X-Debian-PR-Package: hurd X-Debian-PR-Keywords: X-Loop: owner@bugs.debian.org Received: via spool by 102437-submit@bugs.debian.org id=B102437.99363813215848 (code B ref 102437); Wed, 27 Jun 2001 10:48:14 GMT Date: Wed, 27 Jun 2001 12:35:25 +0200 From: Marcus Brinkmann To: 102437@bugs.debian.org Message-ID: <20010627123525.B414@212.23.136.22> References: <20010627035903.A3552@212.23.136.22> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010627035903.A3552@212.23.136.22> User-Agent: Mutt/1.3.18i Sender: Marcus Brinkmann Delivered-To: 102437@bugs.debian.org On Wed, Jun 27, 2001 at 03:59:03AM +0200, Marcus Brinkmann wrote: > this is really a nice obscure bug. Oh man. This is a prime example for what you can read out of data if you want to. The real cause of the bug is the allocation of *piarray, which only happens if the number of threads in the task exceed a certain amount (about 30?). So, this will happen with all tasks that have many threads, and the root filesystem starts out with 41 threads on my system. A quick look at the mig server routines reveals the bug: routine proc_getprocinfo ( process: process_t; which: pid_t; inout flags: int; - out procinfo: procinfo_t; + out procinfo: procinfo_t, dealloc; out threadwaits: data_t, dealloc); There are other arrays which are used as out parameter but not have dealloc specified. Is any of these appropriate? We should really clean this up, as all of these can potentially leak memory if I am not mistaken. routine file_get_storage_info ( file: file_t; RPT - out ports: portarray_t; - out ints: intarray_t; - out offsets: off_array_t; - out data: data_t); + out ports: portarray_t, dealloc; + out ints: intarray_t, dealloc; + out offsets: off_array_t, dealloc; + out data: data_t, dealloc); routine file_get_fs_options ( file: file_t; RPT - out options: data_t); + out options: data_t, dealloc); routine fsys_get_options ( server: fsys_t; RPT - out options: data_t); + out options: data_t, dealloc); routine auth_getids ( handle: auth_t; - out euids: idarray_t; - out auids: idarray_t; - out egids: idarray_t; - out agids: idarray_t); + out euids: idarray_t, dealloc; + out auids: idarray_t, dealloc; + out egids: idarray_t, dealloc; + out agids: idarray_t, dealloc); routine auth_server_authenticate ( handle: auth_t; sreplyport reply: mach_port_poly_t; rendezvous: mach_port_send_t; newport: mach_port_poly_t; - out euids: idarray_t; - out auids: idarray_t; - out egids: idarray_t; - out agids: idarray_t); + out euids: idarray_t, dealloc; + out auids: idarray_t, dealloc; + out egids: idarray_t, dealloc; + out agids: idarray_t, dealloc); Marcus -- `Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org Marcus.Brinkmann@ruhr-uni-bochum.de http://www.marcus-brinkmann.de   Acknowledgement sent to Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>:
Extra info received and forwarded to list. Copy sent to GNU Hurd Maintainers <bug-hurd@gnu.org>.   -t  From: owner@bugs.debian.org (Debian Bug Tracking System) To: Marcus Brinkmann Subject: Bug#102437: Info received (was dealloc missing on out parameters (was: Re: Bug#102437: proc leaks memory with the bootstrap filesystem entry) Message-ID: In-Reply-To: <20010627123525.B414@212.23.136.22> References: <20010627123525.B414@212.23.136.22> X-Debian-PR-Message: ack-info-maintonly 102437 Thank you for the additional information you have supplied regarding this problem report. It has been forwarded to the developer(s) and to the developers mailing list to accompany the original report. Your message has been sent to the package maintainer(s): GNU Hurd Maintainers If you wish to continue to submit further information on your problem, please send it to 102437@bugs.debian.org, as before. Please do not reply to the address at the top of this message, unless you wish to report a problem with the Bug-tracking system. Darren Benham (administrator, Debian Bugs database)   Received: (at 102437) by bugs.debian.org; 27 Jun 2001 10:35:32 +0000 From Marcus.Brinkmann@ruhr-uni-bochum.de Wed Jun 27 05:35:32 2001 Return-path: Received: from (localhost) [::ffff:212.23.136.22] by master.debian.org with esmtp (Exim 3.12 1 (Debian)) id 15FCfU-00047Z-00; Wed, 27 Jun 2001 05:35:32 -0500 Received: from marcus by localhost with local (Exim 3.22 #1 (Debian)) id 15FCfO-0000BK-00 for <102437@bugs.debian.org>; Wed, 27 Jun 2001 12:35:26 +0200 Date: Wed, 27 Jun 2001 12:35:25 +0200 From: Marcus Brinkmann To: 102437@bugs.debian.org Subject: dealloc missing on out parameters (was: Re: Bug#102437: proc leaks memory with the bootstrap filesystem entry Message-ID: <20010627123525.B414@212.23.136.22> References: <20010627035903.A3552@212.23.136.22> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010627035903.A3552@212.23.136.22> User-Agent: Mutt/1.3.18i Sender: Marcus Brinkmann Delivered-To: 102437@bugs.debian.org On Wed, Jun 27, 2001 at 03:59:03AM +0200, Marcus Brinkmann wrote: > this is really a nice obscure bug. Oh man. This is a prime example for what you can read out of data if you want to. The real cause of the bug is the allocation of *piarray, which only happens if the number of threads in the task exceed a certain amount (about 30?). So, this will happen with all tasks that have many threads, and the root filesystem starts out with 41 threads on my system. A quick look at the mig server routines reveals the bug: routine proc_getprocinfo ( process: process_t; which: pid_t; inout flags: int; - out procinfo: procinfo_t; + out procinfo: procinfo_t, dealloc; out threadwaits: data_t, dealloc); There are other arrays which are used as out parameter but not have dealloc specified. Is any of these appropriate? We should really clean this up, as all of these can potentially leak memory if I am not mistaken. routine file_get_storage_info ( file: file_t; RPT - out ports: portarray_t; - out ints: intarray_t; - out offsets: off_array_t; - out data: data_t); + out ports: portarray_t, dealloc; + out ints: intarray_t, dealloc; + out offsets: off_array_t, dealloc; + out data: data_t, dealloc); routine file_get_fs_options ( file: file_t; RPT - out options: data_t); + out options: data_t, dealloc); routine fsys_get_options ( server: fsys_t; RPT - out options: data_t); + out options: data_t, dealloc); routine auth_getids ( handle: auth_t; - out euids: idarray_t; - out auids: idarray_t; - out egids: idarray_t; - out agids: idarray_t); + out euids: idarray_t, dealloc; + out auids: idarray_t, dealloc; + out egids: idarray_t, dealloc; + out agids: idarray_t, dealloc); routine auth_server_authenticate ( handle: auth_t; sreplyport reply: mach_port_poly_t; rendezvous: mach_port_send_t; newport: mach_port_poly_t; - out euids: idarray_t; - out auids: idarray_t; - out egids: idarray_t; - out agids: idarray_t); + out euids: idarray_t, dealloc; + out auids: idarray_t, dealloc; + out egids: idarray_t, dealloc; + out agids: idarray_t, dealloc); Marcus -- `Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org Marcus.Brinkmann@ruhr-uni-bochum.de http://www.marcus-brinkmann.de   Information forwarded to debian-bugs-dist@lists.debian.org, GNU Hurd Maintainers <bug-hurd@gnu.org>:
Bug#102437; Package hurd.   debian-bugs-dist@lists.debian.orgGNU Hurd Maintainers  Subject: Bug#102437: dealloc missing on out parameters (was: Re: Bug#102437: proc leaks memory with the bootstrap filesystem entry Reply-To: Roland McGrath , 102437@bugs.debian.org Resent-From: Roland McGrath Orignal-Sender: roland@frob.com Resent-To: debian-bugs-dist@lists.debian.org Resent-CC: GNU Hurd Maintainers Resent-Date: Wed, 27 Jun 2001 11:48:09 GMT Resent-Message-ID: Resent-Sender: owner@bugs.debian.org X-Debian-PR-Message: report 102437 X-Debian-PR-Package: hurd X-Debian-PR-Keywords: X-Loop: owner@bugs.debian.org Received: via spool by 102437-submit@bugs.debian.org id=B102437.99364220128474 (code B ref 102437); Wed, 27 Jun 2001 11:48:09 GMT MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit From: Roland McGrath To: Marcus Brinkmann , 102437@bugs.debian.org In-Reply-To: Marcus Brinkmann's message of Wed, 27 June 2001 12:35:25 +0200 <20010627123525.B414@212.23.136.22> X-Antipastobozoticataclysm: Bariumenemanilow Message-Id: <20010627114257.7A60999306@perdition.linnaean.org> Date: Wed, 27 Jun 2001 07:42:57 -0400 (EDT) Sender: roland@frob.com Delivered-To: 102437@bugs.debian.org You need to look at each individual server function and see what is the right thing for it. There is no generic answer (some things are copying data they hold elsewhere, some should dealloc). Note there is also `dealloc[]' to give an argument the server can fill in.   Acknowledgement sent to Roland McGrath <roland@gnu.org>:
Extra info received and forwarded to list. Copy sent to GNU Hurd Maintainers <bug-hurd@gnu.org>.   -t  From: owner@bugs.debian.org (Debian Bug Tracking System) To: Roland McGrath Subject: Bug#102437: Info received (was Bug#102437: dealloc missing on out parameters (was: Re: Bug#102437: proc leaks memory with the bootstrap filesystem entry) Message-ID: In-Reply-To: <20010627114257.7A60999306@perdition.linnaean.org> References: <20010627114257.7A60999306@perdition.linnaean.org> X-Debian-PR-Message: ack-info-maintonly 102437 Thank you for the additional information you have supplied regarding this problem report. It has been forwarded to the developer(s) and to the developers mailing list to accompany the original report. Your message has been sent to the package maintainer(s): GNU Hurd Maintainers If you wish to continue to submit further information on your problem, please send it to 102437@bugs.debian.org, as before. Please do not reply to the address at the top of this message, unless you wish to report a problem with the Bug-tracking system. Darren Benham (administrator, Debian Bugs database)   Received: (at 102437) by bugs.debian.org; 27 Jun 2001 11:43:21 +0000 From roland@frob.com Wed Jun 27 06:43:21 2001 Return-path: Received: from hefeweizen.cv.linnaean.org (hefeweizen.linnaean.org) [::ffff:209.58.179.123] by master.debian.org with esmtp (Exim 3.12 1 (Debian)) id 15FDj6-0007P6-00; Wed, 27 Jun 2001 06:43:20 -0500 Received: from perdition.linnaean.org (perdition.linnaean.org [198.49.250.12]) by hefeweizen.linnaean.org (8.9.3/8.9.3/AI2.13/linnaean.master:2.6) with ESMTP id HAA19322; Wed, 27 Jun 2001 07:42:58 -0400 (EDT) Received: by perdition.linnaean.org (Postfix, from userid 5281) id 7A60999306; Wed, 27 Jun 2001 07:42:57 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit From: Roland McGrath To: Marcus Brinkmann , 102437@bugs.debian.org Subject: Re: Bug#102437: dealloc missing on out parameters (was: Re: Bug#102437: proc leaks memory with the bootstrap filesystem entry In-Reply-To: Marcus Brinkmann's message of Wed, 27 June 2001 12:35:25 +0200 <20010627123525.B414@212.23.136.22> X-Antipastobozoticataclysm: Bariumenemanilow Message-Id: <20010627114257.7A60999306@perdition.linnaean.org> Date: Wed, 27 Jun 2001 07:42:57 -0400 (EDT) Sender: roland@frob.com Delivered-To: 102437@bugs.debian.org You need to look at each individual server function and see what is the right thing for it. There is no generic answer (some things are copying data they hold elsewhere, some should dealloc). Note there is also `dealloc[]' to give an argument the server can fill in.   Information forwarded to debian-bugs-dist@lists.debian.org, GNU Hurd Maintainers <bug-hurd@gnu.org>:
Bug#102437; Package hurd.   debian-bugs-dist@lists.debian.orgGNU Hurd Maintainers  Subject: Bug#102437: dealloc analysis for each server function, more bugs! Reply-To: Marcus Brinkmann , 102437@bugs.debian.org Resent-From: Marcus Brinkmann Orignal-Sender: Marcus Brinkmann Resent-To: debian-bugs-dist@lists.debian.org Resent-CC: GNU Hurd Maintainers Resent-Date: Wed, 27 Jun 2001 14:12:06 GMT Resent-Message-ID: Resent-Sender: owner@bugs.debian.org X-Debian-PR-Message: report 102437 X-Debian-PR-Package: hurd X-Debian-PR-Keywords: X-Loop: owner@bugs.debian.org Received: via spool by 102437-submit@bugs.debian.org id=B102437.9936463514355 (code B ref 102437); Wed, 27 Jun 2001 14:12:06 GMT Date: Wed, 27 Jun 2001 14:52:17 +0200 From: Marcus Brinkmann To: 102437@bugs.debian.org Message-ID: <20010627145217.B824@212.23.136.22> References: <20010627035903.A3552@212.23.136.22> <20010627123525.B414@212.23.136.22> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010627123525.B414@212.23.136.22> User-Agent: Mutt/1.3.18i Sender: Marcus Brinkmann Delivered-To: 102437@bugs.debian.org Hi, ok, here a detailed analysis. It seems I found four other bugs along the way. ;) On Wed, Jun 27, 2001 at 12:35:25PM +0200, Marcus Brinkmann wrote: > routine proc_getprocinfo ( > process: process_t; > which: pid_t; > inout flags: int; > - out procinfo: procinfo_t; > + out procinfo: procinfo_t, dealloc; > out threadwaits: data_t, dealloc); proc_getprocinfo uses mmap if the buffer is not big enough, and copies the out data into it. This one definitely needs a dealloc. > routine file_get_storage_info ( > file: file_t; > RPT > - out ports: portarray_t; > - out ints: intarray_t; > - out offsets: off_array_t; > - out data: data_t); > + out ports: portarray_t, dealloc; > + out ints: intarray_t, dealloc; > + out offsets: off_array_t, dealloc; > + out data: data_t, dealloc); store_encode (used by ext2fs, ufs mmaps new buffers if the provided ones are not big enough. Other callers I checked (default in libnetfs) also do this. So, all these should get dealloc, too. BTW, the comment in libstore enc.c seems to be wrong: /* Copy out the parameters from ENC into the given variables suitably for returning from a file_get_storage_info rpc, and deallocate ENC. */ void store_enc_return (struct store_enc *enc, ENC is not allocated, and it is not deallocated either. > routine file_get_fs_options ( > file: file_t; > RPT > - out options: data_t); > + out options: data_t, dealloc); This one uses iohelp_return_malloced_buffer in libdiskfs/libnetfs/libtrivfs, which mmaps a new buffer if the provided one is not big enough and copies the string. So, dealloc! > routine fsys_get_options ( > server: fsys_t; > RPT > - out options: data_t); > + out options: data_t, dealloc); See file_get_fs_options, the code is very similar. > routine auth_getids ( > handle: auth_t; > - out euids: idarray_t; > - out auids: idarray_t; > - out egids: idarray_t; > - out agids: idarray_t); > + out euids: idarray_t, dealloc; > + out auids: idarray_t, dealloc; > + out egids: idarray_t, dealloc; > + out agids: idarray_t, dealloc); This one is questionable. auth_getids uses idvec_copyout, which provides the internal buffer: inline void idvec_copyout (struct idvec *idvec, uid_t **ids, uid_t *nids) { if (idvec->num > *nids) *ids = idvec->ids; else memcpy (*ids, idvec->ids, idvec->num * sizeof *ids); *nids = idvec->num; } So, this should not use dealloc. However, idvec->ids is NOT a mmap'ed buffer! It is a malloced/realloced buffer (coming from libshouldbeinlibc/idvec.c). Also, the code should not use sizeof *ids, but sizeof (uid_t) = sizeof **ids for the calculation! Is it correct that this should better use iohelp_return_malloced_buffer and dealloc or mmap in idvec.h for the performance? > routine auth_server_authenticate ( > handle: auth_t; > sreplyport reply: mach_port_poly_t; > rendezvous: mach_port_send_t; > newport: mach_port_poly_t; > - out euids: idarray_t; > - out auids: idarray_t; > - out egids: idarray_t; > - out agids: idarray_t); > + out euids: idarray_t, dealloc; > + out auids: idarray_t, dealloc; > + out egids: idarray_t, dealloc; > + out agids: idarray_t, dealloc); Again, I am not sure. The server routine has: /* Extract the ids. We must use a separate reply stub so we can deref the user auth handle after the reply uses its contents. */ auth_server_authenticate_reply (reply, reply_type, 0, user->euids.ids, user->euids.num, user->auids.ids, user->auids.num, user->egids.ids, user->egids.num, user->agids.ids, user->agids.num); ports_port_deref (user); Because those arrays are not marked as dealloc, the pointer is copied by the reply stub. Again, we are returning malloc'ed buffers. But this time we are returning buffers without keeping a reference to them! The comment is actually useless, as the buffers are not copied. Am I incorrect, or is this a blatant error? It seems that using return-buffer and dealloc is the only chance, if we don't want to giver the server a reference to the user. Thanks, Marcus -- `Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org Marcus.Brinkmann@ruhr-uni-bochum.de http://www.marcus-brinkmann.de   Acknowledgement sent to Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>:
Extra info received and forwarded to list. Copy sent to GNU Hurd Maintainers <bug-hurd@gnu.org>.   -t  From: owner@bugs.debian.org (Debian Bug Tracking System) To: Marcus Brinkmann Subject: Bug#102437: Info received (was Bug#102437: dealloc analysis for each server function, more bugs!) Message-ID: In-Reply-To: <20010627145217.B824@212.23.136.22> References: <20010627145217.B824@212.23.136.22> X-Debian-PR-Message: ack-info-maintonly 102437 Thank you for the additional information you have supplied regarding this problem report. It has been forwarded to the developer(s) and to the developers mailing list to accompany the original report. Your message has been sent to the package maintainer(s): GNU Hurd Maintainers If you wish to continue to submit further information on your problem, please send it to 102437@bugs.debian.org, as before. Please do not reply to the address at the top of this message, unless you wish to report a problem with the Bug-tracking system. Darren Benham (administrator, Debian Bugs database)   Received: (at 102437) by bugs.debian.org; 27 Jun 2001 12:52:31 +0000 From Marcus.Brinkmann@ruhr-uni-bochum.de Wed Jun 27 07:52:30 2001 Return-path: Received: from (localhost) [::ffff:212.23.136.22] by master.debian.org with esmtp (Exim 3.12 1 (Debian)) id 15FEo2-00017r-00; Wed, 27 Jun 2001 07:52:30 -0500 Received: from marcus by localhost with local (Exim 3.22 #1 (Debian)) id 15FEnp-0000iE-00 for <102437@bugs.debian.org>; Wed, 27 Jun 2001 14:52:17 +0200 Date: Wed, 27 Jun 2001 14:52:17 +0200 From: Marcus Brinkmann To: 102437@bugs.debian.org Subject: Re: Bug#102437: dealloc analysis for each server function, more bugs! Message-ID: <20010627145217.B824@212.23.136.22> References: <20010627035903.A3552@212.23.136.22> <20010627123525.B414@212.23.136.22> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010627123525.B414@212.23.136.22> User-Agent: Mutt/1.3.18i Sender: Marcus Brinkmann Delivered-To: 102437@bugs.debian.org Hi, ok, here a detailed analysis. It seems I found four other bugs along the way. ;) On Wed, Jun 27, 2001 at 12:35:25PM +0200, Marcus Brinkmann wrote: > routine proc_getprocinfo ( > process: process_t; > which: pid_t; > inout flags: int; > - out procinfo: procinfo_t; > + out procinfo: procinfo_t, dealloc; > out threadwaits: data_t, dealloc); proc_getprocinfo uses mmap if the buffer is not big enough, and copies the out data into it. This one definitely needs a dealloc. > routine file_get_storage_info ( > file: file_t; > RPT > - out ports: portarray_t; > - out ints: intarray_t; > - out offsets: off_array_t; > - out data: data_t); > + out ports: portarray_t, dealloc; > + out ints: intarray_t, dealloc; > + out offsets: off_array_t, dealloc; > + out data: data_t, dealloc); store_encode (used by ext2fs, ufs mmaps new buffers if the provided ones are not big enough. Other callers I checked (default in libnetfs) also do this. So, all these should get dealloc, too. BTW, the comment in libstore enc.c seems to be wrong: /* Copy out the parameters from ENC into the given variables suitably for returning from a file_get_storage_info rpc, and deallocate ENC. */ void store_enc_return (struct store_enc *enc, ENC is not allocated, and it is not deallocated either. > routine file_get_fs_options ( > file: file_t; > RPT > - out options: data_t); > + out options: data_t, dealloc); This one uses iohelp_return_malloced_buffer in libdiskfs/libnetfs/libtrivfs, which mmaps a new buffer if the provided one is not big enough and copies the string. So, dealloc! > routine fsys_get_options ( > server: fsys_t; > RPT > - out options: data_t); > + out options: data_t, dealloc); See file_get_fs_options, the code is very similar. > routine auth_getids ( > handle: auth_t; > - out euids: idarray_t; > - out auids: idarray_t; > - out egids: idarray_t; > - out agids: idarray_t); > + out euids: idarray_t, dealloc; > + out auids: idarray_t, dealloc; > + out egids: idarray_t, dealloc; > + out agids: idarray_t, dealloc); This one is questionable. auth_getids uses idvec_copyout, which provides the internal buffer: inline void idvec_copyout (struct idvec *idvec, uid_t **ids, uid_t *nids) { if (idvec->num > *nids) *ids = idvec->ids; else memcpy (*ids, idvec->ids, idvec->num * sizeof *ids); *nids = idvec->num; } So, this should not use dealloc. However, idvec->ids is NOT a mmap'ed buffer! It is a malloced/realloced buffer (coming from libshouldbeinlibc/idvec.c). Also, the code should not use sizeof *ids, but sizeof (uid_t) = sizeof **ids for the calculation! Is it correct that this should better use iohelp_return_malloced_buffer and dealloc or mmap in idvec.h for the performance? > routine auth_server_authenticate ( > handle: auth_t; > sreplyport reply: mach_port_poly_t; > rendezvous: mach_port_send_t; > newport: mach_port_poly_t; > - out euids: idarray_t; > - out auids: idarray_t; > - out egids: idarray_t; > - out agids: idarray_t); > + out euids: idarray_t, dealloc; > + out auids: idarray_t, dealloc; > + out egids: idarray_t, dealloc; > + out agids: idarray_t, dealloc); Again, I am not sure. The server routine has: /* Extract the ids. We must use a separate reply stub so we can deref the user auth handle after the reply uses its contents. */ auth_server_authenticate_reply (reply, reply_type, 0, user->euids.ids, user->euids.num, user->auids.ids, user->auids.num, user->egids.ids, user->egids.num, user->agids.ids, user->agids.num); ports_port_deref (user); Because those arrays are not marked as dealloc, the pointer is copied by the reply stub. Again, we are returning malloc'ed buffers. But this time we are returning buffers without keeping a reference to them! The comment is actually useless, as the buffers are not copied. Am I incorrect, or is this a blatant error? It seems that using return-buffer and dealloc is the only chance, if we don't want to giver the server a reference to the user. Thanks, Marcus -- `Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org Marcus.Brinkmann@ruhr-uni-bochum.de http://www.marcus-brinkmann.de   Information forwarded to debian-bugs-dist@lists.debian.org, GNU Hurd Maintainers <bug-hurd@gnu.org>:
Bug#102437; Package hurd.   debian-bugs-dist@lists.debian.orgGNU Hurd Maintainers  Subject: Bug#102437: dealloc analysis for each server function, more bugs! Reply-To: Marcus Brinkmann , 102437@bugs.debian.org Resent-From: Marcus Brinkmann Orignal-Sender: Marcus Brinkmann Resent-To: debian-bugs-dist@lists.debian.org Resent-CC: GNU Hurd Maintainers Resent-Date: Wed, 27 Jun 2001 14:12:18 GMT Resent-Message-ID: Resent-Sender: owner@bugs.debian.org X-Debian-PR-Message: report 102437 X-Debian-PR-Package: hurd X-Debian-PR-Keywords: X-Loop: owner@bugs.debian.org Received: via spool by 102437-submit@bugs.debian.org id=B102437.9936470645765 (code B ref 102437); Wed, 27 Jun 2001 14:12:18 GMT Date: Wed, 27 Jun 2001 15:04:20 +0200 From: Marcus Brinkmann To: 102437@bugs.debian.org Message-ID: <20010627150420.C824@212.23.136.22> References: <20010627035903.A3552@212.23.136.22> <20010627123525.B414@212.23.136.22> <20010627145217.B824@212.23.136.22> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010627145217.B824@212.23.136.22> User-Agent: Mutt/1.3.18i Sender: Marcus Brinkmann Delivered-To: 102437@bugs.debian.org On Wed, Jun 27, 2001 at 02:52:17PM +0200, Marcus Brinkmann wrote: > So, this should not use dealloc. However, idvec->ids is NOT a mmap'ed > buffer! It is a malloced/realloced buffer (coming from > libshouldbeinlibc/idvec.c). > > Is it correct that this should better use iohelp_return_malloced_buffer > and dealloc or mmap in idvec.h for the performance? It just occured to me that it is probably safe to use malloc()'ed buffers, as long as you don't use dealloc with them? It's a bit awkward, because this is mixing Mach level with glibc level stuff. I don't know if it is safe to return a buffer that is not starting at a mmap'ed region, for example. Thanks, Marcus -- `Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org Marcus.Brinkmann@ruhr-uni-bochum.de http://www.marcus-brinkmann.de   Acknowledgement sent to Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>:
Extra info received and forwarded to list. Copy sent to GNU Hurd Maintainers <bug-hurd@gnu.org>.   -t  From: owner@bugs.debian.org (Debian Bug Tracking System) To: Marcus Brinkmann Subject: Bug#102437: Info received (was Bug#102437: dealloc analysis for each server function, more bugs!) Message-ID: In-Reply-To: <20010627150420.C824@212.23.136.22> References: <20010627150420.C824@212.23.136.22> X-Debian-PR-Message: ack-info-maintonly 102437 Thank you for the additional information you have supplied regarding this problem report. It has been forwarded to the developer(s) and to the developers mailing list to accompany the original report. Your message has been sent to the package maintainer(s): GNU Hurd Maintainers If you wish to continue to submit further information on your problem, please send it to 102437@bugs.debian.org, as before. Please do not reply to the address at the top of this message, unless you wish to report a problem with the Bug-tracking system. Darren Benham (administrator, Debian Bugs database)   Received: (at 102437) by bugs.debian.org; 27 Jun 2001 13:04:24 +0000 From Marcus.Brinkmann@ruhr-uni-bochum.de Wed Jun 27 08:04:24 2001 Return-path: Received: from (localhost) [::ffff:212.23.136.22] by master.debian.org with esmtp (Exim 3.12 1 (Debian)) id 15FEzY-0001Uw-00; Wed, 27 Jun 2001 08:04:24 -0500 Received: from marcus by localhost with local (Exim 3.22 #1 (Debian)) id 15FEzU-0000jv-00 for <102437@bugs.debian.org>; Wed, 27 Jun 2001 15:04:20 +0200 Date: Wed, 27 Jun 2001 15:04:20 +0200 From: Marcus Brinkmann To: 102437@bugs.debian.org Subject: Re: Bug#102437: dealloc analysis for each server function, more bugs! Message-ID: <20010627150420.C824@212.23.136.22> References: <20010627035903.A3552@212.23.136.22> <20010627123525.B414@212.23.136.22> <20010627145217.B824@212.23.136.22> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010627145217.B824@212.23.136.22> User-Agent: Mutt/1.3.18i Sender: Marcus Brinkmann Delivered-To: 102437@bugs.debian.org On Wed, Jun 27, 2001 at 02:52:17PM +0200, Marcus Brinkmann wrote: > So, this should not use dealloc. However, idvec->ids is NOT a mmap'ed > buffer! It is a malloced/realloced buffer (coming from > libshouldbeinlibc/idvec.c). > > Is it correct that this should better use iohelp_return_malloced_buffer > and dealloc or mmap in idvec.h for the performance? It just occured to me that it is probably safe to use malloc()'ed buffers, as long as you don't use dealloc with them? It's a bit awkward, because this is mixing Mach level with glibc level stuff. I don't know if it is safe to return a buffer that is not starting at a mmap'ed region, for example. Thanks, Marcus -- `Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org Marcus.Brinkmann@ruhr-uni-bochum.de http://www.marcus-brinkmann.de   Information forwarded to debian-bugs-dist@lists.debian.org, GNU Hurd Maintainers <bug-hurd@gnu.org>:
Bug#102437; Package hurd.   debian-bugs-dist@lists.debian.orgGNU Hurd Maintainers  Subject: Bug#102437: dealloc analysis for each server function, more bugs! Reply-To: tb@becket.net (Thomas Bushnell, BSG), 102437@bugs.debian.org Resent-From: tb@becket.net (Thomas Bushnell, BSG) Resent-To: debian-bugs-dist@lists.debian.org Resent-CC: GNU Hurd Maintainers Resent-Date: Fri, 29 Jun 2001 18:12:11 GMT Resent-Message-ID: Resent-Sender: owner@bugs.debian.org X-Debian-PR-Message: report 102437 X-Debian-PR-Package: hurd X-Debian-PR-Keywords: X-Loop: owner@bugs.debian.org Received: via spool by 102437-submit@bugs.debian.org id=B102437.9938382529204 (code B ref 102437); Fri, 29 Jun 2001 18:12:11 GMT To: Marcus Brinkmann Cc: 102437@bugs.debian.org References: <20010627035903.A3552@212.23.136.22> <20010627123525.B414@212.23.136.22> <20010627145217.B824@212.23.136.22> <20010627150420.C824@212.23.136.22> X-Reply-Permission: Posted or emailed replies to this message constitute permission for an emailed response. X-PGP-Fingerprint: 1F0A1E51 63 28 EB DA E6 44 E5 5E EC F3 04 26 4E BF 1A 92 X-Windows: Complex nonsolutions to simple nonproblems. From: tb@becket.net (Thomas Bushnell, BSG) Date: 29 Jun 2001 11:10:46 -0700 In-Reply-To: <20010627150420.C824@212.23.136.22> Message-ID: <87ofr75f89.fsf@becket.becket.net> Lines: 16 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Delivered-To: 102437@bugs.debian.org Marcus Brinkmann writes: > It just occured to me that it is probably safe to use malloc()'ed buffers, > as long as you don't use dealloc with them? It's a bit awkward, because > this is mixing Mach level with glibc level stuff. I don't know if it is > safe to return a buffer that is not starting at a mmap'ed region, for > example. In general it's bad mojo. If the buffer is not page aligned, then Mach will DTRT, but data in the boundary pages outside the region might be sent in the RPC too, and the result would be a security failure. Also, we don't want to depend on that behavior of Mach; other kernels with other RPC systems might only allow sending page-aligned regions.   Acknowledgement sent to tb@becket.net (Thomas Bushnell, BSG):
Extra info received and forwarded to list. Copy sent to GNU Hurd Maintainers <bug-hurd@gnu.org>.   -t  From: owner@bugs.debian.org (Debian Bug Tracking System) To: tb@becket.net (Thomas Bushnell, BSG) Subject: Bug#102437: Info received (was Bug#102437: dealloc analysis for each server function, more bugs!) Message-ID: In-Reply-To: <87ofr75f89.fsf@becket.becket.net> References: <87ofr75f89.fsf@becket.becket.net> X-Debian-PR-Message: ack-info-maintonly 102437 Thank you for the additional information you have supplied regarding this problem report. It has been forwarded to the developer(s) and to the developers mailing list to accompany the original report. Your message has been sent to the package maintainer(s): GNU Hurd Maintainers If you wish to continue to submit further information on your problem, please send it to 102437@bugs.debian.org, as before. Please do not reply to the address at the top of this message, unless you wish to report a problem with the Bug-tracking system. Darren Benham (administrator, Debian Bugs database)   Received: (at 102437) by bugs.debian.org; 29 Jun 2001 18:10:52 +0000 From tb@becket.net Fri Jun 29 13:10:51 2001 Return-path: Received: from vp190174.reshsg.uci.edu (becket.becket.net) [::ffff:128.195.190.174] by master.debian.org with esmtp (Exim 3.12 1 (Debian)) id 15G2jD-0002OM-00; Fri, 29 Jun 2001 13:10:51 -0500 Received: from tb by becket.becket.net with local (Exim 3.22 #1 (Debian)) id 15G2j8-0000Jd-00; Fri, 29 Jun 2001 11:10:46 -0700 To: Marcus Brinkmann Cc: 102437@bugs.debian.org Subject: Re: Bug#102437: dealloc analysis for each server function, more bugs! References: <20010627035903.A3552@212.23.136.22> <20010627123525.B414@212.23.136.22> <20010627145217.B824@212.23.136.22> <20010627150420.C824@212.23.136.22> X-Reply-Permission: Posted or emailed replies to this message constitute permission for an emailed response. X-PGP-Fingerprint: 1F0A1E51 63 28 EB DA E6 44 E5 5E EC F3 04 26 4E BF 1A 92 X-Windows: Complex nonsolutions to simple nonproblems. From: tb@becket.net (Thomas Bushnell, BSG) Date: 29 Jun 2001 11:10:46 -0700 In-Reply-To: <20010627150420.C824@212.23.136.22> Message-ID: <87ofr75f89.fsf@becket.becket.net> Lines: 16 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Delivered-To: 102437@bugs.debian.org Marcus Brinkmann writes: > It just occured to me that it is probably safe to use malloc()'ed buffers, > as long as you don't use dealloc with them? It's a bit awkward, because > this is mixing Mach level with glibc level stuff. I don't know if it is > safe to return a buffer that is not starting at a mmap'ed region, for > example. In general it's bad mojo. If the buffer is not page aligned, then Mach will DTRT, but data in the boundary pages outside the region might be sent in the RPC too, and the result would be a security failure. Also, we don't want to depend on that behavior of Mach; other kernels with other RPC systems might only allow sending page-aligned regions.   Information forwarded to debian-bugs-dist@lists.debian.org, GNU Hurd Maintainers <bug-hurd@gnu.org>:
Bug#102437; Package hurd.   debian-bugs-dist@lists.debian.orgGNU Hurd Maintainers  Subject: Bug#102437: dealloc analysis for each server function, more bugs! Reply-To: Marcus Brinkmann , 102437@bugs.debian.org Resent-From: Marcus Brinkmann Orignal-Sender: Marcus Brinkmann Resent-To: debian-bugs-dist@lists.debian.org Resent-CC: GNU Hurd Maintainers Resent-Date: Sat, 30 Jun 2001 19:18:47 GMT Resent-Message-ID: Resent-Sender: owner@bugs.debian.org X-Debian-PR-Message: report 102437 X-Debian-PR-Package: hurd X-Debian-PR-Keywords: X-Loop: owner@bugs.debian.org Received: via spool by 102437-submit@bugs.debian.org id=B102437.9939285956611 (code B ref 102437); Sat, 30 Jun 2001 19:18:47 GMT Date: Sat, 30 Jun 2001 21:16:17 +0200 From: Marcus Brinkmann To: 102437@bugs.debian.org Message-ID: <20010630211616.A665@212.23.136.22> References: <20010627035903.A3552@212.23.136.22> <20010627123525.B414@212.23.136.22> <20010627145217.B824@212.23.136.22> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010627145217.B824@212.23.136.22> User-Agent: Mutt/1.3.18i Sender: Marcus Brinkmann Delivered-To: 102437@bugs.debian.org On Wed, Jun 27, 2001 at 02:52:17PM +0200, Marcus Brinkmann wrote: [auth_getids] > This one is questionable. auth_getids uses idvec_copyout, which provides > the internal buffer: > > inline void idvec_copyout (struct idvec *idvec, uid_t **ids, uid_t *nids) > { > if (idvec->num > *nids) > *ids = idvec->ids; > else > memcpy (*ids, idvec->ids, idvec->num * sizeof *ids); > *nids = idvec->num; > } > > So, this should not use dealloc. However, idvec->ids is NOT a mmap'ed > buffer! It is a malloced/realloced buffer (coming from > libshouldbeinlibc/idvec.c). Also, the code should not use > sizeof *ids, but sizeof (uid_t) = sizeof **ids for the calculation! > > Is it correct that this should better use iohelp_return_malloced_buffer > and dealloc or mmap in idvec.h for the performance? I would suggest dealloc + iohelp_return_malloced_buffer, as usually those uid vectors are small, and keeping them on one page each is a waste of space. > > routine auth_server_authenticate ( [...] > Again, I am not sure. The server routine has: > > /* Extract the ids. We must use a separate reply stub so > we can deref the user auth handle after the reply uses its > contents. */ > auth_server_authenticate_reply (reply, reply_type, 0, > user->euids.ids, user->euids.num, > user->auids.ids, user->auids.num, > user->egids.ids, user->egids.num, > user->agids.ids, user->agids.num); > ports_port_deref (user); > > Because those arrays are not marked as dealloc, the pointer is copied by > the reply stub. Again, we are returning malloc'ed buffers. But this time > we are returning buffers without keeping a reference to them! The comment > is actually useless, as the buffers are not copied. Am I incorrect, or is > this a blatant error? I was incorrect, I think. Small uid vectors are copied in the message inlined, while out-of-band memory is logically copied. Although the physical page is shared, it will not be removed unless the server and client both called vm_deallocate on it (if I understood this correctly). > It seems that using return-buffer and dealloc is the only chance, if we > don't want to giver the server a reference to the user. Not in this case. But again, because we use malloc for the uids, I'd suggest to use return-buffer and dealloc anyway. I will make an appropriate patch and post it here. Thanks, Marcus -- `Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org Marcus.Brinkmann@ruhr-uni-bochum.de http://www.marcus-brinkmann.de   Acknowledgement sent to Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>:
Extra info received and forwarded to list. Copy sent to GNU Hurd Maintainers <bug-hurd@gnu.org>.   -t  From: owner@bugs.debian.org (Debian Bug Tracking System) To: Marcus Brinkmann Subject: Bug#102437: Info received (was Bug#102437: dealloc analysis for each server function, more bugs!) Message-ID: In-Reply-To: <20010630211616.A665@212.23.136.22> References: <20010630211616.A665@212.23.136.22> X-Debian-PR-Message: ack-info-maintonly 102437 Thank you for the additional information you have supplied regarding this problem report. It has been forwarded to the developer(s) and to the developers mailing list to accompany the original report. Your message has been sent to the package maintainer(s): GNU Hurd Maintainers If you wish to continue to submit further information on your problem, please send it to 102437@bugs.debian.org, as before. Please do not reply to the address at the top of this message, unless you wish to report a problem with the Bug-tracking system. Darren Benham (administrator, Debian Bugs database)   Received: (at 102437) by bugs.debian.org; 30 Jun 2001 19:16:35 +0000 From Marcus.Brinkmann@ruhr-uni-bochum.de Sat Jun 30 14:16:35 2001 Return-path: Received: from (localhost) [::ffff:212.23.136.22] by master.debian.org with esmtp (Exim 3.12 1 (Debian)) id 15GQEM-0001ia-00; Sat, 30 Jun 2001 14:16:35 -0500 Received: from marcus by localhost with local (Exim 3.22 #1 (Debian)) id 15GQEA-0000IB-00 for <102437@bugs.debian.org>; Sat, 30 Jun 2001 21:16:22 +0200 Date: Sat, 30 Jun 2001 21:16:17 +0200 From: Marcus Brinkmann To: 102437@bugs.debian.org Subject: Re: Bug#102437: dealloc analysis for each server function, more bugs! Message-ID: <20010630211616.A665@212.23.136.22> References: <20010627035903.A3552@212.23.136.22> <20010627123525.B414@212.23.136.22> <20010627145217.B824@212.23.136.22> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010627145217.B824@212.23.136.22> User-Agent: Mutt/1.3.18i Sender: Marcus Brinkmann Delivered-To: 102437@bugs.debian.org On Wed, Jun 27, 2001 at 02:52:17PM +0200, Marcus Brinkmann wrote: [auth_getids] > This one is questionable. auth_getids uses idvec_copyout, which provides > the internal buffer: > > inline void idvec_copyout (struct idvec *idvec, uid_t **ids, uid_t *nids) > { > if (idvec->num > *nids) > *ids = idvec->ids; > else > memcpy (*ids, idvec->ids, idvec->num * sizeof *ids); > *nids = idvec->num; > } > > So, this should not use dealloc. However, idvec->ids is NOT a mmap'ed > buffer! It is a malloced/realloced buffer (coming from > libshouldbeinlibc/idvec.c). Also, the code should not use > sizeof *ids, but sizeof (uid_t) = sizeof **ids for the calculation! > > Is it correct that this should better use iohelp_return_malloced_buffer > and dealloc or mmap in idvec.h for the performance? I would suggest dealloc + iohelp_return_malloced_buffer, as usually those uid vectors are small, and keeping them on one page each is a waste of space. > > routine auth_server_authenticate ( [...] > Again, I am not sure. The server routine has: > > /* Extract the ids. We must use a separate reply stub so > we can deref the user auth handle after the reply uses its > contents. */ > auth_server_authenticate_reply (reply, reply_type, 0, > user->euids.ids, user->euids.num, > user->auids.ids, user->auids.num, > user->egids.ids, user->egids.num, > user->agids.ids, user->agids.num); > ports_port_deref (user); > > Because those arrays are not marked as dealloc, the pointer is copied by > the reply stub. Again, we are returning malloc'ed buffers. But this time > we are returning buffers without keeping a reference to them! The comment > is actually useless, as the buffers are not copied. Am I incorrect, or is > this a blatant error? I was incorrect, I think. Small uid vectors are copied in the message inlined, while out-of-band memory is logically copied. Although the physical page is shared, it will not be removed unless the server and client both called vm_deallocate on it (if I understood this correctly). > It seems that using return-buffer and dealloc is the only chance, if we > don't want to giver the server a reference to the user. Not in this case. But again, because we use malloc for the uids, I'd suggest to use return-buffer and dealloc anyway. I will make an appropriate patch and post it here. Thanks, Marcus -- `Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org Marcus.Brinkmann@ruhr-uni-bochum.de http://www.marcus-brinkmann.de   Information forwarded to debian-bugs-dist@lists.debian.org, GNU Hurd Maintainers <bug-hurd@gnu.org>:
Bug#102437; Package hurd.   debian-bugs-dist@lists.debian.orgGNU Hurd Maintainers  Subject: Bug#102437: dealloc analysis for each server function, more bugs! Reply-To: tb@becket.net (Thomas Bushnell, BSG), 102437@bugs.debian.org Resent-From: tb@becket.net (Thomas Bushnell, BSG) Resent-To: debian-bugs-dist@lists.debian.org Resent-CC: GNU Hurd Maintainers Resent-Date: Sun, 01 Jul 2001 04:03:14 GMT Resent-Message-ID: Resent-Sender: owner@bugs.debian.org X-Debian-PR-Message: report 102437 X-Debian-PR-Package: hurd X-Debian-PR-Keywords: X-Loop: owner@bugs.debian.org Received: via spool by 102437-submit@bugs.debian.org id=B102437.99395965419267 (code B ref 102437); Sun, 01 Jul 2001 04:03:14 GMT To: Marcus Brinkmann Cc: 102437@bugs.debian.org References: <20010627035903.A3552@212.23.136.22> <20010627123525.B414@212.23.136.22> <20010627145217.B824@212.23.136.22> <20010630211616.A665@212.23.136.22> X-Reply-Permission: Posted or emailed replies to this message constitute permission for an emailed response. X-PGP-Fingerprint: 1F0A1E51 63 28 EB DA E6 44 E5 5E EC F3 04 26 4E BF 1A 92 X-Zippy-Says: INSIDE, I have the same personality disorder as LUCY RICARDO!! From: tb@becket.net (Thomas Bushnell, BSG) Date: 30 Jun 2001 20:54:12 -0700 In-Reply-To: <20010630211616.A665@212.23.136.22> Message-ID: <87g0chjod7.fsf@becket.becket.net> Lines: 11 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Delivered-To: 102437@bugs.debian.org Marcus Brinkmann writes: > I would suggest dealloc + iohelp_return_malloced_buffer, as usually those > uid vectors are small, and keeping them on one page each is a waste of > space. iohelp_return_malloced_buffer is not available in auth, nor should it be.... just duplicated its functionality perhaps. it's not that complex. I haven't reviewed your logic tho; I'll think about that later.   Acknowledgement sent to tb@becket.net (Thomas Bushnell, BSG):
Extra info received and forwarded to list. Copy sent to GNU Hurd Maintainers <bug-hurd@gnu.org>.   -t  From: owner@bugs.debian.org (Debian Bug Tracking System) To: tb@becket.net (Thomas Bushnell, BSG) Subject: Bug#102437: Info received (was Bug#102437: dealloc analysis for each server function, more bugs!) Message-ID: In-Reply-To: <87g0chjod7.fsf@becket.becket.net> References: <87g0chjod7.fsf@becket.becket.net> X-Debian-PR-Message: ack-info-maintonly 102437 Thank you for the additional information you have supplied regarding this problem report. It has been forwarded to the developer(s) and to the developers mailing list to accompany the original report. Your message has been sent to the package maintainer(s): GNU Hurd Maintainers If you wish to continue to submit further information on your problem, please send it to 102437@bugs.debian.org, as before. Please do not reply to the address at the top of this message, unless you wish to report a problem with the Bug-tracking system. Darren Benham (administrator, Debian Bugs database)   Received: (at 102437) by bugs.debian.org; 1 Jul 2001 03:54:14 +0000 From tb@becket.net Sat Jun 30 22:54:14 2001 Return-path: Received: from vp190174.reshsg.uci.edu (becket.becket.net) [::ffff:128.195.190.174] by master.debian.org with esmtp (Exim 3.12 1 (Debian)) id 15GYJK-00050i-00; Sat, 30 Jun 2001 22:54:14 -0500 Received: from tb by becket.becket.net with local (Exim 3.22 #1 (Debian)) id 15GYJI-0001FD-00; Sat, 30 Jun 2001 20:54:12 -0700 To: Marcus Brinkmann Cc: 102437@bugs.debian.org Subject: Re: Bug#102437: dealloc analysis for each server function, more bugs! References: <20010627035903.A3552@212.23.136.22> <20010627123525.B414@212.23.136.22> <20010627145217.B824@212.23.136.22> <20010630211616.A665@212.23.136.22> X-Reply-Permission: Posted or emailed replies to this message constitute permission for an emailed response. X-PGP-Fingerprint: 1F0A1E51 63 28 EB DA E6 44 E5 5E EC F3 04 26 4E BF 1A 92 X-Zippy-Says: INSIDE, I have the same personality disorder as LUCY RICARDO!! From: tb@becket.net (Thomas Bushnell, BSG) Date: 30 Jun 2001 20:54:12 -0700 In-Reply-To: <20010630211616.A665@212.23.136.22> Message-ID: <87g0chjod7.fsf@becket.becket.net> Lines: 11 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Delivered-To: 102437@bugs.debian.org Marcus Brinkmann writes: > I would suggest dealloc + iohelp_return_malloced_buffer, as usually those > uid vectors are small, and keeping them on one page each is a waste of > space. iohelp_return_malloced_buffer is not available in auth, nor should it be.... just duplicated its functionality perhaps. it's not that complex. I haven't reviewed your logic tho; I'll think about that later.   Information forwarded to debian-bugs-dist@lists.debian.org, GNU Hurd Maintainers <bug-hurd@gnu.org>:
Bug#102437; Package hurd.   debian-bugs-dist@lists.debian.orgGNU Hurd Maintainers  Subject: Bug#102437: dealloc analysis for each server function, more bugs! Reply-To: Marcus Brinkmann , 102437@bugs.debian.org Resent-From: Marcus Brinkmann Orignal-Sender: Marcus Brinkmann Resent-To: debian-bugs-dist@lists.debian.org Resent-CC: GNU Hurd Maintainers Resent-Date: Tue, 10 Jul 2001 22:33:09 GMT Resent-Message-ID: Resent-Sender: owner@bugs.debian.org X-Debian-PR-Message: report 102437 X-Debian-PR-Package: hurd X-Debian-PR-Keywords: X-Loop: owner@bugs.debian.org Received: via spool by 102437-submit@bugs.debian.org id=B102437.9948036161643 (code B ref 102437); Tue, 10 Jul 2001 22:33:09 GMT Date: Wed, 11 Jul 2001 00:18:32 +0200 From: Marcus Brinkmann To: "Thomas Bushnell, BSG" , 102437@bugs.debian.org Message-ID: <20010711001832.A2585@212.23.136.22> References: <20010627035903.A3552@212.23.136.22> <20010627123525.B414@212.23.136.22> <20010627145217.B824@212.23.136.22> <20010630211616.A665@212.23.136.22> <87g0chjod7.fsf@becket.becket.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87g0chjod7.fsf@becket.becket.net> User-Agent: Mutt/1.3.18i Sender: Marcus Brinkmann Delivered-To: 102437@bugs.debian.org On Sat, Jun 30, 2001 at 08:54:12PM -0700, Thomas Bushnell, BSG wrote: > Marcus Brinkmann writes: > > > I would suggest dealloc + iohelp_return_malloced_buffer, as usually those > > uid vectors are small, and keeping them on one page each is a waste of > > space. > > iohelp_return_malloced_buffer is not available in auth, nor should it > be.... just duplicated its functionality perhaps. it's not that > complex. Right. We can't use it anyway, as it will free the buffer. Duplicating the functionality is the thing to do (we do it in a lot of places). > I haven't reviewed your logic tho; I'll think about that later. I committed my changes for the other interfaces, which just require the dealloc parameter. For the auth server, I will send a patch for review soon. Thanks, Marcus -- `Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org Marcus.Brinkmann@ruhr-uni-bochum.de http://www.marcus-brinkmann.de   Acknowledgement sent to Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>:
Extra info received and forwarded to list. Copy sent to GNU Hurd Maintainers <bug-hurd@gnu.org>.   -t  From: owner@bugs.debian.org (Debian Bug Tracking System) To: Marcus Brinkmann Subject: Bug#102437: Info received (was Bug#102437: dealloc analysis for each server function, more bugs!) Message-ID: In-Reply-To: <20010711001832.A2585@212.23.136.22> References: <20010711001832.A2585@212.23.136.22> X-Debian-PR-Message: ack-info-maintonly 102437 Thank you for the additional information you have supplied regarding this problem report. It has been forwarded to the developer(s) and to the developers mailing list to accompany the original report. Your message has been sent to the package maintainer(s): GNU Hurd Maintainers If you wish to continue to submit further information on your problem, please send it to 102437@bugs.debian.org, as before. Please do not reply to the address at the top of this message, unless you wish to report a problem with the Bug-tracking system. Darren Benham (administrator, Debian Bugs database)   Received: (at 102437) by bugs.debian.org; 10 Jul 2001 22:20:16 +0000 From Marcus.Brinkmann@ruhr-uni-bochum.de Tue Jul 10 17:20:16 2001 Return-path: Received: from (localhost) [::ffff:212.23.136.22] by master.debian.org with esmtp (Exim 3.12 1 (Debian)) id 15K5rb-0000QR-00; Tue, 10 Jul 2001 17:20:16 -0500 Received: from marcus by localhost with local (Exim 3.22 #1 (Debian)) id 15K5py-0001aC-00; Wed, 11 Jul 2001 00:18:34 +0200 Date: Wed, 11 Jul 2001 00:18:32 +0200 From: Marcus Brinkmann To: "Thomas Bushnell, BSG" , 102437@bugs.debian.org Subject: Re: Bug#102437: dealloc analysis for each server function, more bugs! Message-ID: <20010711001832.A2585@212.23.136.22> References: <20010627035903.A3552@212.23.136.22> <20010627123525.B414@212.23.136.22> <20010627145217.B824@212.23.136.22> <20010630211616.A665@212.23.136.22> <87g0chjod7.fsf@becket.becket.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87g0chjod7.fsf@becket.becket.net> User-Agent: Mutt/1.3.18i Sender: Marcus Brinkmann Delivered-To: 102437@bugs.debian.org On Sat, Jun 30, 2001 at 08:54:12PM -0700, Thomas Bushnell, BSG wrote: > Marcus Brinkmann writes: > > > I would suggest dealloc + iohelp_return_malloced_buffer, as usually those > > uid vectors are small, and keeping them on one page each is a waste of > > space. > > iohelp_return_malloced_buffer is not available in auth, nor should it > be.... just duplicated its functionality perhaps. it's not that > complex. Right. We can't use it anyway, as it will free the buffer. Duplicating the functionality is the thing to do (we do it in a lot of places). > I haven't reviewed your logic tho; I'll think about that later. I committed my changes for the other interfaces, which just require the dealloc parameter. For the auth server, I will send a patch for review soon. Thanks, Marcus -- `Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org Marcus.Brinkmann@ruhr-uni-bochum.de http://www.marcus-brinkmann.de   Information forwarded to debian-bugs-dist@lists.debian.org, GNU Hurd Maintainers <bug-hurd@gnu.org>:
Bug#102437; Package hurd.   debian-bugs-dist@lists.debian.orgGNU Hurd Maintainers  Subject: Bug#102437: dealloc analysis for each server function, more bugs! Reply-To: Marcus Brinkmann , 102437@bugs.debian.org Resent-From: Marcus Brinkmann Orignal-Sender: Marcus Brinkmann Resent-To: debian-bugs-dist@lists.debian.org Resent-CC: GNU Hurd Maintainers Resent-Date: Wed, 11 Jul 2001 19:33:02 GMT Resent-Message-ID: Resent-Sender: owner@bugs.debian.org X-Debian-PR-Message: report 102437 X-Debian-PR-Package: hurd X-Debian-PR-Keywords: X-Loop: owner@bugs.debian.org Received: via spool by 102437-submit@bugs.debian.org id=B102437.99487951430019 (code B ref 102437); Wed, 11 Jul 2001 19:33:02 GMT Date: Wed, 11 Jul 2001 21:25:01 +0200 From: Marcus Brinkmann To: "Thomas Bushnell, BSG" , 102437@bugs.debian.org Message-ID: <20010711212501.A432@212.23.136.22> References: <20010627035903.A3552@212.23.136.22> <20010627123525.B414@212.23.136.22> <20010627145217.B824@212.23.136.22> <20010630211616.A665@212.23.136.22> <87g0chjod7.fsf@becket.becket.net> <20010711001832.A2585@212.23.136.22> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010711001832.A2585@212.23.136.22> User-Agent: Mutt/1.3.18i Sender: Marcus Brinkmann Delivered-To: 102437@bugs.debian.org On Wed, Jul 11, 2001 at 12:18:32AM +0200, Marcus Brinkmann wrote: > For the auth server, I will send a patch for review soon. Here it comes. I am not too happy about the macro magic, but it works out ok. The code for S_auth_getids is completely reduplicated in S_auth_server_authenticate. Do you want me to simply call S_auth_getids instead? Problem the patch wants to solve: Returned buffers are not page aligned if they don't fit into the provided buffers, because they are malloc()'ed. Way to fix it: If buffer is not big enough, allocate new buffer with mmap. For this to work, all parameters must be "dealloc" for MiG (including the in paramters of the reply stub). Thanks, Marcus diff -ru hurd/auth/ChangeLog hurd-work/auth/ChangeLog --- hurd/auth/ChangeLog Mon Feb 12 22:47:07 2001 +++ hurd-work/auth/ChangeLog Wed Jul 11 21:18:00 2001 @@ -1,3 +1,22 @@ +2001-07-11 Marcus Brinkmann + + * auth.c : Include . + (idvec_copyout): Change return type from void to int. + Return buffer is allocated if not big enough. Clean up + calculation of array size. Return an error on failure and 0 on + success. + (C): Only call idvec_copyout if no error occured so far. + (OUTIDS): Change syntax to accomodate changes to definition of C. + (D, SAVEIDS): New macros to define local variables EUIDS_SAVED, + EGIDS_SAVED, AUIDS_SAVED, AGIDS_SAVED and store the respective + arguments in them. + (F, FREEIDS): New macros to free allocated buffers, to be used + on errors in conjunction with SAVEIDS. + (S_auth_getids): Use SAVEIDS and FREEIDS. + New variable err. + (S_auth_server_authenticate): Before calling the reply stub, copy + out the ids just as in S_auth_getids. + 2001-02-12 Marcus Brinkmann * auth.c (main): New variable ARGP defining a doc string. diff -ru hurd/auth/auth.c hurd-work/auth/auth.c --- hurd/auth/auth.c Mon Feb 12 22:39:42 2001 +++ hurd-work/auth/auth.c Wed Jul 11 21:16:51 2001 @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -82,18 +83,30 @@ /* id management. */ -inline void idvec_copyout (struct idvec *idvec, uid_t **ids, uid_t *nids) +inline int idvec_copyout (struct idvec *idvec, uid_t **ids, uid_t *nids) { if (idvec->num > *nids) - *ids = idvec->ids; - else - memcpy (*ids, idvec->ids, idvec->num * sizeof *ids); + { + *ids = mmap (0, idvec->num * sizeof (**ids), PROT_READ|PROT_WRITE, + MAP_ANON, 0, 0); + if (*ids == (uid_t *) -1) + return errno; + } + memcpy (*ids, idvec->ids, idvec->num * sizeof (**ids)); *nids = idvec->num; + + return 0; } -#define C(auth, ids) idvec_copyout (&auth->ids, ids, n##ids) -#define OUTIDS(auth) (C (auth, euids), C (auth, egids), \ - C (auth, auids), C (auth, agids)) +#define C(auth, ids) if (! err) \ + err = idvec_copyout (&auth->ids, ids, n##ids) +#define OUTIDS(auth) { C (auth, euids); C (auth, egids); \ + C (auth, auids); C (auth, agids); } +#define D(ids) *ids##_saved = *ids +#define SAVEIDS uid_t D (euids), D (egids), D (auids), D (agids) +#define F(ids) if (*ids != ids##_saved) \ + munmap (*ids, *n##ids * sizeof (uid_t)) +#define FREEIDS { F (euids); F (egids); F (auids); F (agids); } /* Implement auth_getids as described in . */ kern_return_t @@ -107,12 +120,17 @@ uid_t **agids, u_int *nagids) { + int err = 0; + SAVEIDS; + if (! auth) return EOPNOTSUPP; - + OUTIDS (auth); - - return 0; + if (err) + FREEIDS; + + return err; } /* Implement auth_makeauth as described in . */ @@ -421,6 +439,18 @@ /* Extract the ids. We must use a separate reply stub so we can deref the user auth handle after the reply uses its contents. */ + { + int err = 0; + SAVEIDS; + + OUTIDS (user); + + if (err) + { + FREEIDS; + return err; + } + } auth_server_authenticate_reply (reply, reply_type, 0, user->euids.ids, user->euids.num, user->auids.ids, user->auids.num, diff -ru hurd/hurd/ChangeLog hurd-work/hurd/ChangeLog --- hurd/hurd/ChangeLog Wed Jul 11 00:15:12 2001 +++ hurd-work/hurd/ChangeLog Wed Jul 11 19:31:47 2001 @@ -1,5 +1,14 @@ 2001-07-11 Marcus Brinkmann + * auth_reply.defs (simpleroutine auth_server_authentcate_reply): + Add dealloc to in paramters (GEN_UIDS, AUX_UIDS, GEN_GIDS, AUX_GIDS). + + * auth.defs (routine auth_getids): Add dealloc to all out parameters + (EUIDS, AUIDS, EGIDS, AGIDS). + (routine auth_server_authenticate): Likewise. + +2001-07-11 Marcus Brinkmann + * fs.defs (routine file_get_storage_info): Add dealloc to all out parameters (PORTS, INTS, OFFSETS, DATA). (routine file_get_fs_options): Add dealloc to out parameter OPTIONS. diff -ru hurd/hurd/auth.defs hurd-work/hurd/auth.defs --- hurd/hurd/auth.defs Fri May 3 22:56:21 1996 +++ hurd-work/hurd/auth.defs Wed Jul 11 19:28:18 2001 @@ -1,5 +1,5 @@ /* Definitions for the authentication server - Copyright (C) 1991, 1992, 1993, 1994, 1996 Free Software Foundation + Copyright (C) 1991, 1992, 1993, 1994, 1996, 2001 Free Software Foundation This file is part of the GNU Hurd. @@ -38,10 +38,10 @@ /* Given an authentication handle, return the identification. */ routine auth_getids ( handle: auth_t; - out euids: idarray_t; - out auids: idarray_t; - out egids: idarray_t; - out agids: idarray_t); + out euids: idarray_t, dealloc; + out auids: idarray_t, dealloc; + out egids: idarray_t, dealloc; + out agids: idarray_t, dealloc); /* Create a new authentication handle. */ routine auth_makeauth ( @@ -72,9 +72,7 @@ sreplyport reply: mach_port_poly_t; rendezvous: mach_port_send_t; newport: mach_port_poly_t; - out euids: idarray_t; - out auids: idarray_t; - out egids: idarray_t; - out agids: idarray_t); - - + out euids: idarray_t, dealloc; + out auids: idarray_t, dealloc; + out egids: idarray_t, dealloc; + out agids: idarray_t, dealloc); diff -ru hurd/hurd/auth_reply.defs hurd-work/hurd/auth_reply.defs --- hurd/hurd/auth_reply.defs Mon Jan 24 23:38:38 1994 +++ hurd-work/hurd/auth_reply.defs Wed Jul 11 19:31:36 2001 @@ -1,5 +1,5 @@ /* Reply-only side of auth interface - Copyright (C) 1991, 1993, 1994 Free Software Foundation + Copyright (C) 1991, 1993, 1994, 2001 Free Software Foundation This file is part of the GNU Hurd. @@ -37,8 +37,7 @@ simpleroutine auth_server_authenticate_reply ( reply_port: reply_port_t; in return_code: kern_return_t; - in gen_uids: idarray_t; - in aux_uids: idarray_t; - in gen_gids: idarray_t; - in aux_gids: idarray_t); - + in gen_uids: idarray_t, dealloc; + in aux_uids: idarray_t, dealloc; + in gen_gids: idarray_t, dealloc; + in aux_gids: idarray_t, dealloc); -- `Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org Marcus.Brinkmann@ruhr-uni-bochum.de http://www.marcus-brinkmann.de   Acknowledgement sent to Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>:
Extra info received and forwarded to list. Copy sent to GNU Hurd Maintainers <bug-hurd@gnu.org>.   -t  From: owner@bugs.debian.org (Debian Bug Tracking System) To: Marcus Brinkmann Subject: Bug#102437: Info received (was Bug#102437: dealloc analysis for each server function, more bugs!) Message-ID: In-Reply-To: <20010711212501.A432@212.23.136.22> References: <20010711212501.A432@212.23.136.22> X-Debian-PR-Message: ack-info-maintonly 102437 Thank you for the additional information you have supplied regarding this problem report. It has been forwarded to the developer(s) and to the developers mailing list to accompany the original report. Your message has been sent to the package maintainer(s): GNU Hurd Maintainers If you wish to continue to submit further information on your problem, please send it to 102437@bugs.debian.org, as before. Please do not reply to the address at the top of this message, unless you wish to report a problem with the Bug-tracking system. Darren Benham (administrator, Debian Bugs database)   Received: (at 102437) by bugs.debian.org; 11 Jul 2001 19:25:14 +0000 From Marcus.Brinkmann@ruhr-uni-bochum.de Wed Jul 11 14:25:14 2001 Return-path: Received: from (localhost) [::ffff:212.23.136.22] by master.debian.org with esmtp (Exim 3.12 1 (Debian)) id 15KPbl-0007ny-00; Wed, 11 Jul 2001 14:25:13 -0500 Received: from marcus by localhost with local (Exim 3.22 #1 (Debian)) id 15KPbZ-00007t-00; Wed, 11 Jul 2001 21:25:01 +0200 Date: Wed, 11 Jul 2001 21:25:01 +0200 From: Marcus Brinkmann To: "Thomas Bushnell, BSG" , 102437@bugs.debian.org Subject: Re: Bug#102437: dealloc analysis for each server function, more bugs! Message-ID: <20010711212501.A432@212.23.136.22> References: <20010627035903.A3552@212.23.136.22> <20010627123525.B414@212.23.136.22> <20010627145217.B824@212.23.136.22> <20010630211616.A665@212.23.136.22> <87g0chjod7.fsf@becket.becket.net> <20010711001832.A2585@212.23.136.22> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010711001832.A2585@212.23.136.22> User-Agent: Mutt/1.3.18i Sender: Marcus Brinkmann Delivered-To: 102437@bugs.debian.org On Wed, Jul 11, 2001 at 12:18:32AM +0200, Marcus Brinkmann wrote: > For the auth server, I will send a patch for review soon. Here it comes. I am not too happy about the macro magic, but it works out ok. The code for S_auth_getids is completely reduplicated in S_auth_server_authenticate. Do you want me to simply call S_auth_getids instead? Problem the patch wants to solve: Returned buffers are not page aligned if they don't fit into the provided buffers, because they are malloc()'ed. Way to fix it: If buffer is not big enough, allocate new buffer with mmap. For this to work, all parameters must be "dealloc" for MiG (including the in paramters of the reply stub). Thanks, Marcus diff -ru hurd/auth/ChangeLog hurd-work/auth/ChangeLog --- hurd/auth/ChangeLog Mon Feb 12 22:47:07 2001 +++ hurd-work/auth/ChangeLog Wed Jul 11 21:18:00 2001 @@ -1,3 +1,22 @@ +2001-07-11 Marcus Brinkmann + + * auth.c : Include . + (idvec_copyout): Change return type from void to int. + Return buffer is allocated if not big enough. Clean up + calculation of array size. Return an error on failure and 0 on + success. + (C): Only call idvec_copyout if no error occured so far. + (OUTIDS): Change syntax to accomodate changes to definition of C. + (D, SAVEIDS): New macros to define local variables EUIDS_SAVED, + EGIDS_SAVED, AUIDS_SAVED, AGIDS_SAVED and store the respective + arguments in them. + (F, FREEIDS): New macros to free allocated buffers, to be used + on errors in conjunction with SAVEIDS. + (S_auth_getids): Use SAVEIDS and FREEIDS. + New variable err. + (S_auth_server_authenticate): Before calling the reply stub, copy + out the ids just as in S_auth_getids. + 2001-02-12 Marcus Brinkmann * auth.c (main): New variable ARGP defining a doc string. diff -ru hurd/auth/auth.c hurd-work/auth/auth.c --- hurd/auth/auth.c Mon Feb 12 22:39:42 2001 +++ hurd-work/auth/auth.c Wed Jul 11 21:16:51 2001 @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -82,18 +83,30 @@ /* id management. */ -inline void idvec_copyout (struct idvec *idvec, uid_t **ids, uid_t *nids) +inline int idvec_copyout (struct idvec *idvec, uid_t **ids, uid_t *nids) { if (idvec->num > *nids) - *ids = idvec->ids; - else - memcpy (*ids, idvec->ids, idvec->num * sizeof *ids); + { + *ids = mmap (0, idvec->num * sizeof (**ids), PROT_READ|PROT_WRITE, + MAP_ANON, 0, 0); + if (*ids == (uid_t *) -1) + return errno; + } + memcpy (*ids, idvec->ids, idvec->num * sizeof (**ids)); *nids = idvec->num; + + return 0; } -#define C(auth, ids) idvec_copyout (&auth->ids, ids, n##ids) -#define OUTIDS(auth) (C (auth, euids), C (auth, egids), \ - C (auth, auids), C (auth, agids)) +#define C(auth, ids) if (! err) \ + err = idvec_copyout (&auth->ids, ids, n##ids) +#define OUTIDS(auth) { C (auth, euids); C (auth, egids); \ + C (auth, auids); C (auth, agids); } +#define D(ids) *ids##_saved = *ids +#define SAVEIDS uid_t D (euids), D (egids), D (auids), D (agids) +#define F(ids) if (*ids != ids##_saved) \ + munmap (*ids, *n##ids * sizeof (uid_t)) +#define FREEIDS { F (euids); F (egids); F (auids); F (agids); } /* Implement auth_getids as described in . */ kern_return_t @@ -107,12 +120,17 @@ uid_t **agids, u_int *nagids) { + int err = 0; + SAVEIDS; + if (! auth) return EOPNOTSUPP; - + OUTIDS (auth); - - return 0; + if (err) + FREEIDS; + + return err; } /* Implement auth_makeauth as described in . */ @@ -421,6 +439,18 @@ /* Extract the ids. We must use a separate reply stub so we can deref the user auth handle after the reply uses its contents. */ + { + int err = 0; + SAVEIDS; + + OUTIDS (user); + + if (err) + { + FREEIDS; + return err; + } + } auth_server_authenticate_reply (reply, reply_type, 0, user->euids.ids, user->euids.num, user->auids.ids, user->auids.num, diff -ru hurd/hurd/ChangeLog hurd-work/hurd/ChangeLog --- hurd/hurd/ChangeLog Wed Jul 11 00:15:12 2001 +++ hurd-work/hurd/ChangeLog Wed Jul 11 19:31:47 2001 @@ -1,5 +1,14 @@ 2001-07-11 Marcus Brinkmann + * auth_reply.defs (simpleroutine auth_server_authentcate_reply): + Add dealloc to in paramters (GEN_UIDS, AUX_UIDS, GEN_GIDS, AUX_GIDS). + + * auth.defs (routine auth_getids): Add dealloc to all out parameters + (EUIDS, AUIDS, EGIDS, AGIDS). + (routine auth_server_authenticate): Likewise. + +2001-07-11 Marcus Brinkmann + * fs.defs (routine file_get_storage_info): Add dealloc to all out parameters (PORTS, INTS, OFFSETS, DATA). (routine file_get_fs_options): Add dealloc to out parameter OPTIONS. diff -ru hurd/hurd/auth.defs hurd-work/hurd/auth.defs --- hurd/hurd/auth.defs Fri May 3 22:56:21 1996 +++ hurd-work/hurd/auth.defs Wed Jul 11 19:28:18 2001 @@ -1,5 +1,5 @@ /* Definitions for the authentication server - Copyright (C) 1991, 1992, 1993, 1994, 1996 Free Software Foundation + Copyright (C) 1991, 1992, 1993, 1994, 1996, 2001 Free Software Foundation This file is part of the GNU Hurd. @@ -38,10 +38,10 @@ /* Given an authentication handle, return the identification. */ routine auth_getids ( handle: auth_t; - out euids: idarray_t; - out auids: idarray_t; - out egids: idarray_t; - out agids: idarray_t); + out euids: idarray_t, dealloc; + out auids: idarray_t, dealloc; + out egids: idarray_t, dealloc; + out agids: idarray_t, dealloc); /* Create a new authentication handle. */ routine auth_makeauth ( @@ -72,9 +72,7 @@ sreplyport reply: mach_port_poly_t; rendezvous: mach_port_send_t; newport: mach_port_poly_t; - out euids: idarray_t; - out auids: idarray_t; - out egids: idarray_t; - out agids: idarray_t); - - + out euids: idarray_t, dealloc; + out auids: idarray_t, dealloc; + out egids: idarray_t, dealloc; + out agids: idarray_t, dealloc); diff -ru hurd/hurd/auth_reply.defs hurd-work/hurd/auth_reply.defs --- hurd/hurd/auth_reply.defs Mon Jan 24 23:38:38 1994 +++ hurd-work/hurd/auth_reply.defs Wed Jul 11 19:31:36 2001 @@ -1,5 +1,5 @@ /* Reply-only side of auth interface - Copyright (C) 1991, 1993, 1994 Free Software Foundation + Copyright (C) 1991, 1993, 1994, 2001 Free Software Foundation This file is part of the GNU Hurd. @@ -37,8 +37,7 @@ simpleroutine auth_server_authenticate_reply ( reply_port: reply_port_t; in return_code: kern_return_t; - in gen_uids: idarray_t; - in aux_uids: idarray_t; - in gen_gids: idarray_t; - in aux_gids: idarray_t); - + in gen_uids: idarray_t, dealloc; + in aux_uids: idarray_t, dealloc; + in gen_gids: idarray_t, dealloc; + in aux_gids: idarray_t, dealloc); -- `Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org Marcus.Brinkmann@ruhr-uni-bochum.de http://www.marcus-brinkmann.de   Information forwarded to debian-bugs-dist@lists.debian.org, GNU Hurd Maintainers <bug-hurd@gnu.org>:
Bug#102437; Package hurd.   debian-bugs-dist@lists.debian.orgGNU Hurd Maintainers  Subject: Bug#102437: dealloc analysis for each server function, more bugs! Reply-To: Roland McGrath , 102437@bugs.debian.org Resent-From: Roland McGrath Orignal-Sender: roland@frob.com Resent-To: debian-bugs-dist@lists.debian.org Resent-CC: GNU Hurd Maintainers Resent-Date: Wed, 11 Jul 2001 22:12:52 GMT Resent-Message-ID: Resent-Sender: owner@bugs.debian.org X-Debian-PR-Message: report 102437 X-Debian-PR-Package: hurd X-Debian-PR-Keywords: X-Loop: owner@bugs.debian.org Received: via spool by 102437-submit@bugs.debian.org id=B102437.99488474331768 (code B ref 102437); Wed, 11 Jul 2001 22:12:52 GMT MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit From: Roland McGrath To: Marcus Brinkmann , 102437@bugs.debian.org Cc: "Thomas Bushnell, BSG" In-Reply-To: Marcus Brinkmann's message of Wed, 11 July 2001 21:25:01 +0200 <20010711212501.A432@212.23.136.22> X-Zippy-Says: Kids, don't gross me off.. ``Adventures with MENTAL HYGIENE'' can be carried too FAR! Message-Id: <20010711204917.8149999766@perdition.linnaean.org> Date: Wed, 11 Jul 2001 16:49:17 -0400 (EDT) Sender: roland@frob.com Delivered-To: 102437@bugs.debian.org That's fine by me if it's tested. BTW add -p to your diff switches.   Acknowledgement sent to Roland McGrath <roland@gnu.org>:
Extra info received and forwarded to list. Copy sent to GNU Hurd Maintainers <bug-hurd@gnu.org>.   -t  From: owner@bugs.debian.org (Debian Bug Tracking System) To: Roland McGrath Subject: Bug#102437: Info received (was Bug#102437: dealloc analysis for each server function, more bugs!) Message-ID: In-Reply-To: <20010711204917.8149999766@perdition.linnaean.org> References: <20010711204917.8149999766@perdition.linnaean.org> X-Debian-PR-Message: ack-info-maintonly 102437 Thank you for the additional information you have supplied regarding this problem report. It has been forwarded to the developer(s) and to the developers mailing list to accompany the original report. Your message has been sent to the package maintainer(s): GNU Hurd Maintainers If you wish to continue to submit further information on your problem, please send it to 102437@bugs.debian.org, as before. Please do not reply to the address at the top of this message, unless you wish to report a problem with the Bug-tracking system. Darren Benham (administrator, Debian Bugs database)   Received: (at 102437) by bugs.debian.org; 11 Jul 2001 20:52:23 +0000 From roland@frob.com Wed Jul 11 15:52:23 2001 Return-path: Received: from hefeweizen.cv.linnaean.org (hefeweizen.linnaean.org) [::ffff:209.58.179.123] by master.debian.org with esmtp (Exim 3.12 1 (Debian)) id 15KQy7-0008FP-00; Wed, 11 Jul 2001 15:52:23 -0500 Received: from perdition.linnaean.org (hagx.ne.mediaone.net [24.147.20.16]) by hefeweizen.linnaean.org (8.9.3/8.9.3/AI2.13/linnaean.master:2.6) with ESMTP id QAA28961; Wed, 11 Jul 2001 16:49:50 -0400 (EDT) Received: by perdition.linnaean.org (Postfix, from userid 5281) id 8149999766; Wed, 11 Jul 2001 16:49:17 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit From: Roland McGrath To: Marcus Brinkmann , 102437@bugs.debian.org Cc: "Thomas Bushnell, BSG" Subject: Re: Bug#102437: dealloc analysis for each server function, more bugs! In-Reply-To: Marcus Brinkmann's message of Wed, 11 July 2001 21:25:01 +0200 <20010711212501.A432@212.23.136.22> X-Zippy-Says: Kids, don't gross me off.. ``Adventures with MENTAL HYGIENE'' can be carried too FAR! Message-Id: <20010711204917.8149999766@perdition.linnaean.org> Date: Wed, 11 Jul 2001 16:49:17 -0400 (EDT) Sender: roland@frob.com Delivered-To: 102437@bugs.debian.org That's fine by me if it's tested. BTW add -p to your diff switches.   Information forwarded to debian-bugs-dist@lists.debian.org, GNU Hurd Maintainers <bug-hurd@gnu.org>:
Bug#102437; Package hurd.   debian-bugs-dist@lists.debian.orgGNU Hurd Maintainers  Subject: Bug#102437: dealloc analysis for each server function, more bugs! Reply-To: Marcus Brinkmann , 102437@bugs.debian.org Resent-From: Marcus Brinkmann Orignal-Sender: Marcus Brinkmann Resent-To: debian-bugs-dist@lists.debian.org Resent-CC: GNU Hurd Maintainers Resent-Date: Thu, 12 Jul 2001 19:18:02 GMT Resent-Message-ID: Resent-Sender: owner@bugs.debian.org X-Debian-PR-Message: report 102437 X-Debian-PR-Package: hurd X-Debian-PR-Keywords: X-Loop: owner@bugs.debian.org Received: via spool by 102437-submit@bugs.debian.org id=B102437.99496478313657 (code B ref 102437); Thu, 12 Jul 2001 19:18:02 GMT Date: Thu, 12 Jul 2001 21:06:12 +0200 From: Marcus Brinkmann To: Roland McGrath , 102437@bugs.debian.org Cc: "Thomas Bushnell, BSG" Message-ID: <20010712210612.A443@212.23.136.22> References: <20010711204917.8149999766@perdition.linnaean.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010711204917.8149999766@perdition.linnaean.org> User-Agent: Mutt/1.3.18i Sender: Marcus Brinkmann Delivered-To: 102437@bugs.debian.org On Wed, Jul 11, 2001 at 04:49:17PM -0400, Roland McGrath wrote: > That's fine by me if it's tested. BTW add -p to your diff switches. Actually, I goofed up. The arguments to the reply stub have not been changed by my patch. In fact, as we now copy the user data all the time, a seperate reply stub is not necessary anymore! There is also a bug somewhere. I will work out something better. Thanks, Marcus -- `Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org Marcus.Brinkmann@ruhr-uni-bochum.de http://www.marcus-brinkmann.de   Acknowledgement sent to Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>:
Extra info received and forwarded to list. Copy sent to GNU Hurd Maintainers <bug-hurd@gnu.org>.   -t  From: owner@bugs.debian.org (Debian Bug Tracking System) To: Marcus Brinkmann Subject: Bug#102437: Info received (was Bug#102437: dealloc analysis for each server function, more bugs!) Message-ID: In-Reply-To: <20010712210612.A443@212.23.136.22> References: <20010712210612.A443@212.23.136.22> X-Debian-PR-Message: ack-info-maintonly 102437 Thank you for the additional information you have supplied regarding this problem report. It has been forwarded to the developer(s) and to the developers mailing list to accompany the original report. Your message has been sent to the package maintainer(s): GNU Hurd Maintainers If you wish to continue to submit further information on your problem, please send it to 102437@bugs.debian.org, as before. Please do not reply to the address at the top of this message, unless you wish to report a problem with the Bug-tracking system. Darren Benham (administrator, Debian Bugs database)   Received: (at 102437) by bugs.debian.org; 12 Jul 2001 19:06:23 +0000 From Marcus.Brinkmann@ruhr-uni-bochum.de Thu Jul 12 14:06:22 2001 Return-path: Received: from (localhost) [::ffff:212.23.136.22] by master.debian.org with esmtp (Exim 3.12 1 (Debian)) id 15Kln4-0003YB-00; Thu, 12 Jul 2001 14:06:22 -0500 Received: from marcus by localhost with local (Exim 3.22 #1 (Debian)) id 15Klmv-0000A3-00; Thu, 12 Jul 2001 21:06:13 +0200 Date: Thu, 12 Jul 2001 21:06:12 +0200 From: Marcus Brinkmann To: Roland McGrath , 102437@bugs.debian.org Cc: "Thomas Bushnell, BSG" Subject: Re: Bug#102437: dealloc analysis for each server function, more bugs! Message-ID: <20010712210612.A443@212.23.136.22> References: <20010711204917.8149999766@perdition.linnaean.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010711204917.8149999766@perdition.linnaean.org> User-Agent: Mutt/1.3.18i Sender: Marcus Brinkmann Delivered-To: 102437@bugs.debian.org On Wed, Jul 11, 2001 at 04:49:17PM -0400, Roland McGrath wrote: > That's fine by me if it's tested. BTW add -p to your diff switches. Actually, I goofed up. The arguments to the reply stub have not been changed by my patch. In fact, as we now copy the user data all the time, a seperate reply stub is not necessary anymore! There is also a bug somewhere. I will work out something better. Thanks, Marcus -- `Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org Marcus.Brinkmann@ruhr-uni-bochum.de http://www.marcus-brinkmann.de   Information forwarded to debian-bugs-dist@lists.debian.org, GNU Hurd Maintainers <bug-hurd@gnu.org>:
Bug#102437; Package hurd.   debian-bugs-dist@lists.debian.orgGNU Hurd Maintainers  Subject: Bug#102437: dealloc analysis for each server function, more bugs! Reply-To: Marcus Brinkmann , 102437@bugs.debian.org Resent-From: Marcus Brinkmann Orignal-Sender: Marcus Brinkmann Resent-To: debian-bugs-dist@lists.debian.org Resent-CC: GNU Hurd Maintainers Resent-Date: Thu, 12 Jul 2001 19:48:02 GMT Resent-Message-ID: Resent-Sender: owner@bugs.debian.org X-Debian-PR-Message: report 102437 X-Debian-PR-Package: hurd X-Debian-PR-Keywords: X-Loop: owner@bugs.debian.org Received: via spool by 102437-submit@bugs.debian.org id=B102437.99496668622416 (code B ref 102437); Thu, 12 Jul 2001 19:48:02 GMT Date: Thu, 12 Jul 2001 21:37:51 +0200 From: Marcus Brinkmann To: Roland McGrath , 102437@bugs.debian.org Cc: "Thomas Bushnell, BSG" Message-ID: <20010712213750.A448@212.23.136.22> References: <20010711204917.8149999766@perdition.linnaean.org> <20010712210612.A443@212.23.136.22> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010712210612.A443@212.23.136.22> User-Agent: Mutt/1.3.18i Sender: Marcus Brinkmann Delivered-To: 102437@bugs.debian.org On Thu, Jul 12, 2001 at 09:06:12PM +0200, Marcus Brinkmann wrote: > On Wed, Jul 11, 2001 at 04:49:17PM -0400, Roland McGrath wrote: > > That's fine by me if it's tested. BTW add -p to your diff switches. > > Actually, I goofed up. The arguments to the reply stub have not been > changed by my patch. In fact, as we now copy the user data all the time, a > seperate reply stub is not necessary anymore! There is also a bug > somewhere. The bug was actually what I said above. The following version is tested and seems to work fine. Note that it got much simpler, because the extra reply stub is not needed. I left the change to auth_reply.defs in anyway. However, nothing in the Hurd uses the stubs in auth_reply.defs anymore. Thanks, Marcus hurd/ 2001-07-11 Marcus Brinkmann * auth_reply.defs (simpleroutine auth_server_authentcate_reply): Add dealloc to in paramters (GEN_UIDS, AUX_UIDS, GEN_GIDS, AUX_GIDS). * auth.defs (routine auth_getids): Add dealloc to all out parameters (EUIDS, AUIDS, EGIDS, AGIDS). (routine auth_server_authenticate): Likewise. auth/ 2001-07-11 Marcus Brinkmann * auth.c : Include . (idvec_copyout): Change return type from void to int. Return buffer is allocated if not big enough. Clean up calculation of array size. Return an error on failure and 0 on success. (C): Only call idvec_copyout if no error occured so far. (OUTIDS): Change syntax to accomodate changes to definition of C. (D, SAVEIDS): New macros to define local variables EUIDS_SAVED, EGIDS_SAVED, AUIDS_SAVED, AGIDS_SAVED and store the respective arguments in them. (F, FREEIDS): New macros to free allocated buffers, to be used on errors in conjunction with SAVEIDS. (S_auth_getids): Use SAVEIDS and FREEIDS. New variable err. (S_auth_server_authenticate): Use SAVEIDS, make ERR a local variable of the whole function. Instead calling the reply stub, copy out the ids just as in S_auth_getids. Return ERR. --- hurd/hurd/auth.defs Fri May 3 22:56:21 1996 +++ /mnt/marcus/gnu/hurd/hurd/hurd-20010610/hurd/auth.defs Wed Jul 11 20:44:38 2001 @@ -1,5 +1,5 @@ /* Definitions for the authentication server - Copyright (C) 1991, 1992, 1993, 1994, 1996 Free Software Foundation + Copyright (C) 1991, 1992, 1993, 1994, 1996, 2001 Free Software Foundation This file is part of the GNU Hurd. @@ -38,10 +38,10 @@ /* Given an authentication handle, return the identification. */ routine auth_getids ( handle: auth_t; - out euids: idarray_t; - out auids: idarray_t; - out egids: idarray_t; - out agids: idarray_t); + out euids: idarray_t, dealloc; + out auids: idarray_t, dealloc; + out egids: idarray_t, dealloc; + out agids: idarray_t, dealloc); /* Create a new authentication handle. */ routine auth_makeauth ( @@ -72,9 +72,7 @@ sreplyport reply: mach_port_poly_t; rendezvous: mach_port_send_t; newport: mach_port_poly_t; - out euids: idarray_t; - out auids: idarray_t; - out egids: idarray_t; - out agids: idarray_t); - - + out euids: idarray_t, dealloc; + out auids: idarray_t, dealloc; + out egids: idarray_t, dealloc; + out agids: idarray_t, dealloc); --- hurd/hurd/auth_reply.defs Mon Jan 24 23:38:38 1994 +++ /mnt/marcus/gnu/hurd/hurd/hurd-20010610/hurd/auth_reply.defs Wed Jul 11 20:44:38 2001 @@ -1,5 +1,5 @@ /* Reply-only side of auth interface - Copyright (C) 1991, 1993, 1994 Free Software Foundation + Copyright (C) 1991, 1993, 1994, 2001 Free Software Foundation This file is part of the GNU Hurd. @@ -37,8 +37,7 @@ simpleroutine auth_server_authenticate_reply ( reply_port: reply_port_t; in return_code: kern_return_t; - in gen_uids: idarray_t; - in aux_uids: idarray_t; - in gen_gids: idarray_t; - in aux_gids: idarray_t); - + in gen_uids: idarray_t, dealloc; + in aux_uids: idarray_t, dealloc; + in gen_gids: idarray_t, dealloc; + in aux_gids: idarray_t, dealloc); diff -pru hurd/auth/auth.c /mnt/marcus/gnu/hurd/hurd/hurd-20010610/auth/auth.c --- hurd/auth/auth.c Mon Feb 12 22:39:42 2001 +++ /mnt/marcus/gnu/hurd/hurd/hurd-20010610/auth/auth.c Thu Jul 12 21:09:31 2001 @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -82,18 +83,30 @@ auth_port_to_handle (auth_t auth) /* id management. */ -inline void idvec_copyout (struct idvec *idvec, uid_t **ids, uid_t *nids) +inline int idvec_copyout (struct idvec *idvec, uid_t **ids, uid_t *nids) { if (idvec->num > *nids) - *ids = idvec->ids; - else - memcpy (*ids, idvec->ids, idvec->num * sizeof *ids); + { + *ids = mmap (0, idvec->num * sizeof (**ids), PROT_READ|PROT_WRITE, + MAP_ANON, 0, 0); + if (*ids == (uid_t *) -1) + return errno; + } + memcpy (*ids, idvec->ids, idvec->num * sizeof (**ids)); *nids = idvec->num; + + return 0; } -#define C(auth, ids) idvec_copyout (&auth->ids, ids, n##ids) -#define OUTIDS(auth) (C (auth, euids), C (auth, egids), \ - C (auth, auids), C (auth, agids)) +#define C(auth, ids) if (! err) \ + err = idvec_copyout (&auth->ids, ids, n##ids) +#define OUTIDS(auth) { C (auth, euids); C (auth, egids); \ + C (auth, auids); C (auth, agids); } +#define D(ids) *ids##_saved = *ids +#define SAVEIDS uid_t D (euids), D (egids), D (auids), D (agids) +#define F(ids) if (*ids != ids##_saved) \ + munmap (*ids, *n##ids * sizeof (uid_t)) +#define FREEIDS { F (euids); F (egids); F (auids); F (agids); } /* Implement auth_getids as described in . */ kern_return_t @@ -107,12 +120,17 @@ S_auth_getids (struct authhandle *auth, uid_t **agids, u_int *nagids) { + int err = 0; + SAVEIDS; + if (! auth) return EOPNOTSUPP; - + OUTIDS (auth); - - return 0; + if (err) + FREEIDS; + + return err; } /* Implement auth_makeauth as described in . */ @@ -358,8 +376,10 @@ S_auth_server_authenticate (struct authh uid_t **agids, u_int *nagids) { + error_t err = 0; struct pending *u; struct authhandle *user; + SAVEIDS; if (! serverauth) return EOPNOTSUPP; @@ -392,7 +412,6 @@ S_auth_server_authenticate (struct authh /* No pending user RPC for this port. Create a pending server RPC record. */ struct pending s; - error_t err; err = ihash_add (pending_servers, rendezvous, &s, &s.locp); if (! err) @@ -418,17 +437,13 @@ S_auth_server_authenticate (struct authh user = s.user; } - /* Extract the ids. We must use a separate reply stub so - we can deref the user auth handle after the reply uses its - contents. */ - auth_server_authenticate_reply (reply, reply_type, 0, - user->euids.ids, user->euids.num, - user->auids.ids, user->auids.num, - user->egids.ids, user->egids.num, - user->agids.ids, user->agids.num); + OUTIDS (user); + if (err) + FREEIDS; + ports_port_deref (user); mach_port_deallocate (mach_task_self (), rendezvous); - return MIG_NO_REPLY; + return err; } -- `Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org Marcus.Brinkmann@ruhr-uni-bochum.de http://www.marcus-brinkmann.de   Acknowledgement sent to Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>:
Extra info received and forwarded to list. Copy sent to GNU Hurd Maintainers <bug-hurd@gnu.org>.   -t  From: owner@bugs.debian.org (Debian Bug Tracking System) To: Marcus Brinkmann Subject: Bug#102437: Info received (was Bug#102437: dealloc analysis for each server function, more bugs!) Message-ID: In-Reply-To: <20010712213750.A448@212.23.136.22> References: <20010712213750.A448@212.23.136.22> X-Debian-PR-Message: ack-info-maintonly 102437 Thank you for the additional information you have supplied regarding this problem report. It has been forwarded to the developer(s) and to the developers mailing list to accompany the original report. Your message has been sent to the package maintainer(s): GNU Hurd Maintainers If you wish to continue to submit further information on your problem, please send it to 102437@bugs.debian.org, as before. Please do not reply to the address at the top of this message, unless you wish to report a problem with the Bug-tracking system. Darren Benham (administrator, Debian Bugs database)   Received: (at 102437) by bugs.debian.org; 12 Jul 2001 19:38:06 +0000 From Marcus.Brinkmann@ruhr-uni-bochum.de Thu Jul 12 14:38:06 2001 Return-path: Received: from (localhost) [::ffff:212.23.136.22] by master.debian.org with esmtp (Exim 3.12 1 (Debian)) id 15KmHl-0005pR-00; Thu, 12 Jul 2001 14:38:05 -0500 Received: from marcus by localhost with local (Exim 3.22 #1 (Debian)) id 15KmHX-00009w-00; Thu, 12 Jul 2001 21:37:51 +0200 Date: Thu, 12 Jul 2001 21:37:51 +0200 From: Marcus Brinkmann To: Roland McGrath , 102437@bugs.debian.org Cc: "Thomas Bushnell, BSG" Subject: Re: Bug#102437: dealloc analysis for each server function, more bugs! Message-ID: <20010712213750.A448@212.23.136.22> References: <20010711204917.8149999766@perdition.linnaean.org> <20010712210612.A443@212.23.136.22> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010712210612.A443@212.23.136.22> User-Agent: Mutt/1.3.18i Sender: Marcus Brinkmann Delivered-To: 102437@bugs.debian.org On Thu, Jul 12, 2001 at 09:06:12PM +0200, Marcus Brinkmann wrote: > On Wed, Jul 11, 2001 at 04:49:17PM -0400, Roland McGrath wrote: > > That's fine by me if it's tested. BTW add -p to your diff switches. > > Actually, I goofed up. The arguments to the reply stub have not been > changed by my patch. In fact, as we now copy the user data all the time, a > seperate reply stub is not necessary anymore! There is also a bug > somewhere. The bug was actually what I said above. The following version is tested and seems to work fine. Note that it got much simpler, because the extra reply stub is not needed. I left the change to auth_reply.defs in anyway. However, nothing in the Hurd uses the stubs in auth_reply.defs anymore. Thanks, Marcus hurd/ 2001-07-11 Marcus Brinkmann * auth_reply.defs (simpleroutine auth_server_authentcate_reply): Add dealloc to in paramters (GEN_UIDS, AUX_UIDS, GEN_GIDS, AUX_GIDS). * auth.defs (routine auth_getids): Add dealloc to all out parameters (EUIDS, AUIDS, EGIDS, AGIDS). (routine auth_server_authenticate): Likewise. auth/ 2001-07-11 Marcus Brinkmann * auth.c : Include . (idvec_copyout): Change return type from void to int. Return buffer is allocated if not big enough. Clean up calculation of array size. Return an error on failure and 0 on success. (C): Only call idvec_copyout if no error occured so far. (OUTIDS): Change syntax to accomodate changes to definition of C. (D, SAVEIDS): New macros to define local variables EUIDS_SAVED, EGIDS_SAVED, AUIDS_SAVED, AGIDS_SAVED and store the respective arguments in them. (F, FREEIDS): New macros to free allocated buffers, to be used on errors in conjunction with SAVEIDS. (S_auth_getids): Use SAVEIDS and FREEIDS. New variable err. (S_auth_server_authenticate): Use SAVEIDS, make ERR a local variable of the whole function. Instead calling the reply stub, copy out the ids just as in S_auth_getids. Return ERR. --- hurd/hurd/auth.defs Fri May 3 22:56:21 1996 +++ /mnt/marcus/gnu/hurd/hurd/hurd-20010610/hurd/auth.defs Wed Jul 11 20:44:38 2001 @@ -1,5 +1,5 @@ /* Definitions for the authentication server - Copyright (C) 1991, 1992, 1993, 1994, 1996 Free Software Foundation + Copyright (C) 1991, 1992, 1993, 1994, 1996, 2001 Free Software Foundation This file is part of the GNU Hurd. @@ -38,10 +38,10 @@ /* Given an authentication handle, return the identification. */ routine auth_getids ( handle: auth_t; - out euids: idarray_t; - out auids: idarray_t; - out egids: idarray_t; - out agids: idarray_t); + out euids: idarray_t, dealloc; + out auids: idarray_t, dealloc; + out egids: idarray_t, dealloc; + out agids: idarray_t, dealloc); /* Create a new authentication handle. */ routine auth_makeauth ( @@ -72,9 +72,7 @@ sreplyport reply: mach_port_poly_t; rendezvous: mach_port_send_t; newport: mach_port_poly_t; - out euids: idarray_t; - out auids: idarray_t; - out egids: idarray_t; - out agids: idarray_t); - - + out euids: idarray_t, dealloc; + out auids: idarray_t, dealloc; + out egids: idarray_t, dealloc; + out agids: idarray_t, dealloc); --- hurd/hurd/auth_reply.defs Mon Jan 24 23:38:38 1994 +++ /mnt/marcus/gnu/hurd/hurd/hurd-20010610/hurd/auth_reply.defs Wed Jul 11 20:44:38 2001 @@ -1,5 +1,5 @@ /* Reply-only side of auth interface - Copyright (C) 1991, 1993, 1994 Free Software Foundation + Copyright (C) 1991, 1993, 1994, 2001 Free Software Foundation This file is part of the GNU Hurd. @@ -37,8 +37,7 @@ simpleroutine auth_server_authenticate_reply ( reply_port: reply_port_t; in return_code: kern_return_t; - in gen_uids: idarray_t; - in aux_uids: idarray_t; - in gen_gids: idarray_t; - in aux_gids: idarray_t); - + in gen_uids: idarray_t, dealloc; + in aux_uids: idarray_t, dealloc; + in gen_gids: idarray_t, dealloc; + in aux_gids: idarray_t, dealloc); diff -pru hurd/auth/auth.c /mnt/marcus/gnu/hurd/hurd/hurd-20010610/auth/auth.c --- hurd/auth/auth.c Mon Feb 12 22:39:42 2001 +++ /mnt/marcus/gnu/hurd/hurd/hurd-20010610/auth/auth.c Thu Jul 12 21:09:31 2001 @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -82,18 +83,30 @@ auth_port_to_handle (auth_t auth) /* id management. */ -inline void idvec_copyout (struct idvec *idvec, uid_t **ids, uid_t *nids) +inline int idvec_copyout (struct idvec *idvec, uid_t **ids, uid_t *nids) { if (idvec->num > *nids) - *ids = idvec->ids; - else - memcpy (*ids, idvec->ids, idvec->num * sizeof *ids); + { + *ids = mmap (0, idvec->num * sizeof (**ids), PROT_READ|PROT_WRITE, + MAP_ANON, 0, 0); + if (*ids == (uid_t *) -1) + return errno; + } + memcpy (*ids, idvec->ids, idvec->num * sizeof (**ids)); *nids = idvec->num; + + return 0; } -#define C(auth, ids) idvec_copyout (&auth->ids, ids, n##ids) -#define OUTIDS(auth) (C (auth, euids), C (auth, egids), \ - C (auth, auids), C (auth, agids)) +#define C(auth, ids) if (! err) \ + err = idvec_copyout (&auth->ids, ids, n##ids) +#define OUTIDS(auth) { C (auth, euids); C (auth, egids); \ + C (auth, auids); C (auth, agids); } +#define D(ids) *ids##_saved = *ids +#define SAVEIDS uid_t D (euids), D (egids), D (auids), D (agids) +#define F(ids) if (*ids != ids##_saved) \ + munmap (*ids, *n##ids * sizeof (uid_t)) +#define FREEIDS { F (euids); F (egids); F (auids); F (agids); } /* Implement auth_getids as described in . */ kern_return_t @@ -107,12 +120,17 @@ S_auth_getids (struct authhandle *auth, uid_t **agids, u_int *nagids) { + int err = 0; + SAVEIDS; + if (! auth) return EOPNOTSUPP; - + OUTIDS (auth); - - return 0; + if (err) + FREEIDS; + + return err; } /* Implement auth_makeauth as described in . */ @@ -358,8 +376,10 @@ S_auth_server_authenticate (struct authh uid_t **agids, u_int *nagids) { + error_t err = 0; struct pending *u; struct authhandle *user; + SAVEIDS; if (! serverauth) return EOPNOTSUPP; @@ -392,7 +412,6 @@ S_auth_server_authenticate (struct authh /* No pending user RPC for this port. Create a pending server RPC record. */ struct pending s; - error_t err; err = ihash_add (pending_servers, rendezvous, &s, &s.locp); if (! err) @@ -418,17 +437,13 @@ S_auth_server_authenticate (struct authh user = s.user; } - /* Extract the ids. We must use a separate reply stub so - we can deref the user auth handle after the reply uses its - contents. */ - auth_server_authenticate_reply (reply, reply_type, 0, - user->euids.ids, user->euids.num, - user->auids.ids, user->auids.num, - user->egids.ids, user->egids.num, - user->agids.ids, user->agids.num); + OUTIDS (user); + if (err) + FREEIDS; + ports_port_deref (user); mach_port_deallocate (mach_task_self (), rendezvous); - return MIG_NO_REPLY; + return err; } -- `Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org Marcus.Brinkmann@ruhr-uni-bochum.de http://www.marcus-brinkmann.de   Information forwarded to debian-bugs-dist@lists.debian.org, GNU Hurd Maintainers <bug-hurd@gnu.org>:
Bug#102437; Package hurd.   debian-bugs-dist@lists.debian.orgGNU Hurd Maintainers  Subject: Bug#102437: dealloc analysis for each server function, more bugs! Reply-To: Roland McGrath , 102437@bugs.debian.org Resent-From: Roland McGrath Orignal-Sender: roland@frob.com Resent-To: debian-bugs-dist@lists.debian.org Resent-CC: GNU Hurd Maintainers Resent-Date: Thu, 12 Jul 2001 20:42:06 GMT Resent-Message-ID: Resent-Sender: owner@bugs.debian.org X-Debian-PR-Message: report 102437 X-Debian-PR-Package: hurd X-Debian-PR-Keywords: X-Loop: owner@bugs.debian.org Received: via spool by 102437-submit@bugs.debian.org id=B102437.9949702736585 (code B ref 102437); Thu, 12 Jul 2001 20:42:06 GMT MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit From: Roland McGrath To: Marcus Brinkmann Cc: 102437@bugs.debian.org, "Thomas Bushnell, BSG" In-Reply-To: Marcus Brinkmann's message of Thu, 12 July 2001 21:06:12 +0200 <20010712210612.A443@212.23.136.22> X-Antipastobozoticataclysm: When George Bush projectile vomits antipasto on the Japanese. Message-Id: <20010712203445.2AC8D99766@perdition.linnaean.org> Date: Thu, 12 Jul 2001 16:34:45 -0400 (EDT) Sender: roland@frob.com Delivered-To: 102437@bugs.debian.org > On Wed, Jul 11, 2001 at 04:49:17PM -0400, Roland McGrath wrote: > > That's fine by me if it's tested. BTW add -p to your diff switches. > > Actually, I goofed up. The arguments to the reply stub have not been > changed by my patch. In fact, as we now copy the user data all the time, a > seperate reply stub is not necessary anymore! There is also a bug > somewhere. > > I will work out something better. I didn't look closely, but now I am thinking twice. If the data is small enough to fit inline, and you use a separate reply stub, then you can send it without copying. That ought to be the common case.   Acknowledgement sent to Roland McGrath <roland@gnu.org>:
Extra info received and forwarded to list. Copy sent to GNU Hurd Maintainers <bug-hurd@gnu.org>.   -t  From: owner@bugs.debian.org (Debian Bug Tracking System) To: Roland McGrath Subject: Bug#102437: Info received (was Bug#102437: dealloc analysis for each server function, more bugs!) Message-ID: In-Reply-To: <20010712203445.2AC8D99766@perdition.linnaean.org> References: <20010712203445.2AC8D99766@perdition.linnaean.org> X-Debian-PR-Message: ack-info-maintonly 102437 Thank you for the additional information you have supplied regarding this problem report. It has been forwarded to the developer(s) and to the developers mailing list to accompany the original report. Your message has been sent to the package maintainer(s): GNU Hurd Maintainers If you wish to continue to submit further information on your problem, please send it to 102437@bugs.debian.org, as before. Please do not reply to the address at the top of this message, unless you wish to report a problem with the Bug-tracking system. Darren Benham (administrator, Debian Bugs database)   Received: (at 102437) by bugs.debian.org; 12 Jul 2001 20:37:53 +0000 From roland@frob.com Thu Jul 12 15:37:53 2001 Return-path: Received: from hefeweizen.cv.linnaean.org (hefeweizen.linnaean.org) [::ffff:209.58.179.123] by master.debian.org with esmtp (Exim 3.12 1 (Debian)) id 15KnDc-0001i4-00; Thu, 12 Jul 2001 15:37:52 -0500 Received: from perdition.linnaean.org (hagx.ne.mediaone.net [24.147.20.16]) by hefeweizen.linnaean.org (8.9.3/8.9.3/AI2.13/linnaean.master:2.6) with ESMTP id QAA09902; Thu, 12 Jul 2001 16:35:25 -0400 (EDT) Received: by perdition.linnaean.org (Postfix, from userid 5281) id 2AC8D99766; Thu, 12 Jul 2001 16:34:45 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit From: Roland McGrath To: Marcus Brinkmann Cc: 102437@bugs.debian.org, "Thomas Bushnell, BSG" Subject: Re: Bug#102437: dealloc analysis for each server function, more bugs! In-Reply-To: Marcus Brinkmann's message of Thu, 12 July 2001 21:06:12 +0200 <20010712210612.A443@212.23.136.22> X-Antipastobozoticataclysm: When George Bush projectile vomits antipasto on the Japanese. Message-Id: <20010712203445.2AC8D99766@perdition.linnaean.org> Date: Thu, 12 Jul 2001 16:34:45 -0400 (EDT) Sender: roland@frob.com Delivered-To: 102437@bugs.debian.org > On Wed, Jul 11, 2001 at 04:49:17PM -0400, Roland McGrath wrote: > > That's fine by me if it's tested. BTW add -p to your diff switches. > > Actually, I goofed up. The arguments to the reply stub have not been > changed by my patch. In fact, as we now copy the user data all the time, a > seperate reply stub is not necessary anymore! There is also a bug > somewhere. > > I will work out something better. I didn't look closely, but now I am thinking twice. If the data is small enough to fit inline, and you use a separate reply stub, then you can send it without copying. That ought to be the common case.   Information forwarded to debian-bugs-dist@lists.debian.org, GNU Hurd Maintainers <bug-hurd@gnu.org>:
Bug#102437; Package hurd.   debian-bugs-dist@lists.debian.orgGNU Hurd Maintainers  Subject: Bug#102437: dealloc analysis for each server function, more bugs! Reply-To: Marcus Brinkmann , 102437@bugs.debian.org Resent-From: Marcus Brinkmann Orignal-Sender: Marcus Brinkmann Resent-To: debian-bugs-dist@lists.debian.org Resent-CC: GNU Hurd Maintainers Resent-Date: Thu, 12 Jul 2001 22:03:58 GMT Resent-Message-ID: Resent-Sender: owner@bugs.debian.org X-Debian-PR-Message: report 102437 X-Debian-PR-Package: hurd X-Debian-PR-Keywords: X-Loop: owner@bugs.debian.org Received: via spool by 102437-submit@bugs.debian.org id=B102437.99497175011652 (code B ref 102437); Thu, 12 Jul 2001 22:03:58 GMT Date: Thu, 12 Jul 2001 23:02:16 +0200 From: Marcus Brinkmann To: Roland McGrath Cc: 102437@bugs.debian.org, "Thomas Bushnell, BSG" Message-ID: <20010712230216.C26336@212.23.136.22> References: <20010712203445.2AC8D99766@perdition.linnaean.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010712203445.2AC8D99766@perdition.linnaean.org> User-Agent: Mutt/1.3.18i Sender: Marcus Brinkmann Delivered-To: 102437@bugs.debian.org On Thu, Jul 12, 2001 at 04:34:45PM -0400, Roland McGrath wrote: > > On Wed, Jul 11, 2001 at 04:49:17PM -0400, Roland McGrath wrote: > > > That's fine by me if it's tested. BTW add -p to your diff switches. > > > > Actually, I goofed up. The arguments to the reply stub have not been > > changed by my patch. In fact, as we now copy the user data all the time, a > > seperate reply stub is not necessary anymore! There is also a bug > > somewhere. > > > > I will work out something better. > > I didn't look closely, but now I am thinking twice. If the data is small > enough to fit inline, and you use a separate reply stub, then you can send > it without copying. That ought to be the common case. Yes, we can save one copy this way. This is actually true in all places where we return small amounts of data in an array. It looks a bit like micro-optimization, but I can do the change, null problemo. It just requires a different OUTIDS (idvec_copyout) function in auth_server_authenticate, which sets *ids to user->ids.ids if the number is small (and provides *ids and *n##ids to the reply stub). Want me to do this? Thanks, Marcus -- `Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org Marcus.Brinkmann@ruhr-uni-bochum.de http://www.marcus-brinkmann.de   Acknowledgement sent to Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>:
Extra info received and forwarded to list. Copy sent to GNU Hurd Maintainers <bug-hurd@gnu.org>.   -t  From: owner@bugs.debian.org (Debian Bug Tracking System) To: Marcus Brinkmann Subject: Bug#102437: Info received (was Bug#102437: dealloc analysis for each server function, more bugs!) Message-ID: In-Reply-To: <20010712230216.C26336@212.23.136.22> References: <20010712230216.C26336@212.23.136.22> X-Debian-PR-Message: ack-info-maintonly 102437 Thank you for the additional information you have supplied regarding this problem report. It has been forwarded to the developer(s) and to the developers mailing list to accompany the original report. Your message has been sent to the package maintainer(s): GNU Hurd Maintainers