19 Sep, 2020

1 commit


24 Jun, 2020

1 commit


30 Aug, 2019

1 commit

  • Fill in the appropriate limits to avoid inconsistencies
    in the vfs cached inode times when timestamps are
    outside the permitted range.

    Even though some filesystems are read-only, fill in the
    timestamps to reflect the on-disk representation.

    Signed-off-by: Deepa Dinamani
    Reviewed-by: Darrick J. Wong
    Acked-By: Tigran Aivazian
    Acked-by: Jeff Layton
    Cc: aivazian.tigran@gmail.com
    Cc: al@alarsen.net
    Cc: coda@cs.cmu.edu
    Cc: darrick.wong@oracle.com
    Cc: dushistov@mail.ru
    Cc: dwmw2@infradead.org
    Cc: hch@infradead.org
    Cc: jack@suse.com
    Cc: jaharkes@cs.cmu.edu
    Cc: luisbg@kernel.org
    Cc: nico@fluxnic.net
    Cc: phillip@squashfs.org.uk
    Cc: richard@nod.at
    Cc: salah.triki@gmail.com
    Cc: shaggy@kernel.org
    Cc: linux-xfs@vger.kernel.org
    Cc: codalist@coda.cs.cmu.edu
    Cc: linux-ext4@vger.kernel.org
    Cc: linux-mtd@lists.infradead.org
    Cc: jfs-discussion@lists.sourceforge.net
    Cc: reiserfs-devel@vger.kernel.org

    Deepa Dinamani
     

21 May, 2019

2 commits


02 May, 2019

1 commit


16 Jun, 2018

1 commit


22 May, 2018

1 commit


16 Jan, 2018

1 commit

  • befs symlink pathnames, stored in struct befs_inode_info.i_data.symlink
    and therefore contained in the befs_inode_cache slab cache, need to be
    copied to/from userspace.

    cache object allocation:
    fs/befs/linuxvfs.c:
    befs_alloc_inode(...):
    ...
    bi = kmem_cache_alloc(befs_inode_cachep, GFP_KERNEL);
    ...
    return &bi->vfs_inode;

    befs_iget(...):
    ...
    strlcpy(befs_ino->i_data.symlink, raw_inode->data.symlink,
    BEFS_SYMLINK_LEN);
    ...
    inode->i_link = befs_ino->i_data.symlink;

    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
    befs_inode_cache 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
    [kees: adjust commit log, provide usage trace]
    Cc: Luis de Bethencourt
    Cc: Salah Triki
    Signed-off-by: Kees Cook
    Acked-by: Luis de Bethencourt

    David Windsor
     

28 Nov, 2017

1 commit

  • This is a pure automated search-and-replace of the internal kernel
    superblock flags.

    The s_flags are now called SB_*, with the names and the values for the
    moment mirroring the MS_* flags that they're equivalent to.

    Note how the MS_xyz flags are the ones passed to the mount system call,
    while the SB_xyz flags are what we then use in sb->s_flags.

    The script to do this was:

    # places to look in; re security/*: it generally should *not* be
    # touched (that stuff parses mount(2) arguments directly), but
    # there are two places where we really deal with superblock flags.
    FILES="drivers/mtd drivers/staging/lustre fs ipc mm \
    include/linux/fs.h include/uapi/linux/bfs_fs.h \
    security/apparmor/apparmorfs.c security/apparmor/include/lib.h"
    # the list of MS_... constants
    SYMS="RDONLY NOSUID NODEV NOEXEC SYNCHRONOUS REMOUNT MANDLOCK \
    DIRSYNC NOATIME NODIRATIME BIND MOVE REC VERBOSE SILENT \
    POSIXACL UNBINDABLE PRIVATE SLAVE SHARED RELATIME KERNMOUNT \
    I_VERSION STRICTATIME LAZYTIME SUBMOUNT NOREMOTELOCK NOSEC BORN \
    ACTIVE NOUSER"

    SED_PROG=
    for i in $SYMS; do SED_PROG="$SED_PROG -e s/MS_$i/SB_$i/g"; done

    # we want files that contain at least one of MS_...,
    # with fs/namespace.c and fs/pnode.c excluded.
    L=$(for i in $SYMS; do git grep -w -l MS_$i $FILES; done| sort|uniq|grep -v '^fs/namespace.c'|grep -v '^fs/pnode.c')

    for f in $L; do sed -i $f $SED_PROG; done

    Requested-by: Al Viro
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

