Re: [PATCH] SUNRPC: fix copying of multiple pages in gss_read_proxy_verf()
From: Chuck Lever
Date: Wed Oct 21 2020 - 13:30:44 EST
> On Oct 20, 2020, at 3:16 AM, Martijn de Gouw <martijn.de.gouw@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Hi,
>
> On 20-10-2020 00:04, J. Bruce Fields wrote:
>> On Mon, Oct 19, 2020 at 03:46:39PM +0000, Martijn de Gouw wrote:
>>> Hi
>>>
>>> On 19-10-2020 17:23, J. Bruce Fields wrote:
>>>> On Mon, Oct 19, 2020 at 01:42:27PM +0200, Martijn de Gouw wrote:
>>>>> When the passed token is longer than 4032 bytes, the remaining part
>>>>> of the token must be copied from the rqstp->rq_arg.pages. But the
>>>>> copy must make sure it happens in a consecutive way.
>>>>
>>>> Thanks. Apologies, but I don't immediately see where the copy is
>>>> non-consecutive. What exactly is the bug in the existing code?
>>>
>>> In the first memcpy 'length' bytes are copied from argv->iobase, but
>>> since the header is in front, this never fills the whole first page of
>>> in_token->pages.
>>>
>>> The memcpy in the loop copies the following bytes, but starts writing at
>>> the next page of in_token->pages. This leaves the last bytes of page 0
>>> unwritten.
>>>
>>> Next to that, the remaining data is in page 0 of rqstp->rq_arg.pages,
>>> not page 1.
>>
>> Got it, thanks. Looks like the culprit might be a patch from a year ago
>> from Chuck, 5866efa8cbfb "SUNRPC: Fix svcauth_gss_proxy_init()"? At
>> least, that's the last major patch to touch this code.
It's likely that we didn't have a test scenario at bake-a-thon that
presents large tokens, so that new tail copy logic was never properly
exercised.
> I found this issue when setting up NFSv4 with Active Directory as KDC
> and gssproxy. Users with many groups where not able to access the NFS
> shares, while others could access them just fine. During debugging I
> found that the token was not the same on both sides.
>
> I do not have the HW to setup a rdma version of NFSv4, so I'm unable to
> test if it still works via rdma.
You don't need special HW to get NFS/RDMA with Linux working, though.
Linux now has soft iWARP, and NFS/RDMA works fine with that.
As stated in the patch description for commit 5866efa8cbfb, the original
issue won't appear with Linux clients, because they use TCP to handle
the ACCEPT_SEC_CONTEXT handshake. You'd need to have both Solaris and
RDMA to test it. Maybe we can scrounge something up, but that would only
be enough to ensure that your patch doesn't regress the Solaris NFS/RDMA
with Kerberos setup when using small tokens.
--
Chuck Lever