tools/testing/selftests/powerpc/mm/large_vm_gpr_corruption.c

Source file repositories/reference/linux-study-clean/tools/testing/selftests/powerpc/mm/large_vm_gpr_corruption.c

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/powerpc/mm/large_vm_gpr_corruption.c
Extension
.c
Size
4858 bytes
Lines
159
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

if (p == MAP_FAILED) {
			perror("mmap");
			printf("Error: couldn't mmap(), confirm kernel has 4PB support?\n");
			return 1;
		}
	}

	action.sa_handler = signal_handler;
	action.sa_flags = SA_RESTART;
	FAIL_IF(sigaction(SIGALRM, &action, NULL) < 0);

	// Seen to always crash in under ~10s on affected kernels.
	alarm(30);

	while (!signaled) {
		// Fork new processes, to increase the chance that we hit the case where
		// the kernel stack and task struct are in different segments.
		pid = fork();
		if (pid == 0)
			exit(touch_mappings());

		FAIL_IF(waitpid(-1, &status, 0) == -1);
		FAIL_IF(WIFSIGNALED(status));
		FAIL_IF(!WIFEXITED(status));
		FAIL_IF(WEXITSTATUS(status));
	}

	return 0;
}

int main(void)
{
	return test_harness(test, "large_vm_gpr_corruption");
}

Annotation

Implementation Notes