17 Jul, 2017

1 commit

  • Firstly by applying the following with coccinelle's spatch:

    @@ expression SB; @@
    -SB->s_flags & MS_RDONLY
    +sb_rdonly(SB)

    to effect the conversion to sb_rdonly(sb), then by applying:

    @@ expression A, SB; @@
    (
    -(!sb_rdonly(SB)) && A
    +!sb_rdonly(SB) && A
    |
    -A != (sb_rdonly(SB))
    +A != sb_rdonly(SB)
    |
    -A == (sb_rdonly(SB))
    +A == sb_rdonly(SB)
    |
    -!(sb_rdonly(SB))
    +!sb_rdonly(SB)
    |
    -A && (sb_rdonly(SB))
    +A && sb_rdonly(SB)
    |
    -A || (sb_rdonly(SB))
    +A || sb_rdonly(SB)
    |
    -(sb_rdonly(SB)) != A
    +sb_rdonly(SB) != A
    |
    -(sb_rdonly(SB)) == A
    +sb_rdonly(SB) == A
    |
    -(sb_rdonly(SB)) && A
    +sb_rdonly(SB) && A
    |
    -(sb_rdonly(SB)) || A
    +sb_rdonly(SB) || A
    )

    @@ expression A, B, SB; @@
    (
    -(sb_rdonly(SB)) ? 1 : 0
    +sb_rdonly(SB)
    |
    -(sb_rdonly(SB)) ? A : B
    +sb_rdonly(SB) ? A : B
    )

    to remove left over excess bracketage and finally by applying:

    @@ expression A, SB; @@
    (
    -(A & MS_RDONLY) != sb_rdonly(SB)
    +(bool)(A & MS_RDONLY) != sb_rdonly(SB)
    |
    -(A & MS_RDONLY) == sb_rdonly(SB)
    +(bool)(A & MS_RDONLY) == sb_rdonly(SB)
    )

    to make comparisons against the result of sb_rdonly() (which is a bool)
    work correctly.

    Signed-off-by: David Howells

    David Howells
     

16 Jul, 2017

1 commit

  • Pull ->s_options removal from Al Viro:
    "Preparations for fsmount/fsopen stuff (coming next cycle). Everything
    gets moved to explicit ->show_options(), killing ->s_options off +
    some cosmetic bits around fs/namespace.c and friends. Basically, the
    stuff needed to work with fsmount series with minimum of conflicts
    with other work.

    It's not strictly required for this merge window, but it would reduce
    the PITA during the coming cycle, so it would be nice to have those
    bits and pieces out of the way"

    * 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    isofs: Fix isofs_show_options()
    VFS: Kill off s_options and helpers
    orangefs: Implement show_options
    9p: Implement show_options
    isofs: Implement show_options
    afs: Implement show_options
    affs: Implement show_options
    befs: Implement show_options
    spufs: Implement show_options
    bpf: Implement show_options
    ramfs: Implement show_options
    pstore: Implement show_options
    omfs: Implement show_options
    hugetlbfs: Implement show_options
    VFS: Don't use save/replace_mount_options if not using generic_show_options
    VFS: Provide empty name qstr
    VFS: Make get_filesystem() return the affected filesystem
    VFS: Clean up whitespace in fs/namespace.c and fs/super.c
    Provide a function to create a NUL-terminated string from unterminated data

    Linus Torvalds
     

