* [f2fs-dev] [PATCH] f2fs-tools: deal with permission denial on non-root user
@ 2024-03-05 20:48 Jaegeuk Kim
2024-03-05 23:30 ` Daeho Jeong
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jaegeuk Kim @ 2024-03-05 20:48 UTC (permalink / raw)
To: linux-f2fs-devel; +Cc: Jaegeuk Kim
This fixes some android build failures due to the missing permission when
checking the loop device. Until we get a better solution, let's ignore
the error with warnings.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
lib/libf2fs.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/lib/libf2fs.c b/lib/libf2fs.c
index d51e485361ee..1cfbf31a9c85 100644
--- a/lib/libf2fs.c
+++ b/lib/libf2fs.c
@@ -854,9 +854,15 @@ int f2fs_dev_is_umounted(char *path)
loop_fd = open(mnt->mnt_fsname, O_RDONLY);
if (loop_fd < 0) {
+ /* non-root users have no permission */
+ if (errno == EPERM || errno == EACCES) {
+ MSG(0, "Info: open %s failed errno:%d - be careful to overwrite a mounted loopback file.\n",
+ mnt->mnt_fsname, errno);
+ return 0;
+ }
MSG(0, "Info: open %s failed errno:%d\n",
- mnt->mnt_fsname, errno);
- return -1;
+ mnt->mnt_fsname, errno);
+ return -errno;
}
err = ioctl(loop_fd, LOOP_GET_STATUS64, &loopinfo);
@@ -864,7 +870,7 @@ int f2fs_dev_is_umounted(char *path)
if (err < 0) {
MSG(0, "\tError: ioctl LOOP_GET_STATUS64 failed errno:%d!\n",
errno);
- return -1;
+ return -errno;
}
if (st_buf.st_dev == loopinfo.lo_device &&
--
2.44.0.278.ge034bb2e1d-goog
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs-tools: deal with permission denial on non-root user
2024-03-05 20:48 [f2fs-dev] [PATCH] f2fs-tools: deal with permission denial on non-root user Jaegeuk Kim
@ 2024-03-05 23:30 ` Daeho Jeong
2024-03-06 1:32 ` [f2fs-dev] [External Mail] " 黄佳男 via Linux-f2fs-devel
2024-03-06 2:02 ` [f2fs-dev] " Chao Yu
2 siblings, 0 replies; 4+ messages in thread
From: Daeho Jeong @ 2024-03-05 23:30 UTC (permalink / raw)
To: Jaegeuk Kim; +Cc: linux-f2fs-devel
Reviewed-by: Daeho Jeong <daehojeong@google.com>
On Tue, Mar 5, 2024 at 12:50 PM Jaegeuk Kim <jaegeuk@kernel.org> wrote:
>
> This fixes some android build failures due to the missing permission when
> checking the loop device. Until we get a better solution, let's ignore
> the error with warnings.
>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
> lib/libf2fs.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/lib/libf2fs.c b/lib/libf2fs.c
> index d51e485361ee..1cfbf31a9c85 100644
> --- a/lib/libf2fs.c
> +++ b/lib/libf2fs.c
> @@ -854,9 +854,15 @@ int f2fs_dev_is_umounted(char *path)
>
> loop_fd = open(mnt->mnt_fsname, O_RDONLY);
> if (loop_fd < 0) {
> + /* non-root users have no permission */
> + if (errno == EPERM || errno == EACCES) {
> + MSG(0, "Info: open %s failed errno:%d - be careful to overwrite a mounted loopback file.\n",
> + mnt->mnt_fsname, errno);
> + return 0;
> + }
> MSG(0, "Info: open %s failed errno:%d\n",
> - mnt->mnt_fsname, errno);
> - return -1;
> + mnt->mnt_fsname, errno);
> + return -errno;
> }
>
> err = ioctl(loop_fd, LOOP_GET_STATUS64, &loopinfo);
> @@ -864,7 +870,7 @@ int f2fs_dev_is_umounted(char *path)
> if (err < 0) {
> MSG(0, "\tError: ioctl LOOP_GET_STATUS64 failed errno:%d!\n",
> errno);
> - return -1;
> + return -errno;
> }
>
> if (st_buf.st_dev == loopinfo.lo_device &&
> --
> 2.44.0.278.ge034bb2e1d-goog
>
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [f2fs-dev] [External Mail] [PATCH] f2fs-tools: deal with permission denial on non-root user
2024-03-05 20:48 [f2fs-dev] [PATCH] f2fs-tools: deal with permission denial on non-root user Jaegeuk Kim
2024-03-05 23:30 ` Daeho Jeong
@ 2024-03-06 1:32 ` 黄佳男 via Linux-f2fs-devel
2024-03-06 2:02 ` [f2fs-dev] " Chao Yu
2 siblings, 0 replies; 4+ messages in thread
From: 黄佳男 via Linux-f2fs-devel @ 2024-03-06 1:32 UTC (permalink / raw)
To: Jaegeuk Kim, linux-f2fs-devel@lists.sourceforge.net
Reviewed-by: Huang Jianan <huangjianan@xiaomi.com>
Thanks.
On 2024/3/6 4:48, Jaegeuk Kim wrote:
> This fixes some android build failures due to the missing permission when
> checking the loop device. Until we get a better solution, let's ignore
> the error with warnings.
>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
> lib/libf2fs.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/lib/libf2fs.c b/lib/libf2fs.c
> index d51e485361ee..1cfbf31a9c85 100644
> --- a/lib/libf2fs.c
> +++ b/lib/libf2fs.c
> @@ -854,9 +854,15 @@ int f2fs_dev_is_umounted(char *path)
>
> loop_fd = open(mnt->mnt_fsname, O_RDONLY);
> if (loop_fd < 0) {
> + /* non-root users have no permission */
> + if (errno == EPERM || errno == EACCES) {
> + MSG(0, "Info: open %s failed errno:%d - be careful to overwrite a mounted loopback file.\n",
> + mnt->mnt_fsname, errno);
> + return 0;
> + }
> MSG(0, "Info: open %s failed errno:%d\n",
> - mnt->mnt_fsname, errno);
> - return -1;
> + mnt->mnt_fsname, errno);
> + return -errno;
> }
>
> err = ioctl(loop_fd, LOOP_GET_STATUS64, &loopinfo);
> @@ -864,7 +870,7 @@ int f2fs_dev_is_umounted(char *path)
> if (err < 0) {
> MSG(0, "\tError: ioctl LOOP_GET_STATUS64 failed errno:%d!\n",
> errno);
> - return -1;
> + return -errno;
> }
>
> if (st_buf.st_dev == loopinfo.lo_device &&
> --
> 2.44.0.278.ge034bb2e1d-goog
>
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs-tools: deal with permission denial on non-root user
2024-03-05 20:48 [f2fs-dev] [PATCH] f2fs-tools: deal with permission denial on non-root user Jaegeuk Kim
2024-03-05 23:30 ` Daeho Jeong
2024-03-06 1:32 ` [f2fs-dev] [External Mail] " 黄佳男 via Linux-f2fs-devel
@ 2024-03-06 2:02 ` Chao Yu
2 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2024-03-06 2:02 UTC (permalink / raw)
To: Jaegeuk Kim, linux-f2fs-devel
On 2024/3/6 4:48, Jaegeuk Kim wrote:
> This fixes some android build failures due to the missing permission when
> checking the loop device. Until we get a better solution, let's ignore
> the error with warnings.
>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-03-06 2:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-05 20:48 [f2fs-dev] [PATCH] f2fs-tools: deal with permission denial on non-root user Jaegeuk Kim
2024-03-05 23:30 ` Daeho Jeong
2024-03-06 1:32 ` [f2fs-dev] [External Mail] " 黄佳男 via Linux-f2fs-devel
2024-03-06 2:02 ` [f2fs-dev] " Chao Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox