Skip to content

add CONFIG_F2FS_FS_SECURITY=y #2778

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

Closed
vch42 opened this issue Dec 6, 2018 · 10 comments
Closed

add CONFIG_F2FS_FS_SECURITY=y #2778

vch42 opened this issue Dec 6, 2018 · 10 comments
Labels
Waiting for internal comment Waiting for comment from a member of the Raspberry Pi engineering team

Comments

@vch42
Copy link

vch42 commented Dec 6, 2018

I think the CONFIG_F2FS_FS_SECURITY=y option should be enabled in the kernel.

It enables support for the XATTR security namespace, which atm is not supported due to this option currently not being set to yes.
The xattr security namespace is used by SELinux and is also a requirement for Samba4 AD/DC full support.

We already have XATTR and POSIX_ACL support enabled for F2FS, with user namespace support, it only makes sense to fully support XATTR on F2FS by also enabling CONFIG_F2FS_FS_SECURITY.

XATTR F2FS support added following: #2508

Thank you.

@JamesH65
Copy link
Contributor

JamesH65 commented Jan 7, 2019

Do you have any numbers for the impact this has on memory requriements and overall CPU performance impact?

@vch42
Copy link
Author

vch42 commented Jan 18, 2019

I don't have a comparative test for the memory usage and CPU performance with and without the feature enabled in the kernel, but I have a Pi with this enabled, which did not had it prior, and I do not see a noticeable difference in feel.
Sure, this is only based on "feel" and my own impression on how the device behaves. It is in no way an exact test. Plus, I am not very sure how I can produce such numbers, I am not very versed in such benchmarking on Linux.
However, not enabling the XATTR security namespace, but only the user namespace, leaves a lot of the uses of XATTR out of the picture due to lack of support. This increases the uselessness level of the previous activation of CONFIG_F2FS_FS_XATTR in the kernel.

@JamesH65
Copy link
Contributor

JamesH65 commented Aug 1, 2019

Did a quick recompile with this enabled - adds 352 bytes on the Pi4 zImage. Looking at the code, cannot see if having much of a effect on the performance, and it's only used when f2fs is being use I believe. So seems like an OK addition.

@JamesH65
Copy link
Contributor

JamesH65 commented Aug 1, 2019

@popcornmix @pelwell

@popcornmix
Copy link
Collaborator

Okay.

@JamesH65
Copy link
Contributor

@dom Not yet enabled - do we intend to do so?

@JamesH65 JamesH65 added the Waiting for internal comment Waiting for comment from a member of the Raspberry Pi engineering team label Sep 19, 2019
@ghost
Copy link

ghost commented Oct 15, 2021

If f2fs is intended to be usable for root filesystem, it makes sense for it to have feature parity with ext4 where possible. Currently, CONFIG_F2FS_FS_SECURITY appears to be the only config option missing:

# grep -C0 -e F2FS -e EXT4 /usr/src/linux-headers-5.10.17-v8+/.config 
CONFIG_EXT4_FS=y
CONFIG_EXT4_USE_FOR_EXT2=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
# CONFIG_EXT4_DEBUG is not set
--
CONFIG_F2FS_FS=y
CONFIG_F2FS_STAT_FS=y
CONFIG_F2FS_FS_XATTR=y
CONFIG_F2FS_FS_POSIX_ACL=y
# CONFIG_F2FS_FS_SECURITY is not set
# CONFIG_F2FS_CHECK_FS is not set
# CONFIG_F2FS_IO_TRACE is not set
# CONFIG_F2FS_FAULT_INJECTION is not set
# CONFIG_F2FS_FS_COMPRESSION is not set

