public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* xfs: validate inode numbers in file handles correctly
@ 2010-06-18  7:32 Dave Chinner
  2010-06-18  7:32 ` [PATCH 1/4] xfs: always use iget in bulkstat Dave Chinner
                   ` (4 more replies)
  0 siblings, 5 replies; 22+ messages in thread
From: Dave Chinner @ 2010-06-18  7:32 UTC (permalink / raw)
  To: xfs; +Cc: security

This series closes a recently discovered problem in XFS filehandle conversion.
On systems where inodes are dynamically deleted, XFS does not adequately verify
the inode numbers in the filehandles, which results in reading stale inodes
from disk and potentially returning them as valid files. Because these unlinked
inodes were never zeroed out when the chunk was deallocated, some inodes in the
chunk can still appear to have to data extents attached to them. This can lead
to stale data exposure, exposure of active data and potentially overwriting of
active data if the stale extents referenced in the unlinked inodes have been
re-allocated.

Both NFS filehandles and local filehandles provided through libhandle have this
same problem. libhandle requires root permissions to use the interface, so it
is not exposing information that you can't get more easily with other means
(e.g. xfs_db or reading directly form the block device), so there isn't really
an issue here.

For NFS, we may incorrectly accept stale file handles for unlinked inodes after
a server reboot if the unlinked inodes have not been overwritten leading to the
above issues being triggered if multiple NFS clients are accessing the some
files.

Christoph's make-bulkstat-coherent patch is the basis for this series as
bulkstat can also expose unlinked inodes and information about them back to
userspace because it makes the same assumptions about inode lookups as the file
handle interfaces.

As a result, the first two patches of the series make up the real bug fix. The
last two patches make it clear we are looking up untrusted inode numbers and
remove a shortcut that these interfaces used that we do not want used any
more. Hence for backports to other kernels, only the first two patches are
necessary.

More information and the test program that demonstrates the issue via the
open_by_handle interface can be found here:

http://oss.sgi.com/archives/xfs/2010-06/msg00191.html

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 22+ messages in thread
* [PATCH 0/4, V2] xfs: validate inode numbers in file handles correctly
@ 2010-06-20 23:58 Dave Chinner
  2010-06-20 23:58 ` [PATCH 1/4] xfs: always use iget in bulkstat Dave Chinner
  0 siblings, 1 reply; 22+ messages in thread
From: Dave Chinner @ 2010-06-20 23:58 UTC (permalink / raw)
  To: xfs; +Cc: security

This series closes a recently discovered problem in XFS filehandle conversion.
On systems where inodes are dynamically deleted, XFS does not adequately verify
the inode numbers in the filehandles, which results in reading stale inodes
from disk and potentially returning them as valid files. Because these unlinked
inodes were never zeroed out when the chunk was deallocated, some inodes in the
chunk can still appear to have to data extents attached to them. This can lead
to stale data exposure, exposure of active data and potentially overwriting of
active data if the stale extents referenced in the unlinked inodes have been
re-allocated.

Both NFS filehandles and local filehandles provided through libhandle have this
same problem. libhandle requires root permissions to use the interface, so it
is not exposing information that you can't get more easily with other means
(e.g. xfs_db or reading directly form the block device), so there isn't really
an issue here.

For NFS, we may incorrectly accept stale file handles for unlinked inodes after
a server reboot if the unlinked inodes have not been overwritten leading to the
above issues being triggered if multiple NFS clients are accessing the same
files.

Christoph's make-bulkstat-coherent patch is the basis for this series as
bulkstat can also expose unlinked inodes and information about them back to
userspace as it makes the same assumptions about inode lookups as the file
handle interfaces.

As a result, the first two patches of the series make up the real bug fix. The
last two patches make it clear we are lookuping up untrusted inode numbers and
clear away a shortcut that these interfaces used that we do not want used any
more.  Hence for backports to other kernels, only the first two patches are
necessary.

The test program that demonstrates the issue via the open_by_handle interface
can be found here:

http://oss.sgi.com/archives/xfs/2010-06/msg00191.html

Version 2:
- removed useless ip->i_imap.im_blkno initialisation in xfs_iread()
- reworked a comment refering to bulkstat when it should refer to untrusted
  inodes.
- removed typedefs from xfs_imap_lookup()
- killed useless error logging from xfs_imap_lookup()
- rearranged the logic flow of xfs_imap_lookup() to remove the gotos.


_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2012-02-01  5:47 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-18  7:32 xfs: validate inode numbers in file handles correctly Dave Chinner
2010-06-18  7:32 ` [PATCH 1/4] xfs: always use iget in bulkstat Dave Chinner
2010-06-18  7:32 ` [PATCH 2/4] xfs: validate untrusted inode numbers during lookup Dave Chinner
2010-06-18 11:41   ` Christoph Hellwig
2010-06-19  0:07     ` Dave Chinner
2010-06-18  7:32 ` [PATCH 3/4] xfs: rename XFS_IGET_BULKSTAT to XFS_IGET_UNTRUSTED Dave Chinner
2010-06-18 11:42   ` Christoph Hellwig
2010-06-18  7:32 ` [PATCH 4/4] xfs: remove block number from inode lookup code Dave Chinner
2010-06-18  8:22   ` Christoph Hellwig
2011-11-23 13:04 ` xfs: validate inode numbers in file handles correctly Guoquan Yang
2011-11-23 14:30   ` Christoph Hellwig
     [not found]     ` <SNT135-W7F5C64C2A3F67B48EFF3AA4CE0@phx.gbl>
2011-11-24 12:52       ` Christoph Hellwig
2011-11-28 11:19     ` Christoph Hellwig
2011-12-03  8:27       ` hank peng
2011-12-06 15:17         ` Christoph Hellwig
2011-12-03  9:56       ` yangguoquan
2011-12-29  9:19         ` xfs: validate inode numbers in file handles correctly--NFS Stale File Handle Again yangguoquan
2012-01-02 15:02           ` Christoph Hellwig
2012-01-04  2:20             ` yangguoquan
2012-01-24 17:58               ` Christoph Hellwig
2012-02-01  5:46                 ` yangguoquan
  -- strict thread matches above, loose matches on Subject: below --
2010-06-20 23:58 [PATCH 0/4, V2] xfs: validate inode numbers in file handles correctly Dave Chinner
2010-06-20 23:58 ` [PATCH 1/4] xfs: always use iget in bulkstat Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox