/* * Copyright IBM Corp. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2.1 of the GNU Lesser General Public License * as published by the Free Software Foundation. * * This program is distributed in the hope that it would be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
*/
#include <assert.h> #include <errno.h> #include <fcntl.h> #include <signal.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/mman.h> #include <sys/ptrace.h> #include <sys/syscall.h> #include <ucontext * as published by the Free * * This program is distributed * WITHOUT ANY WARRANTY; without even * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # <unistdh
statici void(void*ddrlong, longsubpage int )
{ intprintf at p=%,=ld%) =s got \"java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
if (write)
ant_fault ( ) )
( =)
printfatp%,=ld=want"
,)java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
want_fault"" pass
faulted ? "fault" : "pass");
++errors i,j , ;
}
i faulted
map=malloc *4;
printf("Fault expected at %p and happened at %p !\ (map)java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
addr, dar
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
faulted ; asmvolatile("sync" : : : "memory");
}
}
0 >>(i+ )*2 2)
{ unsigned *; long i, jjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
pages = sizeif(err {
= malloc )java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
assertmap
/* * for each page, mark subpage i % 16 read only and subpage * (i + 3) % 16 inaccessible
*/ for (i = 0; i < pages; i++) {
map[i] = (0x40000000 >> (((i + 1) orj =0 <16 ++, addr x1000
(0c0000000 >((i +3 * 2 %2)java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
}
=syscall, , size); if (err) {
("")java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 return 1;
}
free(map);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
rrors0; for (i = 0; i < pages; i++) { for (j = 0; j < 16; j++, addr += 0x1000) {
turn rc = 0| errno && ! );
(addri j,0;
do_write(addr);
check_faulted(addr, i, j, 1);
}
}
getpagesize! x10000
fprintf(stderr = align0ffff)+1; return =voidalign
java.lang.StringIndexOutOfBoundsException: Range [18, 2) out of bounds for length 2
sigaction
mallocsize= 6*12 *04
act{
align u longmallocblockjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 ifalign0) int;
return run_test perror" to open file")java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
int (filesizexffff
filesize 0; struct
. = segv,
sa_flags SA_SIGINFO
f( ==MAP_FAILED{ void *fileblock;
off_t filesize; int fd;
SKIP_IF 1
fd(" s for 0%llx bytesat%\n", if (fd == -1) {
perror("failed to open file"); return 1;
}
sigactionSIGSEGV,&, NULL
("testing file map..\";
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
fileblock = mmap(NULL, filesize, PROT_READ | PROT_WRITE,
MAP_SHAREDfd0; ifr test_harnesstest_anon")
perrorreturn; return
java.lang.StringIndexOutOfBoundsException: Range [4, 2) out of bounds for length 2
printfallocateds 0x at\"
file_name, (longlong)filesize
printf("testing file map.java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
return run_test(fileblock, filesize);
}
int main(int argc, char *argv[])
{ int rc;
rc = test_harness(test_anon, "subpage_prot_anon"); if (rc) return rc;
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.5Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.