From: Chao Yu <chao@kernel.org>
To: Jaewook Kim <jw5454.kim@samsung.com>, jaegeuk@kernel.org
Cc: sj1557.seo@samsung.com, linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH v2] f2fs: do not allow to decompress files have FI_COMPRESS_RELEASED
Date: Thu, 4 Aug 2022 21:32:54 +0800 [thread overview]
Message-ID: <7d430cc7-5f6c-536b-0e10-687c2804afa8@kernel.org> (raw)
In-Reply-To: <20220803085358.3963-1-jw5454.kim@samsung.com>
On 2022/8/3 16:53, Jaewook Kim wrote:
> If a file has FI_COMPRESS_RELEASED, all writes for it should not be
> allowed. However, as of now, in case of compress_mode=user, writes
> triggered by IOCTLs like F2FS_IOC_DE/COMPRESS_FILE are allowed unexpectly,
> which could crash that file.
> To fix it, let's do not allow F2FS_IOC_DE/COMPRESS_IOCTL if a file already
> has FI_COMPRESS_RELEASED flag.
>
> This is the reproduction process:
> 1. $ touch ./file
> 2. $ chattr +c ./file
> 3. $ dd if=/dev/random of=./file bs=4096 count=30 conv=notrunc
> 4. $ dd if=/dev/zero of=./file bs=4096 count=34 seek=30 conv=notrunc
> 5. $ sync
> 6. $ do_compress ./file ; call F2FS_IOC_COMPRESS_FILE
> 7. $ get_compr_blocks ./file ; call F2FS_IOC_GET_COMPRESS_BLOCKS
> 8. $ release ./file ; call F2FS_IOC_RELEASE_COMPRESS_BLOCKS
> 9. $ do_compress ./file ; call F2FS_IOC_COMPRESS_FILE again
> 10. $ get_compr_blocks ./file ; call F2FS_IOC_GET_COMPRESS_BLOCKS again
>
> This reproduction process is tested in 128kb cluster size.
> You can find compr_blocks has a negative value.
>
> Fixes: 5fdb322ff2c2b ("f2fs: add F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMPRESS_FILE")
>
> Signed-off-by: Junbeom Yeom <junbeom.yeom@samsung.com>
> Signed-off-by: Sungjong Seo <sj1557.seo@samsung.com>
> Signed-off-by: Youngjin Gil <youngjin.gil@samsung.com>
> Signed-off-by: Jaewook Kim <jw5454.kim@samsung.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
prev parent reply other threads:[~2022-08-04 13:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20220803023449epcas1p4a9b09cdc73878c8ee40ae10523279dc3@epcas1p4.samsung.com>
2022-08-03 2:34 ` [f2fs-dev] [PATCH] f2fs: do not allow to decompress files have FI_COMPRESS_RELEASED Jaewook Kim
2022-08-03 3:45 ` Sungjong Seo
[not found] ` <CGME20220803085402epcas1p2a1a70630592fa73f3404ba120c6c1ac8@epcas1p2.samsung.com>
2022-08-03 8:53 ` [f2fs-dev] [PATCH v2] " Jaewook Kim
2022-08-04 13:32 ` Chao Yu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7d430cc7-5f6c-536b-0e10-687c2804afa8@kernel.org \
--to=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=jw5454.kim@samsung.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=sj1557.seo@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).