Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test with more filesystems #21

Open
l0kod opened this issue Jan 30, 2024 · 17 comments
Open

Test with more filesystems #21

l0kod opened this issue Jan 30, 2024 · 17 comments
Labels
good first issue Good for newcomers test Test improvement

Comments

@l0kod
Copy link
Member

l0kod commented Jan 30, 2024

We currently perform testing on a set of synthetic filesystems (e.g. tmpfs, proc, sysfs) thanks to the layout3_fs test variants.

It would be useful to add new tests for more filesystems (e.g. ext4, btrfs, f2fs, erofs, vfat, ntfs, fuse, nfs) to make sure they are consistent with Landlock sandboxing. One of the challenges is to cleanly integrate light filesystem creations with the tests.

@l0kod l0kod added good first issue Good for newcomers test Test improvement labels Jan 30, 2024
@l0kod l0kod changed the title Add non-synthetic FS tests Test with more filesystems Jan 31, 2024
@l0kod l0kod added this to Landlock Feb 1, 2024
@l0kod l0kod moved this to Ready in Landlock Feb 1, 2024
@abhishek23tiwari
Copy link

Hi, Can I work on this? If yes, please guide me on how to fix it. Thanks

@l0kod
Copy link
Member Author

l0kod commented Mar 6, 2024

Hi @abhishek23tiwari! Yes you can start working this task.

This is not a bug but a test improvement. The first step would be to create minimal filesystems with mkfs.*, then mount them, and after that extend the layout3_fs test variants. All that needs to happen in the fs_test.c. Does it look good?

@demonkillerr
Copy link

Hey @l0kod. IRL, the fs needs to be created and mounted against a said volume. For example

mkfs.ext4 /dev/sdaX
and
mount /dev/sdaX /mnt for example

Can you please point me on how to create the minimal fs with respect to layout3_fs?

@l0kod
Copy link
Member Author

l0kod commented Mar 22, 2024

Hey @l0kod.

Hi!

IRL, the fs needs to be created and mounted against a said volume. For example

mkfs.ext4 /dev/sdaX and mount /dev/sdaX /mnt for example

Can you please point me on how to create the minimal fs with respect to layout3_fs?

We can extend FIXTURE(layout3_fs) with some fields to identify the command needed to create a file system, and then in FIXTURE_SETUP(layout3_fs) create this file system accordingly. However, instead of using /dev/sdaX we should use a loop device:

fallocate --length 4M test-ext4.img
mkfs.ext4 -q test-ext4.img

@MOLeCULE-Soft
Copy link

Greetings @l0kod, I am an Outreachy applicant and have had 3 patches accepted already. I would like to work on this.
Thanks

@l0kod
Copy link
Member Author

l0kod commented Mar 27, 2024

Hi @MOLeCULE-Soft,
You can work on this. Because several people are interested by this task, everyone should first start with a specific filesystem. We'll see how it goes when patches will be posted on the mailing list.

@abhishek23tiwari @demonkillerr, what is your status? Are you still interested?

@demonkillerr
Copy link

Hi @l0kod. I am not part of the Outreachy program, so please feel free to assign it to others. I am a distro maintainer looking at some kernel code 😅.

I am still interested to help regardless.

@Tundroid
Copy link

Tundroid commented Mar 28, 2024

Hi @MOLeCULE-Soft,

Hello @l0kod, sorry I used the wrong account to send the first message, this is my active GitHub account now. I only realised this after your reply.
Thanks.

@l0kod
Copy link
Member Author

l0kod commented Mar 28, 2024

Hi @l0kod. I am not part of the Outreachy program, so please feel free to assign it to others. I am a distro maintainer looking at some kernel code 😅.

OK

I am still interested to help regardless.

Good! You might be interested by other test tasks. They may be a bit more complex though.

@Tundroid
Copy link

Hello @l0kod

I am having issues creating a loop device for ext4.

system("losetup /dev/loop0 test-ext4.img");

Using system above, I get the following error

losetup: /dev/loop0: failed to set up loop device: No such device or address

And when I use

open("/dev/loop0", O_RDWR);

I get an error still.
Please, can you direct me on what I am missing.

Thanks in advance

@l0kod
Copy link
Member Author

l0kod commented Mar 29, 2024

I am having issues creating a loop device for ext4.

system("losetup /dev/loop0 test-ext4.img");

It might not be required to directly call loseup but only mkfs.*.

Using system above, I get the following error

losetup: /dev/loop0: failed to set up loop device: No such device or address

I guess kernel's CONFIG_BLK_DEV_LOOP is not set.

@saashaspace
Copy link

saashaspace commented Mar 31, 2024

Hello Sir @l0kod,

when we are creating a file system with mkfs.*, do we need to check for any condition where there might be a failure, (say PID = -1)

@abhishek23tiwari
Copy link

Hi @MOLeCULE-Soft, You can work on this. Because several people are interested by this task, everyone should first start with a specific filesystem. We'll see how it goes when patches will be posted on the mailing list.

@abhishek23tiwari @demonkillerr, what is your status? Are you still interested?

Hi, because of some reasons, I am not able to continue with the program. And I think you already assigned someone so, I have no issue. :) Happy Coding.

@Tundroid
Copy link

Tundroid commented Apr 2, 2024

Hi @l0kod,

One of the challenges is to cleanly integrate light filesystem creations with the tests.

Can you ellaborate this?

Secondly, I keep getting this error whenever I try to mount the filesystem ext4;

mount: tmp/ext4_mnt: mount failed: Operation not permitted.

Can you please guide me on this?

Thanks

@l0kod
Copy link
Member Author

l0kod commented Apr 2, 2024

when we are creating a file system with mkfs.*, do we need to check for any condition where there might be a failure, (say PID = -1)

Yes, all steps required to create a file system must be checked with asserts.

@l0kod
Copy link
Member Author

l0kod commented Apr 2, 2024

One of the challenges is to cleanly integrate light filesystem creations with the tests.

Can you ellaborate this?

File system creations should be quick, not take much space (see call to fallocate in my example), and not depend on block devices (except loop devices). They should cleanly integrated with the existing layout3_fs variants.

Secondly, I keep getting this error whenever I try to mount the filesystem ext4;

mount: tmp/ext4_mnt: mount failed: Operation not permitted.

Can you please guide me on this?

You probably need to allow CAP_SYS_ADMIN, see set_cap() and clear_cap() calls.

@l0kod
Copy link
Member Author

l0kod commented Jun 11, 2024

I guess @Tundroid is not working on this task anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers test Test improvement
Projects
Status: Ready
Development

No branches or pull requests

6 participants