4

I'm doing some research in security of Linux-based OS. Specially, I'm trying to understand the structure of Linux (non-crypto) Swap file / Swap partition. For my research, I use Linux Ubuntu 16.06 x64.

And now I have 2 questions:

  1. Did anybody of Your had seen documentation about structure of swap partition?
  2. Does anybody knows something about mechanisms of integrity assurance of Swap partition? Now, when I change some of bytes in Swap partirion of Hibernated System (total length is the same!) with powered-off system and save changes, Linux trying to start system from Hibernation and can't apply my changes. Looks like start not from Hibernation, but like start "from zero", from powered-off clear system.

Maybe, Swap Partition has hash-based summary, or some attributes with changed_time?

3
  • Welcome to Ask Ubuntu! It is preferred if you can post separate questions instead of combining your questions into one. That way, it helps the people answering your question and also others hunting for atleast one of your questions. Thanks!
    – guntbert
    Jun 4, 2017 at 20:39
  • You may find this useful: kernel.org/doc/gorman/html/understand/understand014.html Jun 5, 2017 at 4:59
  • I'm voting to close this question as off-topic because it's asking about the explanation and/or documentation of kernel features that are not specific to Ubuntu and would be far better over on Unix & Linux. Jun 5, 2017 at 8:27

1 Answer 1

2

Since Linux is Free, Open Source Software, you could download the source sudo apt-get install linux-source-4.4.0 and look at these files:

w3@aardvark:/usr/src/linux-source-4.4.0(130)$ tar tvf linux-source-4.4.0.tar.bz2| grep -i swap
-rw-r--r-- root/root      1278 2017-04-27 11:28 linux-source-4.4.0/spl/include/sys/fs/swapnode.h
-rw-r--r-- root/root     36409 2016-01-10 18:01 linux-source-4.4.0/drivers/mtd/mtdswap.c
-rw-r--r-- root/root      6169 2016-01-10 18:01 linux-source-4.4.0/drivers/net/wireless/ath/ath10k/swap.c
-rw-r--r-- root/root      2262 2016-01-10 18:01 linux-source-4.4.0/drivers/net/wireless/ath/ath10k/swap.h
-rw-r--r-- root/root       502 2017-04-27 11:28 linux-source-4.4.0/arch/mips/lib/bswapdi.c
-rw-r--r-- root/root       254 2017-04-27 11:28 linux-source-4.4.0/arch/mips/lib/bswapsi.c
-rw-r--r-- root/root       610 2016-01-10 18:01 linux-source-4.4.0/arch/arm/lib/bswapsdi2.S
-rw-r--r-- root/root       417 2016-01-10 18:01 linux-source-4.4.0/include/linux/swapfile.h
-rw-r--r-- root/root      2752 2016-01-10 18:01 linux-source-4.4.0/include/linux/frontswap.h
-rw-r--r-- root/root       876 2016-01-10 18:01 linux-source-4.4.0/include/linux/swap_cgroup.h
-rw-r--r-- root/root      6038 2016-01-10 18:01 linux-source-4.4.0/include/linux/swapops.h
-rw-r--r-- root/root     18137 2017-04-27 11:28 linux-source-4.4.0/include/linux/swap.h
-rw-r--r-- root/root     38097 2016-01-10 18:01 linux-source-4.4.0/kernel/power/swap.c
-rw-r--r-- root/root       251 2016-01-10 18:01 linux-source-4.4.0/tools/build/feature/test-sync-compare-and-swap.c
-rw-r--r-- root/root      5738 2017-04-27 11:28 linux-source-4.4.0/zfs/module/zfs/zfs_byteswap.c
-rw-r--r-- root/root      2768 2016-01-10 18:01 linux-source-4.4.0/Documentation/power/swsusp-and-swap-files.txt
-rw-r--r-- root/root      5282 2016-01-10 18:01 linux-source-4.4.0/Documentation/vm/zswap.txt
-rw-r--r-- root/root     15384 2016-01-10 18:01 linux-source-4.4.0/Documentation/vm/frontswap.txt
-rw-r--r-- root/root     13398 2016-01-10 18:01 linux-source-4.4.0/mm/swap_state.c
-rw-r--r-- root/root     33755 2017-04-27 11:28 linux-source-4.4.0/mm/zswap.c
-rw-r--r-- root/root     79828 2017-04-27 11:28 linux-source-4.4.0/mm/swapfile.c
-rw-r--r-- root/root     32859 2016-01-10 18:01 linux-source-4.4.0/mm/swap.c
-rw-r--r-- root/root     14595 2016-01-10 18:01 linux-source-4.4.0/mm/frontswap.c
-rw-r--r-- root/root      4732 2016-01-10 18:01 linux-source-4.4.0/mm/swap_cgroup.c

They all have swap in their filenames, and might have something to do with swap.

Not the answer you're looking for? Browse other questions tagged or ask your own question.