Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1039432AbdDUMr2 (ORCPT ); Fri, 21 Apr 2017 08:47:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36520 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1038258AbdDUMrX (ORCPT ); Fri, 21 Apr 2017 08:47:23 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8F31F68412 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dhowells@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8F31F68412 Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <18425.1492778504@warthog.procyon.org.uk> References: <18425.1492778504@warthog.procyon.org.uk> Cc: dhowells@redhat.com, "Michael Kerrisk (man-pages)" , lkml , linux-fsdevel , hch@infradead.org Subject: Re: Unchecked flags in statx(2) [Should be fixed before 4.11-final?] MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <18481.1492778840.1@warthog.procyon.org.uk> Date: Fri, 21 Apr 2017 13:47:20 +0100 Message-ID: <18482.1492778840@warthog.procyon.org.uk> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 21 Apr 2017 12:47:22 +0000 (UTC) To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 747 Lines: 32 David Howells wrote: > > Similarly, there appears to be no check for invalid flags in the > > 'flags' argument of statx(). Why is there also not such a check > > there? > > Like this? > > if (mask & STATX__RESERVED) > return -EINVAL; Sorry, I misread. You referred to flags, not mask. There's this in sys_statx: if ((flags & AT_STATX_SYNC_TYPE) == AT_STATX_SYNC_TYPE) return -EINVAL; this in vfs_statx: if ((flags & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT | AT_EMPTY_PATH | KSTAT_QUERY_FLAGS)) != 0) return -EINVAL; and this in vfs_statx_fd: if (query_flags & ~KSTAT_QUERY_FLAGS) return -EINVAL; I don't necessarily agree with that last one, but other people think it should be there. David