File: test-vm.sh

package info (click to toggle)
trinity 1.8-6
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 4,284 kB
  • sloc: ansic: 33,847; sh: 536; makefile: 234
file content (36 lines) | stat: -rwxr-xr-x 720 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
#
# This script demonstrates hunting for a VM bug that involved mmap + some other
# VM related syscall.

. scripts/paths.sh
. scripts/privs.sh
. scripts/taint.sh

chmod 755 $TRINITY_TMP
cd $TRINITY_TMP

while [ 1 ];
do
  for syscall in madvise mbind migrate_pages mincore mlockall mlock move_pages mprotect mremap msync munlockall munlock munmap remap_file_pages vmsplice
  do
	echo testing mmap + $syscall
	pushd $TRINITY_TMP > /dev/null

	if [ ! -f $TRINITY_PATH/trinity ]; then
		echo lost!
		pwd
		exit
	fi

	MALLOC_CHECK_=2 $TRINITY_PATH/trinity -q -l off -c mmap -c $syscall -N 1000000 -C 64 $DROPPRIVS

	chmod 755 $TRINITY_TMP
	popd > /dev/null

	check_tainted
	echo
	echo
  done
  check_tainted
done