Date: Thu, 30 Jul 2020 22:14:04 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r363714 - head/sys/kern Message-ID: <202007302214.06UME4Iw047348@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Thu Jul 30 22:14:04 2020 New Revision: 363714 URL: https://svnweb.freebsd.org/changeset/base/363714 Log: Further depessimize priv_check_cred_vfs_generation Modified: head/sys/kern/kern_priv.c Modified: head/sys/kern/kern_priv.c ============================================================================== --- head/sys/kern/kern_priv.c Thu Jul 30 22:13:15 2020 (r363713) +++ head/sys/kern/kern_priv.c Thu Jul 30 22:14:04 2020 (r363714) @@ -247,8 +247,8 @@ priv_check(struct thread *td, int priv) return (priv_check_cred(td->td_ucred, priv)); } -int -priv_check_cred_vfs_generation(struct ucred *cred) +static int __noinline +priv_check_cred_vfs_generation_slow(struct ucred *cred) { int error; @@ -270,4 +270,19 @@ priv_check_cred_vfs_generation(struct ucred *cred) out: return (priv_check_cred_post(cred, PRIV_VFS_GENERATION, error, true)); +} + +int +priv_check_cred_vfs_generation(struct ucred *cred) +{ + int error; + + if (__predict_false(mac_priv_check_fp_flag || + mac_priv_grant_fp_flag || SDT_PROBES_ENABLED())) + return (priv_check_cred_vfs_generation_slow(cred)); + + error = EPERM; + if (!jailed(cred) && cred->cr_uid == 0 && suser_enabled) + error = 0; + return (error); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007302214.06UME4Iw047348>