Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

libmount: non-root mkdir support#3640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
karelzak wants to merge15 commits intoutil-linux:master
base:master
Choose a base branch
Loading
fromkarelzak:PR/libmount-mkdir-precheck

Conversation

@karelzak
Copy link
Collaborator

No description provided.

Signed-off-by: Karel Zak <kzak@redhat.com>
 * introduce do_canonicalize() with proper return values * use do_canonicalize() everywhereSigned-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
* add ul_restricted_path_oper() to fileutils.c* use it as backed for canonicalize_path_restricted()Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Based on ul_restricted_path_oper().Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
@karelzakkarelzak marked this pull request as draftJuly 1, 2025 15:05
Based-on:util-linux#3597Signed-off-by: Karel Zak <kzak@redhat.com>
@karelzakkarelzakforce-pushed thePR/libmount-mkdir-precheck branch fromfb3655d to02f6eb5CompareJuly 1, 2025 15:15
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
* test classic user-mount (mount.static required)* test user-mount with X-mount.mkdirSigned-off-by: Karel Zak <kzak@redhat.com>
@karelzakkarelzak marked this pull request as ready for reviewJuly 16, 2025 09:34
@karelzakkarelzak requested a review fromt-8chJuly 29, 2025 12:32
len=canonical ?(ssize_t)strlen(canonical) :
errno ?-errno :-EINVAL;
len=canonical ?(ssize_t)strlen(canonical) :
errno ?-errno :-EINVAL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Spurious whitespace changes? If intentional should be in a dedicated commit.

if (!path|| !*path)
returnNULL;
if (result)
*result=NULL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

result seems to be always non-NULL.

return-errno;
}

errno=0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Seems unnecessary.

* unreachable path is not an error (!), and in this case, it just duplicates
* @path.
*/
char*canonicalize_path(constchar*path)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Shouldn't these also all get theul_ prefix?

fprintf(stdout,"real: %s\n",canonicalize_path(argv[1]));

fprintf(stdout,"real: %s\n",canonicalize_path(argv[1]));
fprintf(stdout,"real-restricted: %s\n",canonicalize_path_restricted(argv[1]));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can this be used to have a real unittest which validates the results?

ts_init_subtest"basic"
TS_FSTAB="/etc/fstab"
ts_fstab_add$MOUNT_SOURCE$MOUNT_TARGET"none""bind,user,default,noauto"
runuser -u testuser_mount --$TS_CMD_MOUNT_STATIC$MOUNT_TARGET>>$TS_OUTPUT2>>$TS_ERRLOG
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Maybe use therunuser from the current build.


# Add test user
#
useradd -u 9899 --shell /bin/bash testuser_mount
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Not a fan of this. Can we usenobody?
Or just a random user id from a transient uid range.

# classic user-mount
#
ts_init_subtest"basic"
TS_FSTAB="/etc/fstab"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Is the regular test fstab not enough?

runuser -u testuser_mount --$TS_CMD_MOUNT_STATIC$MOUNT_TARGET>>$TS_OUTPUT2>>$TS_ERRLOG
opts=$(findmnt -nr -o VFS-OPTIONS --mountpoint$MOUNT_TARGET)
[[$opts==*"noexec"*&&$opts==*"nosuid"*&&$opts==*"nodev"* ]] \
|| ts_log"Cannot find user options"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

ts_errlog

TS_FSTAB="/etc/fstab"
ts_fstab_add$MOUNT_SOURCE$MOUNT_TARGET"none""bind,user,default,noauto"
runuser -u testuser_mount --$TS_CMD_MOUNT_STATIC$MOUNT_TARGET>>$TS_OUTPUT2>>$TS_ERRLOG
opts=$(findmnt -nr -o VFS-OPTIONS --mountpoint$MOUNT_TARGET)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

TS_CMD_FINDMNT

@karelzakkarelzak marked this pull request as draftAugust 27, 2025 10:47
@karelzak
Copy link
CollaboratorAuthor

I'll split this pull request into three separate pull requests:

  1. canonicalization refactoring
  2. non-root mount test
  3. non-root X-mount.mkdir

I'll keep it open as a draw until all is implemented.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@t-8cht-8cht-8ch left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@karelzak@t-8ch

[8]ページ先頭

©2009-2025 Movatter.jp