From: Kurt Garloff <garloff@suse.de>
To: Linux kernel list <linux-kernel@vger.kernel.org>
Cc: Chris Wright <chrisw@osdl.org>,
Stephen Smalley <sds@epoch.ncsc.mil>,
James Morris <jmorris@redhat.com>,
Greg Kroah-Hartman <gregkh@suse.de>,
Steve Beattie <smb@wirex.com>
Subject: [PATCH 3/3] Use conditional
Date: Sun, 3 Jul 2005 17:44:05 +0200 [thread overview]
Message-ID: <20050703154405.GE11093@tpkurt.garloff.de> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 364 bytes --]
Hi,
this optimizes the case where no LSM is loaded and the (new) default
capablities is used. These are not called via indirect calls but
called as hardcoded calls and might thus be inlined; the price for
this is a conditional -- benchmarks done by hp showed this to be
beneficial (on ia64).
Enjoy,
--
Kurt Garloff, Director SUSE Labs, Novell Inc.
[-- Attachment #1.2: security-avoid-indir-call --]
[-- Type: text/plain, Size: 2522 bytes --]
From: Kurt Garloff <garloff@suse.de>
Subject: Replace indirect calls by a branch
References: SUSE40217, SUSE39439
In the LSM stub collection, rather do a branch than an indirect
call. Many of the functions called do only return 0 or do nothing
for the default (capability) case.
This is a fast-path optimization; a branch is faster than an
indirect call, even more so if correctly predicted.
This shows a >3% perf. increase in netperf -t TCP_RR benchmark on IA64.
(More exactly: The benchmark was taken with the next two patches
applied as well, but I attribute the main effect to this patch.)
This is patch 3/5 of the LSM overhaul.
include/linux/security.h | 6 +++++-
security/security.c | 2 --
2 files changed, 5 insertions(+), 3 deletions(-)
Signed-off-by: Kurt Garloff <garloff@suse.de>
Index: linux-2.6.12/include/linux/security.h
===================================================================
--- linux-2.6.12.orig/include/linux/security.h
+++ linux-2.6.12/include/linux/security.h
@@ -1246,17 +1246,21 @@ struct security_operations {
};
/* global variables */
extern struct security_operations *security_ops;
+/* default security ops */
+extern struct security_operations capability_security_ops;
/* prototypes */
extern int security_init (void);
extern int register_security (struct security_operations *ops);
extern int unregister_security (struct security_operations *ops);
extern int mod_reg_security (const char *name, struct security_operations *ops);
extern int mod_unreg_security (const char *name, struct security_operations *ops);
-# define COND_SECURITY(seop, def) security_ops->seop
+/* Condition for invocation of non-default security_op */
+# define COND_SECURITY(seop, def) \
+ (security_ops == &capability_security_ops)? def: security_ops->seop
# else /* CONFIG_SECURITY */
static inline int security_init(void)
{
Index: linux-2.6.12/security/security.c
===================================================================
--- linux-2.6.12.orig/security/security.c
+++ linux-2.6.12/security/security.c
@@ -21,10 +21,8 @@
#define SECURITY_FRAMEWORK_VERSION "1.0.0"
/* things that live in dummy.c */
extern void security_fixup_ops (struct security_operations *ops);
-/* default security ops */
-extern struct security_operations capability_security_ops;
struct security_operations *security_ops; /* Initialized to NULL */
static inline int verify(struct security_operations *ops)
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next reply other threads:[~2005-07-03 15:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-03 15:44 Kurt Garloff [this message]
2005-07-03 16:51 ` James Morris
2005-07-03 21:17 ` Kurt Garloff
2005-07-03 19:00 ` Tony Jones
2005-07-04 6:59 ` Kurt Garloff
2005-07-04 7:44 ` Tony Jones
2005-07-04 12:01 ` serge
2005-07-04 12:08 ` Kurt Garloff
2005-07-04 12:37 ` serge
2005-07-04 13:31 ` Kurt Garloff
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=20050703154405.GE11093@tpkurt.garloff.de \
--to=garloff@suse.de \
--cc=chrisw@osdl.org \
--cc=gregkh@suse.de \
--cc=jmorris@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sds@epoch.ncsc.mil \
--cc=smb@wirex.com \
/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
all inboxes | Powered by JetHome®