1. 21 9月, 2018 1 次提交
  2. 15 8月, 2018 2 次提交
  3. 07 6月, 2018 1 次提交
  4. 18 1月, 2018 1 次提交
  5. 19 10月, 2017 1 次提交
    • E
      fs, fscrypt: add an S_ENCRYPTED inode flag · 2ee6a576
      Eric Biggers 提交于
      Introduce a flag S_ENCRYPTED which can be set in ->i_flags to indicate
      that the inode is encrypted using the fscrypt (fs/crypto/) mechanism.
      
      Checking this flag will give the same information that
      inode->i_sb->s_cop->is_encrypted(inode) currently does, but will be more
      efficient.  This will be useful for adding higher-level helper functions
      for filesystems to use.  For example we'll be able to replace this:
      
      	if (ext4_encrypted_inode(inode)) {
      		ret = fscrypt_get_encryption_info(inode);
      		if (ret)
      			return ret;
      		if (!fscrypt_has_encryption_key(inode))
      			return -ENOKEY;
      	}
      
      with this:
      
      	ret = fscrypt_require_key(inode);
      	if (ret)
      		return ret;
      
      ... since we'll be able to retain the fast path for unencrypted files as
      a single flag check, using an inline function.  This wasn't possible
      before because we'd have had to frequently call through the
      ->i_sb->s_cop->is_encrypted function pointer, even when the encryption
      support was disabled or not being used.
      
      Note: we don't define S_ENCRYPTED to 0 if CONFIG_FS_ENCRYPTION is
      disabled because we want to continue to return an error if an encrypted
      file is accessed without encryption support, rather than pretending that
      it is unencrypted.
      Reviewed-by: NChao Yu <yuchao0@huawei.com>
      Acked-by: NDave Chinner <dchinner@redhat.com>
      Signed-off-by: NEric Biggers <ebiggers@google.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      2ee6a576
  6. 15 7月, 2017 2 次提交
    • X
      ubifs: Massage assert in ubifs_xattr_set() wrt. init_xattrs · d8db5b1c
      Xiaolei Li 提交于
      The inode is not locked in init_xattrs when creating a new inode.
      
      Without this patch, there will occurs assert when booting or creating
      a new file, if the kernel config CONFIG_SECURITY_SMACK is enabled.
      
      Log likes:
      
      UBIFS assert failed in ubifs_xattr_set at 298 (pid 1156)
      CPU: 1 PID: 1156 Comm: ldconfig Tainted: G S 4.12.0-rc1-207440-g1e70b02 #2
      Hardware name: MediaTek MT2712 evaluation board (DT)
      Call trace:
      [<ffff000008088538>] dump_backtrace+0x0/0x238
      [<ffff000008088834>] show_stack+0x14/0x20
      [<ffff0000083d98d4>] dump_stack+0x9c/0xc0
      [<ffff00000835d524>] ubifs_xattr_set+0x374/0x5e0
      [<ffff00000835d7ec>] init_xattrs+0x5c/0xb8
      [<ffff000008385788>] security_inode_init_security+0x110/0x190
      [<ffff00000835e058>] ubifs_init_security+0x30/0x68
      [<ffff00000833ada0>] ubifs_mkdir+0x100/0x200
      [<ffff00000820669c>] vfs_mkdir+0x11c/0x1b8
      [<ffff00000820b73c>] SyS_mkdirat+0x74/0xd0
      [<ffff000008082f8c>] __sys_trace_return+0x0/0x4
      Signed-off-by: NXiaolei Li <xiaolei.li@mediatek.com>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      d8db5b1c
    • R
      ubifs: Correctly evict xattr inodes · 272eda82
      Richard Weinberger 提交于
      UBIFS handles extended attributes just like files, as consequence of
      that, they also have inodes.
      Therefore UBIFS does all the inode machinery also for xattrs. Since new
      inodes have i_nlink of 1, a file or xattr inode will be evicted
      if i_nlink goes down to 0 after an unlink. UBIFS assumes this model also
      for xattrs, which is not correct.
      One can create a file "foo" with xattr "user.test". By reading
      "user.test" an inode will be created, and by deleting "user.test" it
      will get evicted later. The assumption breaks if the file "foo", which
      hosts the xattrs, will be removed. VFS nor UBIFS does not remove each
      xattr via ubifs_xattr_remove(), it just removes the host inode from
      the TNC and all underlying xattr nodes too and the inode will remain
      in the cache and wastes memory.
      
      To solve this problem, remove xattr inodes from the VFS inode cache in
      ubifs_xattr_remove() to make sure that they get evicted.
      
      Fixes: 1e51764a ("UBIFS: add new flash file system")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      272eda82
  7. 09 5月, 2017 2 次提交
  8. 13 12月, 2016 5 次提交
  9. 20 10月, 2016 1 次提交
  10. 03 10月, 2016 1 次提交
    • P
      ubifs: fix host xattr_len when changing xattr · 74e9c700
      Pascal Eberhard 提交于
      When an extended attribute is changed, xattr_len of host inode is
      recalculated. ui->data_len is updated before computation and result
      is wrong. This patch adds a temporary variable to fix computation.
      
      To reproduce the issue:
      
      ~# > a.txt
      ~# attr -s an-attr -V a-value a.txt
      ~# attr -s an-attr -V a-bit-bigger-value a.txt
      
      Now host inode xattr_len is wrong. Forcing dbg_check_filesystem()
      generates the following error:
      
      [  130.620140] UBIFS (ubi0:2): background thread "ubifs_bgt0_2" started, PID 565
      [  131.470790] UBIFS error (ubi0:2 pid 564): check_inodes: inode 646 has xattr size 240, but calculated size is 256
      [  131.481697] UBIFS (ubi0:2): dump of the inode 646 sitting in LEB 29:114688
      [  131.488953]  magic          0x6101831
      [  131.492876]  crc            0x9fce9091
      [  131.496836]  node_type      0 (inode node)
      [  131.501193]  group_type     1 (in node group)
      [  131.505788]  sqnum          9278
      [  131.509191]  len            160
      [  131.512549]  key            (646, inode)
      [  131.516688]  creat_sqnum    9270
      [  131.520133]  size           0
      [  131.523264]  nlink          1
      [  131.526398]  atime          1053025857.0
      [  131.530574]  mtime          1053025857.0
      [  131.534714]  ctime          1053025906.0
      [  131.538849]  uid            0
      [  131.542009]  gid            0
      [  131.545140]  mode           33188
      [  131.548636]  flags          0x1
      [  131.551977]  xattr_cnt      1
      [  131.555108]  xattr_size     240
      [  131.558420]  xattr_names    12
      [  131.561670]  compr_type     0x1
      [  131.564983]  data len       0
      [  131.568125] UBIFS error (ubi0:2 pid 564): dbg_check_filesystem: file-system check failed with error -22
      [  131.578074] CPU: 0 PID: 564 Comm: mount Not tainted 4.4.12-g3639bea54a #24
      [  131.585352] Hardware name: Generic AM33XX (Flattened Device Tree)
      [  131.591918] [<c00151c0>] (unwind_backtrace) from [<c0012acc>] (show_stack+0x10/0x14)
      [  131.600177] [<c0012acc>] (show_stack) from [<c01c950c>] (dbg_check_filesystem+0x464/0x4d0)
      [  131.608934] [<c01c950c>] (dbg_check_filesystem) from [<c019f36c>] (ubifs_mount+0x14f8/0x2130)
      [  131.617991] [<c019f36c>] (ubifs_mount) from [<c00d7088>] (mount_fs+0x14/0x98)
      [  131.625572] [<c00d7088>] (mount_fs) from [<c00ed674>] (vfs_kern_mount+0x4c/0xd4)
      [  131.633435] [<c00ed674>] (vfs_kern_mount) from [<c00efb5c>] (do_mount+0x988/0xb50)
      [  131.641471] [<c00efb5c>] (do_mount) from [<c00f004c>] (SyS_mount+0x74/0xa0)
      [  131.648837] [<c00f004c>] (SyS_mount) from [<c000fe20>] (ret_fast_syscall+0x0/0x3c)
      [  131.665315] UBIFS (ubi0:2): background thread "ubifs_bgt0_2" stops
      Signed-off-by: NPascal Eberhard <pascal.eberhard@gmail.com>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      74e9c700
  11. 24 8月, 2016 1 次提交
  12. 29 7月, 2016 1 次提交
    • B
      ubifs: Make xattr structures static · dfaf8d2a
      Ben Dooks 提交于
      Fix sparse warnings from the use of "struct xattr_handler"
      structures that are not exported by making them static. Fixes
      the following sparse warnings:
      
      /fs/ubifs/xattr.c:595:28: warning: symbol 'ubifs_user_xattr_handler' was not declared. Should it be static?
      /fs/ubifs/xattr.c:601:28: warning: symbol 'ubifs_trusted_xattr_handler' was not declared. Should it be static?
      /fs/ubifs/xattr.c:607:28: warning: symbol 'ubifs_security_xattr_handler' was not declared. Should it be static?
      Signed-off-by: NBen Dooks <ben.dooks@codethink.co.uk>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      dfaf8d2a
  13. 28 5月, 2016 1 次提交
  14. 18 5月, 2016 1 次提交
  15. 11 4月, 2016 1 次提交
  16. 21 3月, 2016 1 次提交
  17. 23 1月, 2016 1 次提交
    • A
      wrappers for ->i_mutex access · 5955102c
      Al Viro 提交于
      parallel to mutex_{lock,unlock,trylock,is_locked,lock_nested},
      inode_foo(inode) being mutex_foo(&inode->i_mutex).
      
      Please, use those for access to ->i_mutex; over the coming cycle
      ->i_mutex will become rwsem, with ->lookup() done with it held
      only shared.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      5955102c
  18. 10 1月, 2016 1 次提交
  19. 14 11月, 2015 1 次提交
  20. 07 11月, 2015 1 次提交
  21. 29 9月, 2015 1 次提交
    • R
      UBIFS: Kill unneeded locking in ubifs_init_security · cf6f54e3
      Richard Weinberger 提交于
      Fixes the following lockdep splat:
      [    1.244527] =============================================
      [    1.245193] [ INFO: possible recursive locking detected ]
      [    1.245193] 4.2.0-rc1+ #37 Not tainted
      [    1.245193] ---------------------------------------------
      [    1.245193] cp/742 is trying to acquire lock:
      [    1.245193]  (&sb->s_type->i_mutex_key#9){+.+.+.}, at: [<ffffffff812b3f69>] ubifs_init_security+0x29/0xb0
      [    1.245193]
      [    1.245193] but task is already holding lock:
      [    1.245193]  (&sb->s_type->i_mutex_key#9){+.+.+.}, at: [<ffffffff81198e7f>] path_openat+0x3af/0x1280
      [    1.245193]
      [    1.245193] other info that might help us debug this:
      [    1.245193]  Possible unsafe locking scenario:
      [    1.245193]
      [    1.245193]        CPU0
      [    1.245193]        ----
      [    1.245193]   lock(&sb->s_type->i_mutex_key#9);
      [    1.245193]   lock(&sb->s_type->i_mutex_key#9);
      [    1.245193]
      [    1.245193]  *** DEADLOCK ***
      [    1.245193]
      [    1.245193]  May be due to missing lock nesting notation
      [    1.245193]
      [    1.245193] 2 locks held by cp/742:
      [    1.245193]  #0:  (sb_writers#5){.+.+.+}, at: [<ffffffff811ad37f>] mnt_want_write+0x1f/0x50
      [    1.245193]  #1:  (&sb->s_type->i_mutex_key#9){+.+.+.}, at: [<ffffffff81198e7f>] path_openat+0x3af/0x1280
      [    1.245193]
      [    1.245193] stack backtrace:
      [    1.245193] CPU: 2 PID: 742 Comm: cp Not tainted 4.2.0-rc1+ #37
      [    1.245193] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.7.5-0-ge51488c-20140816_022509-build35 04/01/2014
      [    1.245193]  ffffffff8252d530 ffff88007b023a38 ffffffff814f6f49 ffffffff810b56c5
      [    1.245193]  ffff88007c30cc80 ffff88007b023af8 ffffffff810a150d ffff88007b023a68
      [    1.245193]  000000008101302a ffff880000000000 00000008f447e23f ffffffff8252d500
      [    1.245193] Call Trace:
      [    1.245193]  [<ffffffff814f6f49>] dump_stack+0x4c/0x65
      [    1.245193]  [<ffffffff810b56c5>] ? console_unlock+0x1c5/0x510
      [    1.245193]  [<ffffffff810a150d>] __lock_acquire+0x1a6d/0x1ea0
      [    1.245193]  [<ffffffff8109fa78>] ? __lock_is_held+0x58/0x80
      [    1.245193]  [<ffffffff810a1a93>] lock_acquire+0xd3/0x270
      [    1.245193]  [<ffffffff812b3f69>] ? ubifs_init_security+0x29/0xb0
      [    1.245193]  [<ffffffff814fc83b>] mutex_lock_nested+0x6b/0x3a0
      [    1.245193]  [<ffffffff812b3f69>] ? ubifs_init_security+0x29/0xb0
      [    1.245193]  [<ffffffff812b3f69>] ? ubifs_init_security+0x29/0xb0
      [    1.245193]  [<ffffffff812b3f69>] ubifs_init_security+0x29/0xb0
      [    1.245193]  [<ffffffff8128e286>] ubifs_create+0xa6/0x1f0
      [    1.245193]  [<ffffffff81198e7f>] ? path_openat+0x3af/0x1280
      [    1.245193]  [<ffffffff81195d15>] vfs_create+0x95/0xc0
      [    1.245193]  [<ffffffff8119929c>] path_openat+0x7cc/0x1280
      [    1.245193]  [<ffffffff8109ffe3>] ? __lock_acquire+0x543/0x1ea0
      [    1.245193]  [<ffffffff81088f20>] ? sched_clock_cpu+0x90/0xc0
      [    1.245193]  [<ffffffff81088c00>] ? calc_global_load_tick+0x60/0x90
      [    1.245193]  [<ffffffff81088f20>] ? sched_clock_cpu+0x90/0xc0
      [    1.245193]  [<ffffffff811a9cef>] ? __alloc_fd+0xaf/0x180
      [    1.245193]  [<ffffffff8119ac55>] do_filp_open+0x75/0xd0
      [    1.245193]  [<ffffffff814ffd86>] ? _raw_spin_unlock+0x26/0x40
      [    1.245193]  [<ffffffff811a9cef>] ? __alloc_fd+0xaf/0x180
      [    1.245193]  [<ffffffff81189bd9>] do_sys_open+0x129/0x200
      [    1.245193]  [<ffffffff81189cc9>] SyS_open+0x19/0x20
      [    1.245193]  [<ffffffff81500717>] entry_SYSCALL_64_fastpath+0x12/0x6f
      
      While the lockdep splat is a false positive, becuase path_openat holds i_mutex
      of the parent directory and ubifs_init_security() tries to acquire i_mutex
      of a new inode, it reveals that taking i_mutex in ubifs_init_security() is
      in vain because it is only being called in the inode allocation path
      and therefore nobody else can see the inode yet.
      
      Cc: stable@vger.kernel.org # 3.20-
      Reported-and-tested-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
      Reviewed-and-tested-by: NDongsheng Yang <yangds.fnst@cn.fujitsu.com>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      Signed-off-by: dedekind1@gmail.com
      cf6f54e3
  22. 16 4月, 2015 1 次提交
  23. 25 3月, 2015 1 次提交
    • S
      UBIFS: extend debug/message capabilities · 235c362b
      Sheng Yong 提交于
      In the case where we have more than one volumes on different UBI
      devices, it may be not that easy to tell which volume prints the
      messages.  Add ubi number and volume id in ubifs_msg/warn/error
      to help debug. These two values are passed by struct ubifs_info.
      
      For those where ubifs_info is not initialized yet, ubifs_* is
      replaced by pr_*. For those where ubifs_info is not avaliable,
      ubifs_info is passed to the calling function as a const parameter.
      
      The output looks like,
      
      [   95.444879] UBIFS (ubi0:1): background thread "ubifs_bgt0_1" started, PID 696
      [   95.484688] UBIFS (ubi0:1): UBIFS: mounted UBI device 0, volume 1, name "test1"
      [   95.484694] UBIFS (ubi0:1): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
      [   95.484699] UBIFS (ubi0:1): FS size: 30220288 bytes (28 MiB, 238 LEBs), journal size 1523712 bytes (1 MiB, 12 LEBs)
      [   95.484703] UBIFS (ubi0:1): reserved for root: 1427378 bytes (1393 KiB)
      [   95.484709] UBIFS (ubi0:1): media format: w4/r0 (latest is w4/r0), UUID 40DFFC0E-70BE-4193-8905-F7D6DFE60B17, small LPT model
      [   95.489875] UBIFS (ubi1:0): background thread "ubifs_bgt1_0" started, PID 699
      [   95.529713] UBIFS (ubi1:0): UBIFS: mounted UBI device 1, volume 0, name "test2"
      [   95.529718] UBIFS (ubi1:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
      [   95.529724] UBIFS (ubi1:0): FS size: 19808256 bytes (18 MiB, 156 LEBs), journal size 1015809 bytes (0 MiB, 8 LEBs)
      [   95.529727] UBIFS (ubi1:0): reserved for root: 935592 bytes (913 KiB)
      [   95.529733] UBIFS (ubi1:0): media format: w4/r0 (latest is w4/r0), UUID EEB7779D-F419-4CA9-811B-831CAC7233D4, small LPT model
      
      [  954.264767] UBIFS error (ubi1:0 pid 756): ubifs_read_node: bad node type (255 but expected 6)
      [  954.367030] UBIFS error (ubi1:0 pid 756): ubifs_read_node: bad node at LEB 0:0, LEB mapping status 1
      Signed-off-by: NSheng Yong <shengyong1@huawei.com>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      235c362b
  24. 28 1月, 2015 3 次提交
  25. 25 10月, 2013 1 次提交
  26. 17 5月, 2012 1 次提交
  27. 11 5月, 2012 1 次提交
    • L
      vfs: make it possible to access the dentry hash/len as one 64-bit entry · 26fe5750
      Linus Torvalds 提交于
      This allows comparing hash and len in one operation on 64-bit
      architectures.  Right now only __d_lookup_rcu() takes advantage of this,
      since that is the case we care most about.
      
      The use of anonymous struct/unions hides the alternate 64-bit approach
      from most users, the exception being a few cases where we initialize a
      'struct qstr' with a static initializer.  This makes the problematic
      cases use a new QSTR_INIT() helper function for that (but initializing
      just the name pointer with a "{ .name = xyzzy }" initializer remains
      valid, as does just copying another qstr structure).
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      26fe5750
  28. 22 11月, 2011 1 次提交
  29. 02 11月, 2011 2 次提交
  30. 14 5月, 2011 1 次提交