mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* oprofile / selinux / security_port_sid
@ 2007-03-27 10:06 Sami Farin
  2007-03-27 13:40 ` Stephen Smalley
  0 siblings, 1 reply; 4+ messages in thread
From: Sami Farin @ 2007-03-27 10:06 UTC (permalink / raw)
  To: linux-kernel Mailing List

is there room for improvement in security_port_sid() ?

little test with dns queries (dnsfilter (the client) on local host
using poll() and dnscache (the server) using epoll (at max 4000 concurrent
queries):
(stats for only vmlinux)

CPU: P4 / Xeon, speed 2797.32 MHz (estimated)
Counted GLOBAL_POWER_EVENTS events (time during which processor is not stopped) with a unit mask of 0x01 (mandatory) count 45000
Counted FSB_DATA_ACTIVITY events (DRDY or DBSY events on the front side bus) with a unit mask of 0x03 (multiple flags) count 45000
Counted BRANCH_RETIRED events (retired branches) with a unit mask of 0x05 (multiple flags) count 45000
Counted BRANCH_RETIRED events (retired branches) with a unit mask of 0x0a (multiple flags) count 45000
samples  %        samples  %        samples  %        samples  %        symbol name
220663   10.2181  6704     17.9737  5735      7.5171  27        1.1989  datagram_poll
140086    6.4869  3239      8.6839  3786      4.9624  24        1.0657  sock_poll
119636    5.5399  2172      5.8232  7168      9.3954  24        1.0657  do_poll
101512    4.7006  3987     10.6893  812       1.0643  14        0.6217  udp_get_port
71008     3.2881  1017      2.7266  2694      3.5311  397      17.6288  security_port_sid
64350     2.9798  144       0.3861  1912      2.5061  6         0.2664  add_wait_queue
60815     2.8161  187       0.5014  3246      4.2546  2         0.0888  remove_wait_queue
47456     2.1975  1823      4.8875  476       0.6239  31        1.3766  udp_v4_lookup_longway

if dnsfilter had used epoll, security_port_sid would
probably (?) be number one (or two or three) CPU user in kernel.

also note that 17.6% of mispredicted branches occurr in security_port_sid.

-- 
Do what you love because life is too short for anything else.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: oprofile / selinux / security_port_sid
  2007-03-27 10:06 oprofile / selinux / security_port_sid Sami Farin
@ 2007-03-27 13:40 ` Stephen Smalley
  2007-03-27 13:54   ` Sami Farin
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Smalley @ 2007-03-27 13:40 UTC (permalink / raw)
  To: Sami Farin; +Cc: linux-kernel Mailing List, James Morris, Eric Paris

On Tue, 2007-03-27 at 13:06 +0300, Sami Farin wrote:
> is there room for improvement in security_port_sid() ?

Yes, lots of room.  Also, it won't get called per-packet if you enable
secmark (echo 0 > /selinux/compat_net or boot with selinux_compat_net=0
or build with SECURITY_SELINUX_ENABLE_SECMARK_DEFAULT), although that
may require updating your policy.

> little test with dns queries (dnsfilter (the client) on local host
> using poll() and dnscache (the server) using epoll (at max 4000 concurrent
> queries):
> (stats for only vmlinux)
> 
> CPU: P4 / Xeon, speed 2797.32 MHz (estimated)
> Counted GLOBAL_POWER_EVENTS events (time during which processor is not stopped) with a unit mask of 0x01 (mandatory) count 45000
> Counted FSB_DATA_ACTIVITY events (DRDY or DBSY events on the front side bus) with a unit mask of 0x03 (multiple flags) count 45000
> Counted BRANCH_RETIRED events (retired branches) with a unit mask of 0x05 (multiple flags) count 45000
> Counted BRANCH_RETIRED events (retired branches) with a unit mask of 0x0a (multiple flags) count 45000
> samples  %        samples  %        samples  %        samples  %        symbol name
> 220663   10.2181  6704     17.9737  5735      7.5171  27        1.1989  datagram_poll
> 140086    6.4869  3239      8.6839  3786      4.9624  24        1.0657  sock_poll
> 119636    5.5399  2172      5.8232  7168      9.3954  24        1.0657  do_poll
> 101512    4.7006  3987     10.6893  812       1.0643  14        0.6217  udp_get_port
> 71008     3.2881  1017      2.7266  2694      3.5311  397      17.6288  security_port_sid
> 64350     2.9798  144       0.3861  1912      2.5061  6         0.2664  add_wait_queue
> 60815     2.8161  187       0.5014  3246      4.2546  2         0.0888  remove_wait_queue
> 47456     2.1975  1823      4.8875  476       0.6239  31        1.3766  udp_v4_lookup_longway
> 
> if dnsfilter had used epoll, security_port_sid would
> probably (?) be number one (or two or three) CPU user in kernel.
> 
> also note that 17.6% of mispredicted branches occurr in security_port_sid.
> 
-- 
Stephen Smalley
National Security Agency


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: oprofile / selinux / security_port_sid
  2007-03-27 13:40 ` Stephen Smalley
