4.4 The section size recorder


annocheck
  [--disable-hardened]
  [--size-sec=name]
  [--size-sec-flags=!WAX]
  [--size-seg-flags=!WRX]
  [--size-human]
  [--size-total]
  [--size-missing]
  [--disable-size]
  file...

The section-size tool records the size of named sections within a list of files and then reports the accumulated size at the end. Since it is part of the annocheck framework, it is able to handle directories and rpms files as well as ordinary binary files.

The --size-sec=name option enables the tool and tells it to record the size of section name. The option can be repeated multiple times to record the sizes of multiple sections. It may also be useful to add the --disable-hardened option to the command line as otherwise the security hardening will be run at the same time.

Instead of searching for named sections, it is also possible to search for sections with specific flags. The --size-sec-flags=<flags> option will search for any section that has all of the specified <flags> set. Currently only W, A and X are recognised as flags, indicating that the section must have the Write, Alloc or Execute flags set respectively. If the ! exclamation mark character is present then it negates the meaning of the following flags. Thus --section-sec-flags=W option will search for any writable section whereas the --size-sec-flags=W!A option will search only for sections that are writable but not allocated.

Instead of searching for sections by flags it is also possible to search for segments by flags using the --size-seg-flags=<flags> option. The flags recognised for segments are W for writable, R for readable and X for executable. Again the ! character can be used to invert the meaning of the flags that follow it.

If the --verbose option is enabled, then the tool will also report the size of the named section(s) in each file it encounters.

If the --size-human option is enabled then sizes will be rounded down to the nearest byte, kibibyte, mebibyte or gibibyte, as appropriate.

If the --size-total option is enabled then the total size of all sections in all scanned files will also be reported, as well as the ratio of the reported section sizes to the total section size.

If the --size-missing option is enabled then any valid ELF format input file that does not contain any of the sought sections will be reported.

If previously enabled the tool can be disabled via the --disable-size command line option.