Commit Graph

778 Commits

Author SHA1 Message Date
Junyong Sun
ce1c9b8e99 libf2fs: fix memory leak caused by get_rootdev()
commit f0fda11925
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

memory which malloc for uevent don't free at get_rootdev(),
it would cause memory leak, so free it before return.

Signed-off-by: Junyong Sun <sunjy516@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
Park Ju Hyung
964aab30b3 mkfs.f2fs: add VM disk files to hot data types
commit 5144f2f71b
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Similar to .db files, these are randomly updated extremely frequently.

Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
Jaegeuk Kim
83c124114a libzoned: use blk_zone_v2 and blk_zone_report_v2 by default
commit 73c0871641
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Old blk_zone and blk_zone_report should be compatible with v2.
And, old blk_zone_report uses reserved[4] which breaks the build.

struct blk_zone_report {
        __u64           sector;
        __u32           nr_zones;
        __u8            reserved[4];
        struct blk_zone zones[0];
};

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
Jaegeuk Kim
342053b6d0 f2fs-tools: fix wrong blk_zone_rep_v2 definition
commit 9cb5150afa
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

If HAVE_BLK_ZONE_REP_V2 id defined, we should set v2.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
Jaegeuk Kim
00579ab00a mkfs.f2fs: allocate zones together to avoid random access
commit 15474db2b3
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

This patch allocates zones to initial logs together, if it's on zoned device.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
Jaegeuk Kim
153382836d mkfs.f2fs: adjust zone alignment when using multi-partitions
commit 316e128fe3
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

When formatting conventional partition with zoned one, we should align
the starting block address of next device to the zone size.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
Jaegeuk Kim
3a346afe9f fsck.f2fs: fix alignment on multi-partition support
commit cc57f2c7da
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

- mkfs.f2fs -s 4 -c second_dev first_dev
- fsck.f2fs first

Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 69668488 (34017 MB)
Segment count (19128) mismatch with total segments from devices (19130) Can't find a valid F2FS superblock at 0x0
Segment count (19128) mismatch with total segments from devices (19130) Can't find a valid F2FS superblock at 0x1

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
John A. Leuenhagen
117b4bfe64 f2fs-tools: Miscellaneous cleanup to README.
commit ff7172e69f
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
John A. Leuenhagen via Linux-f2fs-devel
c4032089ea mkfs.f2fs.8: Better document the -g argument.
commit 2b2641794f
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

To use Android defaults, you must use `-g android`. However, the man
page previously implied that you need only use `-g`.

Since you must specify `android`, I figured it would be appropriate
to name that field `default-options` in the man page. If there was ever
a reason to have a different set of default options, the `-g` option
could be used with a new `default-options` value, i.e. `-g example`.

Signed-off-by: John A. Leuenhagen <john@zlima12.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
John A. Leuenhagen via Linux-f2fs-devel
00f2298862 mkfs.f2fs.8: fix formatting for -l parameter in man page
commit e05afe5dfa
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Signed-off-by: John A. Leuenhagen <john@zlima12.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
Jordan Webb
7adec5bc39 f2fs-tools: Make sload.f2fs reproduce hard links
commit 747b74cb9c
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

If sload.f2fs encounters a file with nr_links > 1, it will mark it
as a possible hard link by remembering the original device and
inode. When sload.f2fs creates the file, it will check if it has
already created a file for the same original device and inode. If
so, it will add the original inode to the directory and increment
the number of links to it, instead of writing a new inode.

This allows sload.f2fs to accurately reproduce a directory tree that
contains hard links, such as those created by ostree. Without this
patch, directory trees containing hard links result in the content of
the files being duplicated.

This is version 2 of the patch; it has been rebased against the dev
branch and includes a fix from Jaegeuk Kim to avoid building data
contents twice on hard linked files.

Co-authored-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Jordan Webb <jordan@getseam.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
Robin Hsu
ecdcd6189d f2fs-tools:sload.f2fs compression support
commit b585244e72
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Add F2FS compression support for sload
* Support file extension filter, either default-accept or default-deny
  policy
* Support choice of compression algorithm, LZO (version 2) or LZ4
  (default)
* Support custom log of cluster size
* Support minimum number of compressed blocks per cluster (default 1).
  A cluster will not be compressed if the number can not be met.
* suuport -r (read-only) option
  This releases compressed blocks to secure free space in advance. Note that,
  all compressed files will have the immutable bit.
* Added manpage update
* Remove unecessary qbuf allocation (Jaegeuk, suggested by Satya)

