summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/vm/on-fault-limit.c
blob: 0ae458f32fdb90c0ad0ac7c05086c5e4f34d7ed4 (plain)
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
37
38
39
40
41
42
43
44
45
46
47
#include <sys/mman.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <sys/time.h>
#include <sys/resource.h>

#ifndef MCL_ONFAULT
#define MCL_ONFAULT (MCL_FUTURE << 1)
#endif

static int test_limit(void)
{
	int ret = 1;
	struct rlimit lims;
	void *map;

	if (getrlimit(RLIMIT_MEMLOCK, &lims)) {
		perror("getrlimit");
		return ret;
	}

	if (mlockall(MCL_ONFAULT | MCL_FUTURE)) {
		perror("mlockall");
		return ret;
	}

	map = mmap(NULL, 2 * lims.rlim_max, PROT_READ | PROT_WRITE,
		   MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, 0, 0);
	if (map != MAP_FAILED)
		printf("mmap should have failed, but didn't\n");
	else {
		ret = 0;
		munmap(map, 2 * lims.rlim_max);
	}

	munlockall();
	return ret;
}

int main(int argc, char **argv)
{
	int ret = 0;

	ret += test_limit();
	return ret;
}
469&id2=fa19a769f82fb9a5ca000b83cacd13fcaeda51ac'>diff)
objtool: Fix IRET's opcode
The IRET opcode is 0xcf according to the Intel manual and also to objdump of my vmlinux: 1ea8: 48 cf iretq Fix the opcode in arch_decode_instruction(). The previous value (0xc5) seems to correspond to LDS. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/20170118132921.19319-1-jslaby@suse.cz Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'sound/isa/galaxy/azt2316.c')