Skip to contentSkip to conversation

memory used by SE Linux

DISCUSSION Russell Coker 1 participant 2 messages May 15, 2003 SELinux security module

lore
Share & tools
lore
#0 lore raw

Here is some raw data about SE Linux memory use on ARM. I haven't previously done any checks on i386 because my i386 machines are so big that it doesn't matter. Eventually I'll probably look into i386 memory usage to compare.

All tests were done on a machine with kernel module loading disabled and minimal functionality. The proceedure was to login on a serial terminal and run free as soon as the machine was functional.

Non-SE kernel 2.4.19-rmk6-pxa1-hh11 (just for a quick test - the differences between hh11 and hh12 aren't great, but I'll have to compile them both with the same compiler etc for a proper test).

total used free shared buffers
Mem: 63404 18408 44996 0 0
Swap: 0 0 0
Total: 63404 18408 44996

Memory with SE Linux kernel 2.4.19-rmk6-pxa1-hh12-se2 but no policy:

total used free shared buffers
Mem: 63284 20784 42500 0 0
Swap: 0 0 0
Total: 63284 20784 42500

So apart from the issue of different memory use by the minor kernel revision and the potential for different compiler having different memory use (which I will test tomorrow) it appears that 2376K of data may be used for SE Linux. This can't be right, I'll have to recompile both kernels with exactly the same options to re-test this.

Memory with same SE Linux kernel and 85837byte compressed (583771 byte uncompressed) policy:
total used free shared buffers
Mem: 63284 22084 41200 0 0
Swap: 0 0 0
Total: 63284 22084 41200

It seems that 1300K is used by the active policy. Would I be correct in assuming that the AVC cache would also consume more memory once the machine is in full operation and more domain-type combinations are in the cache?

Apart from making the policy smaller (which I am working on), is there any easy way of reducing the kernel memory use of SE Linux? 5% of RAM seems like a lot when there's no swap.

Signature · 10 lines
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#1 lore raw
Quoted 4 lines · Russell Coker

Here is some raw data about SE Linux memory use on ARM. I haven't previously done any checks on i386 because my i386 machines are so big that it doesn't matter. Eventually I'll probably look into i386 memory usage to compare.

I've just dome some new tests with kernel 2.4.19-rmk6-pxa1-hh13.

Here is a table of the size of the bzImage file and the amount of memory free (according to the "free" command) when logging in at the serial console 30 seconds after boot. For the free memory I have two columns, one for a kernel with no security policy loaded, and one for a kernel with. SE-enforce is a kernel compiled without development mode (so it can't boot without policy). vanilla is a non-SE kernel so it can't load policy.

kernel size(b) mem-free(no policy) mem-free(policy)
vanilla 658648 45152
SE-enforce 704708 43776
SE-devel 705560 45000 43776

This seems more reasonable. 152K apparently used by the SE kernel code when it is doing nothing, and a further 1224K used when loading a 583771 byte uncompressed policy, giving a total of 1374K used by SE Linux.

This test isn't as accurate as I would like. There are lots of things that the kernel does which use memory which I have no ability to monitor or prevent. But I think this is a reasonable approximation.

Below is the raw data. One interesting thing to note is that when booting a kernel compiled without "development mode" 8K less kernel memory is used, but an extra 8K is apparently used somewhere else to give the same amount of memory reported as free. I expect that this is just due to a race condition, and that I can probably repeat all the tests to see a ~8K difference.

vanilla
total used free shared buffers
Mem: 63412 18260 45152 0 0
Swap: 0 0 0
Total: 63412 18260 45152

enforcing policy:
total used free shared buffers
Mem: 63308 19532 43776 0 0
Swap: 0 0 0
Total: 63308 19532 43776

devel policy:
total used free shared buffers
Mem: 63300 19524 43776 0 0
Swap: 0 0 0
Total: 63300 19524 43776

devel no-pol:
total used free shared buffers
Mem: 63300 18300 45000 0 0
Swap: 0 0 0
Total: 63300 18300 45000

Signature · 10 lines
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.