* [PATCH 1/2] erofs-utils: fsck: never follow exist symlinks when overwriting
@ 2022-01-26 3:37 Gao Xiang
2022-01-26 3:37 ` [PATCH 2/2] erofs-utils: fsck: don't set attributes when fscking only Gao Xiang
0 siblings, 1 reply; 2+ messages in thread
From: Gao Xiang @ 2022-01-26 3:37 UTC (permalink / raw)
To: linux-erofs; +Cc: Gao Xiang
Otherwise, we could face potential security issues.
Fixes: 412c8f908132 ("erofs-utils: fsck: add --extract=X support to extract to path X")
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
fsck/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fsck/main.c b/fsck/main.c
index 14534b9..f2af609 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -496,8 +496,8 @@ static inline int erofs_extract_file(struct erofs_inode *inode)
again:
fd = open(fsckcfg.extract_path,
- O_WRONLY | O_CREAT | (fsckcfg.overwrite ? O_TRUNC : O_EXCL),
- 0700);
+ O_WRONLY | O_CREAT | O_NOFOLLOW |
+ (fsckcfg.overwrite ? O_TRUNC : O_EXCL), 0700);
if (fd < 0) {
if (fsckcfg.overwrite && tryagain) {
if (errno == EISDIR) {
--
2.24.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] erofs-utils: fsck: don't set attributes when fscking only
2022-01-26 3:37 [PATCH 1/2] erofs-utils: fsck: never follow exist symlinks when overwriting Gao Xiang
@ 2022-01-26 3:37 ` Gao Xiang
0 siblings, 0 replies; 2+ messages in thread
From: Gao Xiang @ 2022-01-26 3:37 UTC (permalink / raw)
To: linux-erofs; +Cc: Gao Xiang
Otherwise, when --extract is specified, it will report:
<W> erofs: erofsfsck_set_attributes() Line[189] failed to set times: (null)
<W> erofs: erofsfsck_set_attributes() Line[197] failed to set permissions: (null)
...
Fixes: 412c8f908132 ("erofs-utils: fsck: add --extract=X support to extract to path X")
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
fsck/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fsck/main.c b/fsck/main.c
index f2af609..92e0c76 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -665,7 +665,7 @@ verify:
ret = erofs_iterate_dir(&ctx, true);
}
- if (!ret)
+ if (!ret && fsckcfg.extract_path)
erofsfsck_set_attributes(&inode, fsckcfg.extract_path);
out:
--
2.24.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-26 3:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-26 3:37 [PATCH 1/2] erofs-utils: fsck: never follow exist symlinks when overwriting Gao Xiang
2022-01-26 3:37 ` [PATCH 2/2] erofs-utils: fsck: don't set attributes when fscking only Gao Xiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox