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: <e25e5a42-159c-6bad-4f14-d70461a78b72@virtuozzo.com>
Date:   Fri, 8 May 2020 09:07:59 +0300
From:   Vasily Averin <vvs@...tuozzo.com>
To:     Matthew Wilcox <willy@...radead.org>,
        Andrew Morton <akpm@...ux-foundation.org>
Cc:     linux-kernel@...r.kernel.org, Waiman Long <longman@...hat.com>,
        Andreas Schwab <schwab@...e.de>
Subject: Re: [PATCH] ipc/util.c: sysvipc_find_ipc() incorrectly updates
 position index

On 5/8/20 6:36 AM, Matthew Wilcox wrote:
> On Thu, May 07, 2020 at 05:02:42PM -0700, Andrew Morton wrote:
>> Here's how I resolved things.  Please check?
>>
>> static struct kern_ipc_perm *sysvipc_find_ipc(struct ipc_ids *ids, loff_t pos,
>> 					      loff_t *new_pos)
>> {
>> 	unsigned long index = pos;
>> 	struct kern_ipc_perm *ipc;
>>
>> 	rcu_read_lock();
>> 	ipc = xa_find(&ids->ipcs, &index, ULONG_MAX, XA_PRESENT);
>> 	if (ipc)
>> 		ipc_lock_object(ipc);
>> 	else
>> 		rcu_read_unlock();
>> 	*new_pos = pos + 1;
>> 	return ipc;
>> }
> 
> Surely that should be '*new_pos = index + 1'?  Or did I misunderstand
> the reasoning behind the other patch?

I'm not sure however it looks like xa_find() can return index < pos
xa_find in our case will call xas_find_marked() that have following description

 * If no marked entry is found and the array is smaller than @max, @xas is
 * set to the bounds state and xas->xa_index is set to the smallest index
 * not yet in the array.  This allows @xas to be immediately passed to
 * xas_store().

Matthew, could you please clarify this question?

Thank you,
	Vasily Averin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