linux/fs/freevxfs
David Windsor e9a0561b7c vxfs: Define usercopy region in vxfs_inode slab cache
vxfs symlink pathnames, stored in struct vxfs_inode_info field
vii_immed.vi_immed and therefore contained in the vxfs_inode slab cache,
need to be copied to/from userspace.

cache object allocation:
    fs/freevxfs/vxfs_super.c:
        vxfs_alloc_inode(...):
            ...
            vi = kmem_cache_alloc(vxfs_inode_cachep, GFP_KERNEL);
            ...
            return &vi->vfs_inode;

    fs/freevxfs/vxfs_inode.c:
        cxfs_iget(...):
            ...
            inode->i_link = vip->vii_immed.vi_immed;

example usage trace:
    readlink_copy+0x43/0x70
    vfs_readlink+0x62/0x110
    SyS_readlinkat+0x100/0x130

    fs/namei.c:
        readlink_copy(..., link):
            ...
            copy_to_user(..., link, len);

        (inlined in vfs_readlink)
        generic_readlink(dentry, ...):
            struct inode *inode = d_inode(dentry);
            const char *link = inode->i_link;
            ...
            readlink_copy(..., link);

In support of usercopy hardening, this patch defines a region in the
vxfs_inode slab cache in which userspace copy operations are allowed.

This region is known as the slab cache's usercopy region. Slab caches
can now check that each dynamically sized copy operation involving
cache-managed memory falls entirely within the slab's usercopy region.

This patch is modified from Brad Spengler/PaX Team's PAX_USERCOPY
whitelisting code in the last public patch of grsecurity/PaX based on my
understanding of the code. Changes or omissions from the original code are
mine and don't reflect the original grsecurity/PaX code.

Signed-off-by: David Windsor <dave@nullcore.net>
[kees: adjust commit log, provide usage trace]
Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
2018-01-15 12:07:57 -08:00
..
Kconfig freevxfs: update Kconfig information 2016-06-13 10:20:39 +02:00
Makefile
vxfs.h freevxfs: update documentation and cresdits for HP-UX support 2016-06-01 09:27:33 +02:00
vxfs_bmap.c freevxfs: handle big endian HP-UX file systems 2016-06-01 09:01:28 +02:00
vxfs_dir.h freevxfs: handle big endian HP-UX file systems 2016-06-01 09:01:28 +02:00
vxfs_extern.h freevxfs: implement ->alloc_inode and ->destroy_inode 2016-06-01 09:23:24 +02:00
vxfs_fshead.c freevxfs: fix memory leak in vxfs_read_fshead() 2016-06-12 19:27:31 +02:00
vxfs_fshead.h freevxfs: update documentation and cresdits for HP-UX support 2016-06-01 09:27:33 +02:00
vxfs_immed.c mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
vxfs_inode.c freevxfs: update documentation and cresdits for HP-UX support 2016-06-01 09:27:33 +02:00
vxfs_inode.h freevxfs: update documentation and cresdits for HP-UX support 2016-06-01 09:27:33 +02:00
vxfs_lookup.c freevxfs: refactor readdir and lookup code 2016-06-12 19:35:17 +02:00
vxfs_olt.c freevxfs: handle big endian HP-UX file systems 2016-06-01 09:01:28 +02:00
vxfs_olt.h freevxfs: handle big endian HP-UX file systems 2016-06-01 09:01:28 +02:00
vxfs_subr.c mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
vxfs_super.c vxfs: Define usercopy region in vxfs_inode slab cache 2018-01-15 12:07:57 -08:00