Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1604294

Re: xfs: verify inline directory data forks

Path csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod
From Geert Uytterhoeven <geert@linux-m68k.org>
Newsgroups linux.kernel
Subject Re: xfs: verify inline directory data forks
Date Mon, 20 Mar 2017 10:50:01 +0100
Message-ID <tn26R-2MC-3@gated-at.bofh.it> (permalink)
References <tn26R-2MC-5@gated-at.bofh.it>
X-Original-To "Darrick J. Wong" <darrick.wong@oracle.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=8bkg6CnIrrSNL3NeYOtIfLcYAp6+LHZ5MxRZTYV2Xw8=; b=qol3AZJrfEqvAhGOK01LyyVRRkFZ+yDm9uuws32J57nKg/wYk6czkg1HYos1QL9duQ 99EzI9OxBc/WZRmA9lXdIfQhAWe3FxBc+CjhnuBL4TXH/+BWiOlr7Ym733Z2rjb/tCaH LCrg/cMWHNUqtHxhDaCtBE9JwDv2AdmX6CfKhBYx64iw6XCxf0+2u0Ziij+zN8YCDLs6 EBixs+2BIKMOROI2Deu/SiJzIS0Xx4eu0MAwZZf8V+gG35wfK061xYZN9rgqh7m0+qzr lmHpqTA8FZpVo+WzbdczSDMUzR9dPrxjQEdUMZwISQHjaDS6x48FoV7ALUi4pU11KpAa FuZw==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=8bkg6CnIrrSNL3NeYOtIfLcYAp6+LHZ5MxRZTYV2Xw8=; b=Lkm4uvTXoiNSIA22PU482LUdHCVrBW5sf9z+V4E2mOnz2t1xhUkiFCgitCUGA6ijUA tYkgJz4KBk6XFcUFHCtbEKN4wtIX4NiYYKS7qSAzm78+UolG+aPuCxxntUKodzTipp5z vRDKDQAwF9nShibpuma4yDHIMgLy/ImzVAPPlhA+eT0575MTAAcBfLjE8udZKypCZSQD ZfQ5tG6W3Xpq7vmHVXg+W7VA2uEfzsGSDocy5sZ2r+GwyR4BJ7gdOwpLTfWl/Z4FaEKA 845qYV4hT9+IQdio/XqU3ahQw1l9/HrWbLGYj211BTVghrHlXeui8SmRgDyKdZe07n7j oy6g==
X-Gm-Message-State AFeK/H0tfCTu592iYxUboMzBwhi5YvXpgcX/I8ebvic3NvFj7gh9s8s2zs9nmx5uA+i1KVF5ErPOBqF/Q6po8Q==
X-Received by 10.107.14.69 with SMTP id 66mr29210797ioo.88.1490002877731; Mon, 20 Mar 2017 02:41:17 -0700 (PDT)
MIME-Version 1.0
X-Google-Sender-Auth 7PGTIOqCwfm0YSRJLBa5Zjg8u_Y
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 62
Organization linux.* mail to news gateway
X-Original-Cc linux-xfs@vger.kernel.org, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, Christoph Hellwig <hch@infradead.org>
X-Original-Date Mon, 20 Mar 2017 10:41:16 +0100
X-Original-Message-ID <CAMuHMdVpE2efAMNZzPs37jVnCWJz-jQqGPEhVx+8VFUNg+4yTg@mail.gmail.com>
X-Original-References <20170316193540.CF2E5660939@gitolite.kernel.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1604294

Show key headers only | View raw


On Thu, Mar 16, 2017 at 8:35 PM, Linux Kernel Mailing List
<linux-kernel@vger.kernel.org> wrote:
> Web:        https://git.kernel.org/torvalds/c/630a04e79dd41ff746b545d4fc052e0abb836120
> Commit:     630a04e79dd41ff746b545d4fc052e0abb836120
> Parent:     2fcc319d2467a5f5b78f35f79fd6e22741a31b1e
> Refname:    refs/heads/master
> Author:     Darrick J. Wong <darrick.wong@oracle.com>
> AuthorDate: Wed Mar 15 00:24:25 2017 -0700
> Committer:  Darrick J. Wong <darrick.wong@oracle.com>
> CommitDate: Wed Mar 15 00:24:25 2017 -0700
>
>     xfs: verify inline directory data forks
>
>     When we're reading or writing the data fork of an inline directory,
>     check the contents to make sure we're not overflowing buffers or eating
>     garbage data.  xfs/348 corrupts an inline symlink into an inline
>     directory, triggering a buffer overflow bug.
>
>     Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
>     Reviewed-by: Brian Foster <bfoster@redhat.com>

> --- a/fs/xfs/libxfs/xfs_dir2_sf.c
> +++ b/fs/xfs/libxfs/xfs_dir2_sf.c

> +/* Verify the consistency of an inline directory. */
> +int
> +xfs_dir2_sf_verify(
> +       struct xfs_mount                *mp,
> +       struct xfs_dir2_sf_hdr          *sfp,
> +       int                             size)
> +{

> +               /* Don't allow names with known bad length. */
> +               XFS_WANT_CORRUPTED_RETURN(mp, sfep->namelen > 0);
> +               XFS_WANT_CORRUPTED_RETURN(mp, sfep->namelen < MAXNAMELEN);

With gcc 4.1.2:

fs/xfs/libxfs/xfs_dir2_sf.c: In function ‘xfs_dir2_sf_verify’:
fs/xfs/libxfs/xfs_dir2_sf.c:680: warning: comparison is always true
due to limited range of data type

As sfep->namelen is __u8, and MAXNAMELEN = 256, none of the two checks
above can be true.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: xfs: verify inline directory data forks Geert Uytterhoeven <geert@linux-m68k.org> - 2017-03-20 10:50 +0100

csiph-web