@ 2007-03-27 13:54   ` Sami Farin
  2007-03-27 14:12     ` James Morris
  0 siblings, 1 reply; 4+ messages in thread
From: Sami Farin @ 2007-03-27 13:54 UTC (permalink / raw)
  To: Stephen Smalley; +Cc: linux-kernel Mailing List, James Morris, Eric Paris

On Tue, Mar 27, 2007 at 09:40:23 -0400, Stephen Smalley wrote:
> On Tue, 2007-03-27 at 13:06 +0300, Sami Farin wrote:
> > is there room for improvement in security_port_sid() ?
> 
> Yes, lots of room.  Also, it won't get called per-packet if you enable
> secmark (echo 0 > /selinux/compat_net or boot with selinux_compat_net=0
> or build with SECURITY_SELINUX_ENABLE_SECMARK_DEFAULT), although that
> may require updating your policy.

Hmm, test was done with
CONFIG_NETWORK_SECMARK=y
CONFIG_SECURITY_SELINUX_ENABLE_SECMARK_DEFAULT=y
and /selinux/compat_net = 0

-- 
Do what you love because life is too short for anything else.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: oprofile / selinux / security_port_sid
  2007-03-27 13:54   ` Sami Farin
@ 2007-03-27 14:12     ` James Morris
  0 siblings, 0 replies; 4+ messages in thread
From: James Morris @ 2007-03-27 14:12 UTC (permalink / raw)
  To: Sami Farin; +Cc: Stephen Smalley, linux-kernel Mailing List, Eric Paris

On Tue, 27 Mar 2007, Sami Farin wrote:

> On Tue, Mar 27, 2007 at 09:40:23 -0400, Stephen Smalley wrote:
> > On Tue, 2007-03-27 at 13:06 +0300, Sami Farin wrote:
> > > is there room for improvement in security_port_sid() ?
> > 
> > Yes, lots of room.  Also, it won't get called per-packet if you enable
> > secmark (echo 0 > /selinux/compat_net or boot with selinux_compat_net=0
> > or build with SECURITY_SELINUX_ENABLE_SECMARK_DEFAULT), although that
> > may require updating your policy.
> 
> Hmm, test was done with
> CONFIG_NETWORK_SECMARK=y
> CONFIG_SECURITY_SELINUX_ENABLE_SECMARK_DEFAULT=y
> and /selinux/compat_net = 0

Even with this setting, you'll be hitting security_port_sid() via 
connect(2) and bind(2).  We need to fix it.



- James
-- 
James Morris
<jmorris@namei.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-03-27 15:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-27 10:06 oprofile / selinux / security_port_sid Sami Farin
2007-03-27 13:40 ` Stephen Smalley
2007-03-27 13:54   ` Sami Farin
2007-03-27 14:12     ` James Morris

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®