From: Stephen Smalley <sds@tycho.nsa.gov>
To: zhanglin <zhang.lin16@zte.com.cn>, paul@paul-moore.com
Cc: eparis@parisplace.org, selinux@vger.kernel.org,
xue.zhihong@zte.com.cn, wang.yi59@zte.com.cn,
jiang.xuexin@zte.com.cn
Subject: Re: [PATCH] selinux: improve performance of sel_write_load()
Date: Wed, 18 Sep 2019 08:28:35 -0400 [thread overview]
Message-ID: <8224bb2e-98e9-1ed6-3e0f-a7a75607051d@tycho.nsa.gov> (raw)
In-Reply-To: <1568704836-14357-1-git-send-email-zhang.lin16@zte.com.cn>
On 9/17/19 3:20 AM, zhanglin wrote:
> remove unecessary multiplications of sel_write_load().
I'm not sure it is really a performance improvement since the compiler
generates the same code (at least on x86_64). I'm wondering though
whether we still need this check at all. It was originally patterned
after a similar check for loading kernel modules, which was removed in
f946eeb9313ff147075 ("module: Remove module size limit").
>
> Signed-off-by: zhanglin <zhang.lin16@zte.com.cn>
> ---
> security/selinux/selinuxfs.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
> index f3a5a138a096..4b2d87b6fcf9 100644
> --- a/security/selinux/selinuxfs.c
> +++ b/security/selinux/selinuxfs.c
> @@ -117,6 +117,7 @@ static void selinux_fs_info_free(struct super_block *sb)
> #define SEL_CLASS_INO_OFFSET 0x04000000
> #define SEL_POLICYCAP_INO_OFFSET 0x08000000
> #define SEL_INO_MASK 0x00ffffff
> +#define SEL_LOAD_MAX 0x04000000
>
> #define TMPBUFLEN 12
> static ssize_t sel_read_enforce(struct file *filp, char __user *buf,
> @@ -550,7 +551,7 @@ static ssize_t sel_write_load(struct file *file, const char __user *buf,
> goto out;
>
> length = -EFBIG;
> - if (count > 64 * 1024 * 1024)
> + if (count > SEL_LOAD_MAX)
> goto out;
>
> length = -ENOMEM;
>
prev parent reply other threads:[~2019-09-18 12:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-17 7:20 [PATCH] selinux: improve performance of sel_write_load() zhanglin
2019-09-18 12:28 ` Stephen Smalley [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8224bb2e-98e9-1ed6-3e0f-a7a75607051d@tycho.nsa.gov \
--to=sds@tycho.nsa.gov \
--cc=eparis@parisplace.org \
--cc=jiang.xuexin@zte.com.cn \
--cc=paul@paul-moore.com \
--cc=selinux@vger.kernel.org \
--cc=wang.yi59@zte.com.cn \
--cc=xue.zhihong@zte.com.cn \
--cc=zhang.lin16@zte.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).