Signed-off-by: Robin Hsu <robinhsu@google.com>
[Jaegeuk Kim: fix some bugs and refactor names]
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>

 create mode 100644 fsck/compress.c
 create mode 100644 fsck/compress.h

Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
Daeho Jeong
a1879e5af8 f2fs_io: add compress/decompress commands
commit 7b63f7b399
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Added new commands, compress and decompress, to support
F2FS_IOC_COMPRESS_FILE and F2FS_IOC_DECOMPRESS_FILE.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
Robin Hsu
89dc315596 f2fs-tools: Added #ifdef WITH_func
commit 457392a032
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Add proprocessor defines (options) 'WITH_func',
where func = DUMP, DEFRAG, RESIZE, or SLOAD

Signed-off-by: Robin Hsu <robinhsu@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
Victor Westerhuis
e67b93cdc9 f2fs-tools: fix a few spelling errors in f2fs-tools
commit d322d47fa4
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

typo fix.

Signed-off-by: Victor Westerhuis <victor@westerhu.is>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
Robin Hsu
df7acfde0a f2fs-tools: skipped to end on error syntax error
commit fcd5cd0b52
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

When error were found, we won't need to do any initialization but
just quit.

Signed-off-by: Robin Hsu <robinhsu@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
Jaegeuk Kim
de4f6bf2e0 mkfs.f2fs: show a message when compression is enabled
commit 31d30f0c49
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

This patch adds a message when formatting the disk with compression.

Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
Daeho Jeong
2b7016042a f2fs_io: add get/set compression option
commit 1d4c7e7ce5
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Added new commands, get_coption and set_coption, to support
F2FS_IOC_GET_COMPRESS_OPTION and F2FS_IOC_SET_COMPRESS_OPTION.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
Robin Hsu
da760b34ae Fix ASSERT() macro with '%' in the expression
commit 4bd7008291
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Fix a compiling error triggered by ASSERT(exp), when exp contains '%'

(e.g. integer modular operator)

Signed-off-by: Robin Hsu <robinhsu@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
Robin Hsu
ad9ff71f6f f2fs-toos: fsck.f2fs Fix bad return value
commit ca0ed8a66f
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

'ret' should not have been used here: otherwise, it would be wrongly used
as the error code and then be returned from main().

Signed-off-by: Robin Hsu <robinhsu@google.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
Chao Yu
061536fa27 fsck.f2fs: do xnid sanity check only during fsck
commit c954e7cc4b
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

As Eric reported:

Commit 7a22451bc2 ("fsck.f2fs: fix to check validation of i_xattr_nid")

This commit caused a regression where 'dump.f2fs -i <inode> <device>'
now segfaults if the inode has any extended attributes.

It's because read_all_xattrs() now calls fsck_sanity_check_nid(), which
eventually dereferences f2fs_fsck::main_area_bitmap, which is NULL.

I'm not sure what was intended here.

Here's the output from gdb:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7f750fa in f2fs_test_bit (nr=1024, p=0x0) at libf2fs.c:304
304             return (mask & *addr) != 0;
(gdb) bt
    ntype=TYPE_XATTR, ni=0x7fffffffdd20) at fsck.c:449
    ntype=TYPE_XATTR, ni=0x7fffffffdd20) at fsck.c:495

fsck_sanity_check_nid() should only called from fsck.f2fs context, rather
than dump.f2fs, otherwise it may cause dereferencing structure fields of
fsck incorrectly.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
Ocean Chen
2fc80b9e32 f2fs_io: add erase option
commit 1bfc17340d
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

f2fs_io erase [block_device_path]

Signed-off-by: Ocean Chen <oceanchen@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
Eric Biggers
7b086a46df mkfs.f2fs.8: document the verity feature
commit e59bb175ac
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:43 +08:00
Eric Biggers
b8117d54b1 fsck: clear unexpected casefold flags
commit 8fd836f25f
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Inodes aren't allowed to have the casefold flag set when they aren't
directories, or if the filesystem superblock doesn't have the casefold
feature enabled.  Clear any such unexpected casefold flags.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:43 +08:00
John A. Leuenhagen
c3c33958ae mkfs.f2fs: add -h and --help
commit 1a7415a9e2
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

These two arguments would simply print the usage message.

