lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHC9VhQnfMkrRNmEe0FtcFis3pkPp7Xd8dUbE3cT+cSni-9qxA@mail.gmail.com>
Date:   Tue, 6 Dec 2022 15:26:27 -0500
From:   Paul Moore <paul@...l-moore.com>
To:     ye.xingchen@....com.cn
Cc:     stephen.smalley.work@...il.com, eparis@...isplace.org,
        selinux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH security-next] selinux: use sysfs_emit() to instead of scnprintf()

On Mon, Dec 5, 2022 at 6:32 AM <ye.xingchen@....com.cn> wrote:
> From: ye xingchen <ye.xingchen@....com.cn>
>
> Follow the advice of the Documentation/filesystems/sysfs.rst and show()
> should only use sysfs_emit() or sysfs_emit_at() when formatting the
> value to be returned to user space.
>
> Signed-off-by: ye xingchen <ye.xingchen@....com.cn>
> ---
>  security/selinux/avc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

SELinux uses securityfs, not sysfs, for entries under /sys/fs/selinux.

> diff --git a/security/selinux/avc.c b/security/selinux/avc.c
> index 9a43af0ebd7d..517fe3454aec 100644
> --- a/security/selinux/avc.c
> +++ b/security/selinux/avc.c
> @@ -174,7 +174,7 @@ int avc_get_hash_stats(struct selinux_avc *avc, char *page)
>
>         rcu_read_unlock();
>
> -       return scnprintf(page, PAGE_SIZE, "entries: %d\nbuckets used: %d/%d\n"
> +       return sysfs_emit(page, "entries: %d\nbuckets used: %d/%d\n"
>                          "longest chain: %d\n",
>                          atomic_read(&avc->avc_cache.active_nodes),
>                          slots_used, AVC_CACHE_SLOTS, max_chain_len);
> --
> 2.25.1

-- 
paul-moore.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