lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <48C8182F.5090008@cs.columbia.edu>
Date:	Wed, 10 Sep 2008 14:55:43 -0400
From:	Oren Laadan <orenl@...columbia.edu>
To:	Dave Hansen <dave@...ux.vnet.ibm.com>
CC:	containers@...ts.linux-foundation.org, jeremy@...p.org,
	arnd@...db.de, linux-kernel@...r.kernel.org
Subject: Re: [RFC v4][PATCH 9/9] File descriprtors (restore)



Dave Hansen wrote:
> On Tue, 2008-09-09 at 21:49 -0400, Oren Laadan wrote:
>> Dave Hansen wrote:
>>> On Tue, 2008-09-09 at 03:42 -0400, Oren Laadan wrote:
>>>> +static int cr_close_all_fds(struct files_struct *files)
>>>> +{
>>>> +       int *fdtable;
>>>> +       int n;
>>>> +
>>>> +       do {
>>>> +               n = cr_scan_fds(files, &fdtable);
>>>> +               if (n < 0)
>>>> +                       return n;
>>>> +               while (n--)
>>>> +                       sys_close(fdtable[n]);
>>>> +               kfree(fdtable);
>>>> +       } while (n != -1);
>>>> +
>>>> +       return 0;
>>>> +}
>>> This needs to use an ERR_PTR().  It will save using the double-pointer.
>> I suppose you refer to the call to cr_scan_fds(): either 'fdtable'
>> or 'n' will have to pass-by-reference. Is it that you prefer it to be
>> 	fdtable = cr_scan_fds(files, &n);
>> ?
> 
> I was misreading the use of 'n'.  Can you really not use close_files()
> for this operation?  You'd need to add some locking around it, but I
> think it does what you need here.

I thought about that. However, close_files() assumes that the files_struct
will be discarded thereafter, so it does not reset ->fd_open->fd_bits[] bits,
does not adjust ->next_fd field, and does not use rcu_assign_pointer(). And
then, even if we adjust, we'll have to watch future differences between
sys_close() and close_files(), so using sys_close() is more future-proof.

Besides, cr_scan_fds() is used by the checkpoint logic already, so it's easy
to reuse for restart as well.

Oren.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