11 Jul, 2017

1 commit

  • Implement the show_options superblock op for befs as part of a bid to get
    rid of s_options and generic_show_options() to make it easier to implement
    a context-based mount where the mount options can be passed individually
    over a file descriptor.

    Signed-off-by: David Howells
    cc: Luis de Bethencourt
    cc: Salah Triki
    Signed-off-by: Al Viro

    David Howells
     

09 Jul, 2017

1 commit


05 May, 2017

1 commit

  • based on commit b3b42c0deaa1
    ("fs/affs: make export work with cold dcache")

    This adds get_parent function so that nfs client can still work after
    cache drop (Tested on NFS v4 with echo 3 > /proc/sys/vm/drop_caches)

    Signed-off-by: Fabian Frederick
    Signed-off-by: Luis de Bethencourt

    Fabian Frederick
     

02 Mar, 2017

1 commit


22 Dec, 2016

9 commits

  • Implement mandatory export_operations, so it is possible to export befs via
    nfs.

    Signed-off-by: Luis de Bethencourt

    Luis de Bethencourt
     
  • Removing all trailing whitespaces in befs.

    I was skeptic about tainting the history with this, but whitespace changes
    can be ignored by using 'git blame -w' and 'git log -w'.

    Signed-off-by: Luis de Bethencourt

    Luis de Bethencourt
     
  • No idea why some comments have signatures. These predate git. Removing them
    since they add noise and no information.

    Signed-off-by: Luis de Bethencourt

    Luis de Bethencourt
     
  • Fixing checkpatch.pl issues in befs header files:
    WARNING: Missing a blank line after declarations
    + befs_inode_addr iaddr;
    + iaddr.allocation_group = blockno >> BEFS_SB(sb)->ag_shift;

    WARNING: space prohibited between function name and open parenthesis '('
    + return BEFS_SB(sb)->block_size / sizeof (befs_disk_inode_addr);

    ERROR: "foo * bar" should be "foo *bar"
    + const char *key, befs_off_t * value);

    ERROR: Macros with complex values should be enclosed in parentheses
    +#define PACKED __attribute__ ((__packed__))

    Signed-off-by: Luis de Bethencourt

    Luis de Bethencourt
     
  • Fix the following type of checkpatch.pl issues:
    WARNING: line over 80 characters
    +static struct dentry *befs_lookup(struct inode *, struct dentry *, unsigned int);

    ERROR: code indent should use tabs where possible
    + if (!bi)$

    WARNING: please, no spaces at the start of a line
    + if (!bi)$

    WARNING: labels should not be indented
    + unacquire_bh:

    WARNING: space prohibited between function name and open parenthesis '('
    + sizeof (struct befs_inode_info),

    WARNING: braces {} are not necessary for single statement blocks
    + if (!*out) {
    + return -ENOMEM;
    + }

    WARNING: Block comments use a trailing */ on a separate line
    + * in special cases */

    WARNING: Missing a blank line after declarations
    + int token;
    + if (!*p)

    ERROR: do not use assignment in if condition
    + if (!(bh = sb_bread(sb, sb_block))) {

    ERROR: space prohibited after that open parenthesis '('
    + if( befs_sb->num_blocks > ~((sector_t)0) ) {

    ERROR: space prohibited before that close parenthesis ')'
    + if( befs_sb->num_blocks > ~((sector_t)0) ) {

    ERROR: space required before the open parenthesis '('
    + if( befs_sb->num_blocks > ~((sector_t)0) ) {

    Signed-off-by: Luis de Bethencourt

    Luis de Bethencourt
     
  • Signed-off-by: Luis de Bethencourt

    Luis de Bethencourt
     
  • Fixing the two following checkpatch.pl issues:
    ERROR: trailing whitespace
    + * Based on portions of file.c and inode.c $

    WARNING: labels should not be indented
    + error:

    Signed-off-by: Luis de Bethencourt

    Luis de Bethencourt
     
  • Fixing the following checkpatch.pl errors and warning:
    ERROR: trailing whitespace
    + * $

    WARNING: Block comments use * on subsequent lines
    +/*
    + Validates the correctness of the befs inode

    ERROR: "foo * bar" should be "foo *bar"
    +befs_check_inode(struct super_block *sb, befs_inode * raw_inode,

    Signed-off-by: Luis de Bethencourt

    Luis de Bethencourt
     
  • Fix all checkpatch.pl errors and warnings in debug.c:
    ERROR: trailing whitespace
    + * $

    WARNING: Missing a blank line after declarations
    + va_list args;
    + va_start(args, fmt);

    ERROR: "foo * bar" should be "foo *bar"
    +befs_dump_inode(const struct super_block *sb, befs_inode * inode)

    ERROR: "foo * bar" should be "foo *bar"
    +befs_dump_super_block(const struct super_block *sb, befs_super_block * sup)

    ERROR: "foo * bar" should be "foo *bar"
    +befs_dump_small_data(const struct super_block *sb, befs_small_data * sd)

    WARNING: line over 80 characters
    +befs_dump_index_entry(const struct super_block *sb, befs_disk_btree_super * super)

    ERROR: "foo * bar" should be "foo *bar"
    +befs_dump_index_entry(const struct super_block *sb, befs_disk_btree_super * super)

    ERROR: "foo * bar" should be "foo *bar"
    +befs_dump_index_node(const struct super_block *sb, befs_btree_nodehead * node)

    Signed-off-by: Luis de Bethencourt

    Luis de Bethencourt
     

16 Oct, 2016

1 commit

  • Pull befs fixes from Luis de Bethencourt:
    "I recently took maintainership of the befs file system [0]. This is
    the first time I send you a git pull request, so please let me know if
    all the below is OK.

    Salah Triki and myself have been cleaning the code and fixing a few
    small bugs.

    Sorry I couldn't send this sooner in the merge window, I was waiting
    to have my GPG key signed by kernel members at ELCE in Berlin a few
    days ago."

    [0] https://lkml.org/lkml/2016/7/27/502

    * tag 'befs-v4.9-rc1' of git://github.com/luisbg/linux-befs: (39 commits)
    befs: befs: fix style issues in datastream.c
    befs: improve documentation in datastream.c
    befs: fix typos in datastream.c
    befs: fix typos in btree.c
    befs: fix style issues in super.c
    befs: fix comment style
    befs: add check for ag_shift in superblock
    befs: dump inode_size superblock information
    befs: remove unnecessary initialization
    befs: fix typo in befs_sb_info
    befs: add flags field to validate superblock state
    befs: fix typo in befs_find_key
    befs: remove unused BEFS_BT_PARMATCH
    fs: befs: remove ret variable
    fs: befs: remove in vain variable assignment
    fs: befs: remove unnecessary *befs_sb variable
    fs: befs: remove useless initialization to zero
    fs: befs: remove in vain variable assignment
    fs: befs: Insert NULL inode to dentry
    fs: befs: Remove useless calls to brelse in befs_find_brun_dblindirect
    ...

    Linus Torvalds
     

08 Oct, 2016

13 commits

  • Fixing the following checkpatch.pl errors:

    ERROR: "foo * bar" should be "foo *bar"
    + befs_blocknr_t blockno, befs_block_run * run);

    WARNING: Missing a blank line after declarations
    + struct buffer_head *bh;
    + befs_debug(sb, "---> %s length: %llu", __func__, len);

    WARNING: Block comments use * on subsequent lines
    + /*
    + Double indir block, plus all the indirect blocks it maps.

    (and other instances of these)

    Signed-off-by: Luis de Bethencourt
    Signed-off-by: Salah Triki

    Luis de Bethencourt
     
  • Convert function descriptions to kernel-doc style.

    Signed-off-by: Luis de Bethencourt
    Signed-off-by: Salah Triki

    Luis de Bethencourt
     
  • Signed-off-by: Luis de Bethencourt
    Signed-off-by: Salah Triki

    Luis de Bethencourt
     
  • Fixing typos in kernel-doc function descriptions in fs/befs/btree.c.

    Signed-off-by: Luis de Bethencourt
    Signed-off-by: Salah Triki

    Luis de Bethencourt
     
  • Fixing the following checkpatch.pl error:

    ERROR: "foo * bar" should be "foo *bar"
    +befs_load_sb(struct super_block *sb, befs_super_block * disk_sb)

    And the following warnings:

    WARNING: suspect code indent for conditional statements (8, 12)
    + if (disk_sb->fs_byte_order == BEFS_BYTEORDER_NATIVE_LE)
    + befs_sb->byte_order = BEFS_BYTESEX_LE;

    WARNING: suspect code indent for conditional statements (8, 12)
    + else if (disk_sb->fs_byte_order == BEFS_BYTEORDER_NATIVE_BE)
    + befs_sb->byte_order = BEFS_BYTESEX_BE;

    WARNING: break quoted strings at a space character
    + befs_error(sb, "blocksize(%u) cannot be larger"
    + "than system pagesize(%lu)", befs_sb->block_size,

    WARNING: line over 80 characters
    + if (befs_sb->log_start != befs_sb->log_end || befs_sb->flags == BEFS_DIRTY) {

    Signed-off-by: Luis de Bethencourt
    Signed-off-by: Salah Triki

    Luis de Bethencourt
     
  • The description of befs_load_sb was confusing the kernel-doc system since,
    because it starts with /**, it thinks it will document the function with
    kernel-doc formatting. Which it isn't.

    Fix other comment style issues in the file while we are at it.

    Signed-off-by: Luis de Bethencourt
    Signed-off-by: Salah Triki

    Luis de Bethencourt
     
  • ag_shift and blocks_per_ag contain the same information in different ways,
    same as block_shift and block_size do. It is worth checking this two are
    consistent, but since blocks_per_ag isn't documented as mandatory to use
    some implementations of befs don't enforce this, so making it non-fatal if
    they don't match and just having it as a warning.

    Signed-off-by: Luis de Bethencourt
    Signed-off-by: Salah Triki

    Luis de Bethencourt
     
  • befs_dump_super_block() wasn't giving the inode_size information when
    dumping all elements of the superblock. Add this element to have complete
    information of the superblock.

    Signed-off-by: Luis de Bethencourt
    Signed-off-by: Salah Triki

    Luis de Bethencourt
     
  • There is no need to init block, since it will be overwitten later by
    iaddr2blockno().

    Signed-off-by: Salah Triki
    Signed-off-by: Luis de Bethencourt

    Salah Triki
     
  • Fixing jornal to Journal.

    Signed-off-by: Salah Triki
    Signed-off-by: Luis de Bethencourt

    Salah Triki
     
  • For validating superblock state, add flags field to befs_sb_info, read the state from the disk
    and check if it is equal to BEFS_DIRTY.

    Signed-off-by: Salah Triki
    Signed-off-by: Luis de Bethencourt

    Salah Triki
     
  • Fixing skeep to skip.

    Signed-off-by: Luis de Bethencourt
    Signed-off-by: Salah Triki

    Luis de Bethencourt
     
  • befs_btree_find(), the only caller of befs_find_key(), only cares about if
    the return from that function is BEFS_BT_MATCH or not. It never uses the
    partial match given with BEFS_BT_PARMATCH. Make the overflow return clearer
    by having BEFS_BT_OVERFLOW instead of BEFS_BT_PARMATCH.

    Signed-off-by: Luis de Bethencourt
    Signed-off-by: Salah Triki

    Luis de Bethencourt