As a specific example, F2FS_FS_SECURITY enables the use of setcap to grant capabilities to binaries (such as CAP_NET_RAW) instead of requiring them to be suid-root. This is used by the default-installed ping (if you update/--reinstall; I guess the imaging process doesn't support capabilities?):

# getcap /bin/* /sbin/*
/bin/fping = cap_net_raw+ep
/bin/mtr-packet = cap_net_raw+ep
/bin/ping = cap_net_raw+ep

@pelwell
Copy link
Contributor

pelwell commented Oct 18, 2021

This does indeed add very little code:

f2fs_init_inode_metadata 518 -> 530 (+18)
f2fs_add_regular_entry 5ec -> 5e8 (-4)
f2fs_hash_filename 24c -> 248 (-4)
f2fs_init_security 0 -> 34 (+34)
f2fs_initxattrs 0 -> 7c (+7c)

In fact the extra seems to get swallowed up in such a way that the memory map doesn't expand.

ext4 has exactly the same initialisation hook, but it configures a different set of attributes.

Since the code size change is negligible, and any (presumably tiny) runtime overhead only affects F2FS users (who might benefit from the change) I'm prepared to enable the config setting.

pelwell added a commit to pelwell/linux that referenced this issue Oct 18, 2021
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: raspberrypi#2778

Signed-off-by: Phil Elwell <[email protected]>
@pelwell
Copy link
Contributor

pelwell commented Oct 18, 2021

See #4637.

popcornmix pushed a commit that referenced this issue Oct 18, 2021
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
pelwell added a commit that referenced this issue Oct 19, 2021
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
pelwell added a commit that referenced this issue Oct 19, 2021
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Oct 19, 2021
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Oct 19, 2021
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Oct 22, 2021
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Oct 27, 2021
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
limeng-linux pushed a commit to limeng-linux/linux-yocto-develop that referenced this issue Oct 29, 2021
commit  b255b04ec51f85a74593ccc2e3e8a82e4227913a from
https://github.com/raspberrypi/linux.git rpi-5.15.y

Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: raspberrypi/linux#2778

Signed-off-by: Phil Elwell <[email protected]>
Signed-off-by: Meng Li <[email protected]>
popcornmix pushed a commit that referenced this issue Nov 1, 2021
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Nov 8, 2021
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Nov 8, 2021
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Nov 15, 2021
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Nov 15, 2021
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Nov 22, 2021
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Nov 22, 2021
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Nov 25, 2021
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Nov 29, 2021
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Dec 7, 2021
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Dec 16, 2021
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Dec 17, 2021
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Dec 22, 2021
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Dec 31, 2021
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Jan 5, 2022
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Jan 11, 2022
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Jan 11, 2022
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Jan 17, 2022
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Jan 24, 2022
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Jan 25, 2022
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
@streaps
Copy link

streaps commented Jan 26, 2022

Very good. I've just upgraded to the latest kernel (raspberrypi-kernel 1:1.20220120-1) and it is working as expected:

$ ./misdn_info
Cannot open mISDN due to Operation not permitted. (Does your Kernel support socket based mISDN?)

$ sudo setcap cap_net_raw+ep misdn_info 
$ getcap misdn_info 
misdn_info cap_net_raw=ep

$ ./misdn_info

Found 1 port
  Port  0 'HFC-S_USB.1':     TE/NT-mode BRI S/T (for phone lines & phones)
                              2 B-channels: 1-2
                                B-protocols: RAW HDLC X75slp

@pelwell pelwell closed this as completed Jan 26, 2022
popcornmix pushed a commit that referenced this issue Jan 28, 2022
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Jan 31, 2022
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Feb 7, 2022
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Feb 16, 2022
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Feb 18, 2022
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Feb 28, 2022
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Mar 4, 2022
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Mar 9, 2022
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Mar 15, 2022
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Mar 21, 2022
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
popcornmix pushed a commit that referenced this issue Mar 21, 2022
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: #2778

Signed-off-by: Phil Elwell <[email protected]>
Noltari pushed a commit to Noltari/rpi-linux that referenced this issue May 17, 2022
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: raspberrypi#2778

Signed-off-by: Phil Elwell <[email protected]>
asheplyakov pushed a commit to asheplyakov/linux that referenced this issue May 24, 2022
Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: raspberrypi/linux#2778

Signed-off-by: Phil Elwell <[email protected]>
papamoose pushed a commit to papamoose/ubuntu-kernel-raspi-jammy that referenced this issue Sep 3, 2022
BugLink: https://bugs.launchpad.net/bugs/1958146

Add a negligible amount of core kernel code for capability-based
access control on F2FS.

See: raspberrypi/linux#2778

Signed-off-by: Phil Elwell <[email protected]>

(cherry picked from commit bab33ae95bfc61f665599bc190ada426b3c79643 rpi-5.15.y)
Signed-off-by: Juerg Haefliger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Waiting for internal comment Waiting for comment from a member of the Raspberry Pi engineering team
Projects
None yet
Development

No branches or pull requests

5 participants