Signed-off-by: John A. Leuenhagen <john@zlima12.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:43 +08:00
Daeho Jeong
851e19eb16 f2fs_io: change fibmap to fiemap
commit 717d70db60
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Currently we support fiemap command using fibmap. It's simple and
easy to use, but we cannot use this for compressed file. To support
more different types of files, we need to change this to use fiemap.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
[Jaegeuk Kim: add Android build]
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:43 +08:00
openharmony_ci
a0c3a2401d
!18 f2fs_tools部件化
Merge pull request !18 from 张文迪/master
2022-08-23 12:06:00 +00:00
张文迪
f8224a8bdc f2fs_tools部件化
Signed-off-by: 张文迪 <zhangwendi3@huawei.com>
2022-08-23 10:40:59 +08:00
openharmony_ci
c19a001604
!17 fix update /data
Merge pull request !17 from 张文迪/master
2022-08-16 06:43:17 +00:00
张文迪
4278e853b7 fix updater /data
Signed-off-by: 张文迪 <zhangwendi3@huawei.com>
2022-08-16 10:09:28 +08:00
openharmony_ci
b29dd29348
!16 Open source software package obligations
Merge pull request !16 from lipengzheng_gitee/open_source
2022-05-31 13:06:26 +00:00
lipengzheng
7fe92abc96 README.OpenSource format modification
Signed-off-by: lipengzheng <lipengzheng1@huawei.com>
2022-05-26 18:31:53 +08:00
openharmony_ci
f89bd9765c
!15 Rename file README to README.md
Merge pull request !15 from xlfeng/master
2022-05-11 12:54:41 +00:00
xlfeng
7e91b3315e Rename file README to README.md
Signed-off-by: xlfeng <xulifeng7@huawei.com>
2022-05-11 19:10:55 +08:00
openharmony_ci
045b625c0f
!14 单个模块扫描(三方软件)结果清零.
Merge pull request !14 from xlfeng/master
2022-02-16 12:38:46 +00:00
xlfeng
9119bc976e 单个模块扫描(三方软件)结果清零.
Signed-off-by: xlfeng <xulifeng7@huawei.com>
2022-02-16 16:22:31 +08:00
openharmony_ci
fd06df1145
!13 change component name: storage_service
Merge pull request !13 from jiahaoluo/master
2022-02-10 03:22:50 +00:00
jiahaoluo
567e0db420 change part name to storage_service
Signed-off-by: jiahaoluo <luojiahao5@huawei.com>
2022-02-09 15:01:50 +08:00
openharmony_ci
b4d363f7c6
!12 feat: add bundle.json
Merge pull request !12 from pjscc/master
2022-01-25 02:26:13 +00:00
pjscc
2a13fb1aa4 feat: add bundle.json
Signed-off-by: pjscc <pangjiashuai@huawei.com>
2022-01-24 17:07:48 +08:00
openharmony_sig_ci
8ad3abc96f
!11 Add BUILD.gn file.
Merge pull request !11 from xlfeng/master
2022-01-13 07:31:27 +00:00
xlfeng
34e66a7e46 Add BUILD.gn file.
Signed-off-by: xlfeng <xulifeng7@huawei.com>
2022-01-13 15:26:44 +08:00
openharmony_sig_ci
ba2974652d
!10 gn文件格式刷新,subsystem_name的值改为filemanagement,路径/e2fsprogs/f2fs-tools-1.14.0改为/f2fs-tools/,config名称e2fsprogs-defaults改为f2fs-defaults 。fsck/BUILD.gn增加symlink_target_name。
Merge pull request !10 from xlfeng/master
2022-01-13 02:26:18 +00:00
xlfeng
a48316a6e8 BUILD,gn文件中subsystem_name的值改为filemanagement,路径/e2fsprogs/f2fs-tools-1.14.0改为/f2fs-tools/,config名称e2fsprogs-defaults改为f2fs-defaults。fsck/BUILD.gn增加symlink_target_name。
Signed-off-by: xlfeng <xulifeng7@huawei.com>
2022-01-12 17:11:18 +08:00
openharmony_sig_ci
5f5b79da7e !8 Delete the added file README.md, use the README in the source code.
Merge pull request !8 from xlfeng/master
2021-12-24 07:03:07 +00:00
xlfeng
212e242c12 Delete the added file README.md, use the README in the source code.
Signed-off-by: xlfeng <xulifeng7@huawei.com>
2021-12-22 14:54:14 +08:00
openharmony_sig_ci
f18a2cbd20 !6 BUILD.gn and config.h modify Huawei license to GPL-2.0 license.Add #ifndef CONFIG_H #define CONFIG_H on the head of file and #endif on the end of config.h. Modify README.OpenSource.
Merge pull request !6 from xlfeng/master
2021-12-21 10:57:21 +00:00
xlfeng
a2b0c9daf5 BUILD.gn delete comment lines and uncompiled items.
Signed-off-by: xlfeng <xulifeng7@huawei.com>
2021-12-21 15:27:01 +08:00
xlfeng
059d1b3f4c BUILD.gn and config.h modify Huawei license to GPL-2.0 license.Add #ifndef CONFIG_H #define CONFIG_H on the head of file and #endif on the end of config.h. Modify the value of Name in README.OpenSource.
Signed-off-by: xlfeng <xulifeng7@huawei.com>
2021-12-20 21:44:20 +08:00
openharmony_sig_ci
ba906b632e !3 config.h add Huawei License Heade.
Merge pull request !3 from xlfeng/master
2021-12-16 06:21:20 +00:00