From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755105AbbE1Vkl (ORCPT ); Thu, 28 May 2015 17:40:41 -0400 Received: from mail-vn0-f51.google.com ([209.85.216.51]:45831 "EHLO mail-vn0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755069AbbE1Vki convert rfc822-to-8bit (ORCPT ); Thu, 28 May 2015 17:40:38 -0400 MIME-Version: 1.0 In-Reply-To: References: <8d601ee8babe5239b7926542c713c58502b15e35.1429868795.git.agruenba@redhat.com> <20150528203332.GD31663@fieldses.org> Date: Thu, 28 May 2015 17:40:37 -0400 Message-ID: Subject: Re: [RFC v3 36/45] NFSv4: Fix GETATTR bitmap verification From: Trond Myklebust To: =?UTF-8?Q?Andreas_Gr=C3=BCnbacher?= Cc: "J. Bruce Fields" , Linux Kernel Mailing List , Linux FS-devel Mailing List , Linux NFS Mailing List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 28, 2015 at 5:05 PM, Andreas Grünbacher wrote: > 2015-05-28 22:50 GMT+02:00 Trond Myklebust : >> On Thu, May 28, 2015 at 4:33 PM, J. Bruce Fields wrote: >>> On Fri, Apr 24, 2015 at 01:04:33PM +0200, Andreas Gruenbacher wrote: >>>> The NFSv4 client sends the server GETATTR requests with different sets of >>>> requested attributes depending on the situation. The requested set of >>>> attributes is encoded in a bitmap; the server replies with the set of >>>> attributes it could return. These bitmaps can be several words wide. The >>>> bitmap returned by the server is a subset of the bitmap sent by the client. >>>> >>>> While decoding the reply, the client tries to verify the reply bitmap: it >>>> checks if any previous, unexpected attributes are left in the same word of the >>>> bitmap for each attribute it tries to decode, then it clears the current >>>> attribute's bit in the bitmap for the next decode function. >>>> >>>> The client fails to detect when unexpected attributes are sent after the last >>>> expected attribute in each word in the bitmap. >>> >>> Is it important that the client catch that? >> >> Right. What is the actual problem or bug that this patch is trying to >> fix? Why do we care if a buggy server sends us extra info that we >> didn't ask for? > > I think we do care to correctly decode (and reject) well-formed but illegal > server replies. In this case, when switching to the next word of a bitmap, the > client doesn't check if the previous word has been completely "consumed" yet. > If any attributes are "missed", decoding the attribute values gets out of sync, > garbage is decoded, and the error may be missed. > We already do this kind of check with the existing code. What's wrong with it? Trond From mboxrd@z Thu Jan 1 00:00:00 1970 From: Trond Myklebust Subject: Re: [RFC v3 36/45] NFSv4: Fix GETATTR bitmap verification Date: Thu, 28 May 2015 17:40:37 -0400 Message-ID: References: <8d601ee8babe5239b7926542c713c58502b15e35.1429868795.git.agruenba@redhat.com> <20150528203332.GD31663@fieldses.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: "J. Bruce Fields" , Linux Kernel Mailing List , Linux FS-devel Mailing List , Linux NFS Mailing List To: =?UTF-8?Q?Andreas_Gr=C3=BCnbacher?= Return-path: In-Reply-To: Sender: linux-nfs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-fsdevel.vger.kernel.org On Thu, May 28, 2015 at 5:05 PM, Andreas Gr=C3=BCnbacher wrote: > 2015-05-28 22:50 GMT+02:00 Trond Myklebust : >> On Thu, May 28, 2015 at 4:33 PM, J. Bruce Fields wrote: >>> On Fri, Apr 24, 2015 at 01:04:33PM +0200, Andreas Gruenbacher wrote= : >>>> The NFSv4 client sends the server GETATTR requests with different = sets of >>>> requested attributes depending on the situation. The requested se= t of >>>> attributes is encoded in a bitmap; the server replies with the set= of >>>> attributes it could return. These bitmaps can be several words wi= de. The >>>> bitmap returned by the server is a subset of the bitmap sent by th= e client. >>>> >>>> While decoding the reply, the client tries to verify the reply bit= map: it >>>> checks if any previous, unexpected attributes are left in the same= word of the >>>> bitmap for each attribute it tries to decode, then it clears the c= urrent >>>> attribute's bit in the bitmap for the next decode function. >>>> >>>> The client fails to detect when unexpected attributes are sent aft= er the last >>>> expected attribute in each word in the bitmap. >>> >>> Is it important that the client catch that? >> >> Right. What is the actual problem or bug that this patch is trying t= o >> fix? Why do we care if a buggy server sends us extra info that we >> didn't ask for? > > I think we do care to correctly decode (and reject) well-formed but i= llegal > server replies. In this case, when switching to the next word of a bi= tmap, the > client doesn't check if the previous word has been completely "consum= ed" yet. > If any attributes are "missed", decoding the attribute values gets ou= t of sync, > garbage is decoded, and the error may be missed. > We already do this kind of check with the existing code. What's wrong w= ith it? Trond -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html