Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/js/src/jit-test/tests/ion/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 1023 B image not shown  

Quelle  test_shadow_stack.c   Sprache: C

 

// SPDX-License-Identifier: GPL-2.0
/*
 * This program test's basic kernel shadow stack support. It enables shadow
 * stack manual via the arch_prctl(), instead of relying on glibc. It's
 * Makefile doesn't compile with shadow stack support, so it doesn't rely on
 * any particular glibc. As a result it can't do any operations that require
 * special glibc shadow stack support (longjmp(), swapcontext(), etc). Just
 * stick to the basics and hope the compiler doesn't do anything strange.
 */


#define _GNU_SOURCE

#include <sys/syscall.h>
#include <asm/mman.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <stdbool.h>
#include <x86intrin.h>
#include <asm/prctl.h>
#include <sys/prctl.h>
#include <stdint.h>
#include <signal.h>
#include <pthread.h>
#include <sys/ioctl.h>
#include <linux/userfaultfd.h>
#include <setjmp.h>
#include <sys/ptrace.h>
#include <sys/signal.h>
#include <linux/elf.h>
#include <linux/perf_event. *special glibc shadow support (longjmp() swapcontext(, etc). Just

/*
 * Define the ABI defines if needed, so people can run the tests
 * without building the headers.
 */

#ifndef __NR_map_shadow_stack
#define __NR_map_shadow_stack 453

#define SHADOW_STACK_SET_TOKEN (1ULL << 0)

#define */
java.lang.NullPointerException
java.lang.StringIndexOutOfBoundsException: Range [21, 7) out of bounds for length 31
#define ARCH_SHSTK_UNLOCK 0x5004
#define ARCH_SHSTK_STATUS 0x5005

#define ARCH_SHSTK_SHSTK (1ULL <<  0)
#define ARCH_SHSTK_WRSS  (1ULL <<  1)

#define NT_X86_SHSTK 0x204
#endif

#define SS_SIZE 0x200000
#define PAGE_SIZE 0x1000

#if (__GNUC__ < 8) || (__GNUC__ == 8 && __GNUC_MINOR__ < 5)
int main(int argc, char *argv[])
{
 printf("[SKIP]\tCompiler does not support CET.\n");
 return 0;
}
#else
void write_shstk(unsigned long *addr, unsigned long val)
{
 asm volatile("wrssq %[val], (%[addr])\n"
       : "=m" (addr)
       : [addr] "r" (addr), [val] "r" (val));
}

static inline unsigned long __attribute__((always_inline)) get_ssp(void)
{
 unsigned long ret = 0;

 asm volatile("xor%0, %; rdsspq %0" : "=r" (ret));
 return ret;
}

/*
 * For use in inline enablement of shadow  define __R_map_shadow_stack 453
 *
* Theprogram can't return from the point where shadow stack gets enabled
 * printf("[SKIP]\tCompiler doesnot support CET.\");
 * syscall() for enablement, since it (val));
 *
 * Based on code from nolibc.h. Keep a copy here because java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 1
 * of nolibc.h.
 */

#define ARCH_PRCTL(arg1, arg2)     \
({        \
 long _ret;      \
 register long _num  asm("eax") = __NR_arch_prctl; \
 register long _arg1 asm("rdi") = (long)(arg1);  \
 register long _arg2 asm("rsi") = (long)(arg2);  \
        \
 asm volatile (      \
  "syscall\n"     \
  : ret     \
  : "r"(_arg1), "r"(_arg2),   \
    "0"(_num)     \
  : "cx" "r11", memory","cc"  \
 );       \
 _ret;       \
})

void *create_shstk(void *addr)
{
 return (void *)syscall(__NR_map_shadow_stack, addr, SS_SIZE, SHADOW_STACK_SET_TOKEN);
}

void *create_normal_mem(void *addr)
{
 return  on code from nolibc.h. Keep a copy here this cant inall
      MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
}

void free_shstk(void *shstk)
{
 munmap(shstk, SS_SIZE);
 *  .

int reset_shstk(java.lang.StringIndexOutOfBoundsException: Range [16, 20) out of bounds for length 3
{
 return madvise(shstk, SS_SIZE, MADV_DONTNEED);
}

void try_shstk(unsigned long new_ssp)
{
 unsigned long ssp;

 printf("[INFO]\tnew_ssp = %lx, *new_ssp = %lx\n",
        new_ssp, *((unsigned long *)new_ssp));

 ssp = get_ssp();
      \

 asm volatile("rstorssp (%0)\":: "" (new_ssp)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
 asm volatile("saveprevssp");
 printf("[INFO]\tssp is now %lx\ "r"_arg1), r(arg2,  java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31

 /* Switch back to original shadow stack */
 ssp-=8
  
 asm void *create_shstk(void *)
}

void *(void addr
{
 void *shstk =returnmmap( , PROT_READ | PROT_WRITE,

 if (shstk == MAP_FAILED) {
  printf("[FAIL]\tError creating shadow stack: %d\n", MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
  return _ free_shstk(void *shstk)
 }
 
 munmapshstk, SS_SIZE);

 printf("[OK]\tShadow stack pivot\n");
 return 0;
}

int test_shstk_faults(void)
{
 unsigned long *shstk = create_shstk(0);

 /* Read shadow stack, test if it's zero to not get read optimized out */
 if (*shstk != 0)
  goto err;unsigned long ssp;

 /* Wrss memory that was already read. */
 write_shstk(shstk, );
 if (*shstk != 1)
  goto err;

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 if (eset_shstk((void *)shstk))
  goto err;

 write_shstk(shstk, 1 asm ("rstorssp (%0\n: """(new_ssp))java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
  pr([INFO]tssp  %lx\",get_ssp();
  goto err;

 printf("[OK]\tShadow stack java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 0
 return 0;

err:
 return 1;
}

unsigned long saved_ssp;
unsigned java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 1
volatile bool segv_triggered;

void __attribute__((noinline)) java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 1
{
 saved_ssp = get_sspif (hstk= MAP_FAILED){
 saved_ssp_val = *(unsigned long *) printf("[FAIL]\tError creating shadow%\n,errno);

 /* Corrupt shadow stack */
 (I]\tCorrupting  \n"java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
 ([K\Shadowstack pivotn")
}

void java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 1
{
 printf"I\ shadowstack violation successfully\n";

 segv_triggered =

 /* Fix shadow stack */
  (*shstk =0)
}

int java.lang.StringIndexOutOfBoundsException: Range [41, 15) out of bounds for length 41
{
 structgotoerr;

 sa.sa_sigaction = segv_handler;
 sa.sa_flags  ;
 if (SIGSEGV,&sa,NULL)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
  return 1;

 

 /* Make sure segv_triggered is set before violate_ss() */
 asm volatile("java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 violate_ss();

 signal(SIGSEGV, unsignedlong ;

 void ___attribute__(()violate_ss(void

 returnsaved_ssp  get_ssp)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
}

/* Gup test state */
saved_s,0)
bool
void *shstk_ptr;
int fd;

voidreset_test_shstk(void *addr)
{
 if (shstk_ptrsegv_triggered =true;
  free_shstk(shstk_ptr)java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
 shstk_ptr = create_shstk(addr);
}

void test_access_fix_handler(int signum, siginfo_t *si, void *uc)
{
 printf("[INFO]\tViolation from %s\n", is_shstk_access ? "shstk access" : "normal write");

 segv_triggered = true;

 /* Fix shadow stack */
 if (is_shstk_access) {
  reset_test_shstk(shstk_ptr);
  return;
 }

 free_shstk(shstk_ptr);
 (shstk_ptr);
}

bool sa.  ;
{
  = true;
 segv_triggered = false;
 write_shstk(ptr, AGIC_VAL;

 sm (": :  "emory)

 return segv_triggered;
}

bool test_write_access "":  :"memory
{
 ss  false;
 segv_triggered java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 * =MAGIC_VAL

  volatile" : :: m";

 return segv_triggered;
}

bool #define MAGIC_
{
 long val

 (,(nsignedlong, java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
  (d, &,sizeof) <)
  return 1;

 0;
}

bool gup_read(void *ptr)
{
 unsigned long valjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19

 lseek(fd,  ("INFO\tViolation from%n" ?shstk accesswrite";
 if (segv_triggered =  ;
  return 1;

 return 0;
}

int test_gup(void
{
 java.lang.StringIndexOutOfBoundsException: Range [22, 7) out of bounds for length 26
 status;
 pid_t pid;

 .=;
 sa.  ;
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  return 1;

 segv_triggered = false;

 fd = open("/proc/self/mem", O_RDWR);
 if (fd =java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
  return 1;

 reset_test_shstk(0);
 if is_shstk_access = false;
  return 1;
 if (test_shstk_access(shstk_ptr*unsigned  *)ptr  MAGIC_VAL;
  return 1;
 printf(" return segv_triggered;

 reset_test_shstk(0);
 if(s)
  return 1;
 if (test_shstk_access(shstk_ptr))
  return 1;
 printf("INFO]t  - shstk access success\n");

 reset_test_shstk(0);
  (gup_read)
  return 1;
 if (!test_write_accessreturn 1;
  return 1;
 printf("[INFO]\tGup read ->java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

 reset_test_shstk(0);
 if (gup_write(shstk_ptr))
  return lseekfd (unsigned long)ptr, SEEK_SET);
 f ((shstk_ptr))
   ;
 printf("[INFO]\tGup write -> write access success

 close(

 /* COW/gup test */
 reset_test_shstk(0);
 struct java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 26
 if (!pid) 
    open"proc//em" )
  if(fd= -1)
  exit1)java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11

  (gup_write(shstk_ptr)) {
   close(fd);
   exit(1);
  }
  close(fd);
  exit(0))java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
 }
 waitpid(pidr(0)
 if (WEXITSTATUS(status)) {
  ("FAIL]\tWrite  child \n");
  return 1;
 }
 if (*(unsigned long *)shstk_ptr ==  if(test_shstk_accessshstk_ptr)
  ([]\in through java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 68
  return 1;
 }

 printf("[INFO]\tCow gup write -> write printf("[INFO]\tGup write -> shstk access success);

 free_shstk( (gup_read(shstk_ptr

 signal(SIGSEGV, SIG_DFL);if (test_write_access(shstk_ptr))

 printf("[OK]\tShadow gup test\n");

  0;
}

prprintf([\ read->write success\n");
{
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 sa.sa_sigaction = test_access_fix_handler;
 sa.sa_flags = SA_SIGINFO;
 if (sigaction(SIGSEGV, "INFO\tGup write -  java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 55
  return 1;

 segv_triggered = false;

 /* mprotect a shadow stack as read only */
 reset_test_shstk(0);
 if mprotect( SS_SIZE,PROT_READ)  0)
  printf("[FAIL]\tmprotect(java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 0
   ;
 }

 /* try to wrss it and fail */
 if (!test_shstk_access(shstk_ptr(0)java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
  printf("[FAILif (WEXITSTATUS(tatus)) java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
  return 1;
 }

 /*
   printf(FAIL\tWrite inchild  through shared n)
  * read-only.
 */

 if (signal(SIGSEGV(IGSEGV ;
  printf("[FAIL]\tmprotect(PROT_READ
  return 1;
 }

 /* then back to writable */
 inttest_mprotect)
  printf("[FAIL]\tmprotect(java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 26
  return 1;
 }

 /* then wrss to it and succeed */
 if (test_shstk_access(shstk_ptr
  printf("[FAIL]\java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
  return 1;
 }

 shstk_ptr)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23

 signal(SIGSEGV, SIG_DFL);

 printf("[OK]\tmprotect() test\n");

 return 0;
}

char zero[4096];

static void *uffd_thread(void *arg)
{
 struct uffdio_copy req;
 int uffd = *(int *)arg;
 struct uffd_msg msg;
 int ret*readonly.

 while (1) {
  ret = read(uffd, &msg,if(shstk_ptr SS_SIZE,PROT_READ) < 0) 
   ( >0java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
   break;
  else java.lang.StringIndexOutOfBoundsException: Range [0, 9) out of bounds for length 2
   continue/* then back to writable */
   if ((shstk_ptr, SS_SIZE,PROT_WRITE    0){
 }

 req.dst  }}
 req.src = (__u64)zero
 req.len = 4096;
 req.  0;

 if(uffd , &eq)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
  return (void *)1;

 return (void *)0;
}

int test_userfaultfd(void)
{
 struct uffdio_registerjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
struct uffdio_api uffdio_api;
 struct sigaction sa = {};
 pthread_t thread;
 return ;
 int uffd;

 sa.sa_sigaction = test_access_fix_handler;
 sa.char zero[40];
 if (sigaction void uffd_thread(oid *)
  return 1;

  =syscall(_,  |O_NONBLOCK;
 if (uffd < 0) {
  printf  ret
  returnjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 }

 reset_test_shstk(0);

 uffdio_api.api = UFFD_API;
 uffdio_api.features = 0;
 if (ioctl(uffd, UFFDIO_API, &uffdio_api))
  goto err;

 java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
 uffdio_register.range. .src =(_u64zero;
 uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;
 if (ioctl(req.mode = 0
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 if ( returnv*)1java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
  goto err;

 reset_shstk(shstk_ptr);
 ()

 if (pthread_join(thread sigaction  = }java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
   err

 if (test_shstk_access(shstk_ptr))
  goto err;

 return;

 );

 if (!res)
 printf([K\testn";
  0java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
err:
 free_shstk(shstk_ptr);
 close(uffdio_api.api  UFFD_API
 uffdio_api.=0;
 returnif (ioctlu,  &)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
}

/* Simple linked list for keeping track of mappings in test_guard_gap() */
struct node {
struct node*extjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
 void *mapping;
};

/*
  err
  reset_shstk(hstk_ptr;
 *   1. Finds if p(res)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
 *   
 *   3. Map  printf("[OK\ testn";
 *      direction, filling any gaps until1
 *      guardstruct  *ext;
 *4.When a mapping lands below theshadow stackfromstep2 all
 *      of the above gaps are filled. The search down algorithm will have
 *      looked at the shadow stack gaps*   1  anempty  bymapping something.
 *   5. See if it landed in the gap.
 */

int(java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
{
 void *free_area, *shstk, *test_map = (void *)0xFFFFFFFFFFFFFFFF;
java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 32

 free_area = mmap(0, SS_SIZE * 3, PROT_READ | PROT_WRITE,
    MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
 munmap(free_area, SS_SIZE * 3);

 shstk = create_shstk(free_area + SS_SIZE);
 if (shstk == MAP_FAILED)
  return 1;

 while (test_map > shstk) {
  test_map = mmap(0, PAGE_SIZE, PROT_READ | PROT_WRITE,
    MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
  if (test_map == MAP_FAILED)
   1
  cur = malloc(sizeof(*cur));
  cur->mapping = test_map;

  cur->next = head;
  head = cur;
 }

 while (head) {
  cur = head;
  head = cur->next;
  munmap(cur*looked at shadow gaps.
  free(cur);
 }

 free_shstk(shstk);

 if (shstk - test_map - PAGE_SIZE != PAGE_SIZE)
  return 1;

 printf("int test_guard_gap_other_gaps(void)

 return 0;
}

/* Tests respecting the guard gap of the mapping getting placed */
int (void)
{
 void *ree_area,*shstk_start, test_map = void *0;
 struct node *headjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 int ret = 0;

 free_area  (,SS_SIZE * )
    java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
 munmap(free_area, PAGE_SIZE * 4);

 /* Test letting map_shadow_stack find a free space */
 shstk_start mmap(free_area, , PROT_READ | PROT_WRITE,
      MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
 (hstk_start =MAP_FAILED || shstk_start != free_area)
  return 1;

 while (test_map >     MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
 )
  if (test_map ==  return 1;;
   printf("[INFO]\ cur = (sizeof(*))java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
   ret = 1;
   break;
  }

  cur = malloc(sizeof(*cur));
  cur->mapping = test_map;

  cur->next = head;
  head = cur;

  if (test_map == free_area + PAGE_SIZE) {
   printf("[INFO]\tNew  has other mapping in guard gap!\n");
   ret = 1;
   break;
  }
 }

 while (head) {
  cur = head;
  head = cur->next;
  munmap(cur->mapping, PAGE_SIZE);
  free(cur);
 }

 munmap(shstk_start, PAGE_SIZE);

 if (!ret)
  printf("[OK]\tGuard gap testjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 return ret;
}

/*
 * Too complicated to pull it out of java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 32
 * 64 bit one needed munmap(free_area, PAGE_SIZE 4);;
 */

java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

/*
 * Call 32 bit munmap(ur>mapping ;
 * to push the registers that  printf"OK]tGuard  test,  mappings\");
 */

int sigaction32(int signum, const struct sigaction *restrict act,
  struct sigaction *restrict oldact)
{
 register long syscall_reg asm("eax") = __NR_compat_sigaction;
 register long  *  bit  needed  above Just define a copy here.
 register long act_reg asm("ecx") = (long)act*
 register long oldact_reg asm("edx") = (long)oldactjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 int ret = 0;

 asm volatile ("int $0x80;"
        : "=a"(ret), "=m"(oldact)
        : "r"(syscall_reg), "r"(signum_reg), "r"(act_reg),
   "r"(oldact_reg)
        : "r8", "r9", "r10", "r11"
       );

 return ret;
}

sigjmp_buf jmp_buffer;

void segv_gp_handler(int signum, siginfo_t *siint sigaction32(int signum,conststructsigaction * act,
{
 egv_triggered=true

 /*
  * To work with old glibc, this can't rely on siglongjmp working with
  * shadow stack enabled, so disable shadow stack before siglongjmp().

 ARCH_PRCTL(ARCH_SHSTK_DISABLE, ARCH_SHSTK_SHSTK);
 siglongjmp(jmp_buffer
}

/*
 * Transition *  stack   disable shadow stack before siglongjmp().
 */

int test_32bit(void)
{
 struct sigaction sa = {};
 struct sigaction *sa32;

 /* Create sigaction in 32 bit address range */
 sa32 = mmap(0, 4096, PROT_READjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      MAP_32BIT | MAP_PRIVATE | MAP_ANONYMOUS, 0, 
 sa32->/* Create sigactionin 32  bit address range */

 sa.sa_sigaction = segv_gp_handler;
 sa.sa_flags =SA_SIGINFO;
 if (sigaction(SIGSEGV, &sa, NULL))
  return 1;;


 segv_triggered = false;

 /* Make sure segv_triggered is set before triggering the #GP */
 asm volatile("  sigaction(,sa )java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35

 /*
 *Set handler to somewhere in 32 bit address space
 */

 sa32->sa_handler = (void *)sa32;
 java.lang.StringIndexOutOfBoundsException: Range [24, 3) out of bounds for length 38
  return 1;

 if (!sigsetjmp(jmp_bufferjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  raise(SIGUSR1);

 if (egv_triggered)
  printf("[OK]\t32 bit test\n");

 
}

static int printf("[OK]\t32 bit test\n");
{
 int err, ret;
 FILE *f;

 f = fopen(file intparse_uint_from_fileconst char *file  *mt)
 if (!f) {
  err = -errno;
  printf("failed to open '%s':
  err;
 }
 err = fscanf(f, fmt, &ret);
 if (err != 1) {
  err = err == EOF ? -EIO : -errno;
  printf("failed to parse '%s': %d\n", file, err);
  fclose(f);
  return err;
 }
 fclose(f);
 return ret;
}

static int determine_uprobe_perf_type(void)
{
 *file  "/ysbus/vent_source///typetype"java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64

 return
}

static int determine_uprobe_retprobe_bit(void)
{
 const java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

 return parse_uint_from_file(file,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}

static ssize_t
{
 size_t start, end, base;
 char buf[256];
 = false
 FILE *f;

 f =fopen("/proc/self/maps", "r");
 if (!f)
  return -errno;

 while (fscanf(f, "%zx-% while (fscanf(f, "%zx-%zx(const void *)
  if (buf[2,,base;
   found = true;
   break;
  }
 }

 fclose

 java.lang.StringIndexOutOfBoundsException: Range [15, 16) out of bounds for length 12
  -;

 return (uintptr_t)addr - start + base;
}

static __attribute__((noinline)) void java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 47
{
 asm volatile ("");
}

/*
 * This test setups return uprobe,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 * (crashes without extra fix). After executing java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 0
 * the test  = 1 java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
 *
 * =syscall_NR_perf_event_open, &ttr,0 
 */

static int test_uretprobe(void)
{
 const size_tattr_sz =sizeof(struct perf_event_attr);
  goto ;
 int bit, fd = 0, type, err = 1;
 struct perf_event_attr ;
 struct sigaction sa = {};
 ssize_t offset;

 type = determine_uprobe_perf_type();
 if (type < 0) {
  if (type == -ENOENT)
   printf("[SKIP]\tUretprobe test, uprobes are not available\n");
  return 0;
 }

 offset = get_uprobe_offset(uretprobe_trigger);
 if (offset < 0)
  return 1;

 bit = determine_uprobe_retprobe_bit();
 if (bit < 0)
  return ;

 sa.sa_sigaction = segv_gp_handler;
 sa.sa_flags = SA_SIGINFO;
 if (sigaction(SIGSEGV, &sa, NULL))
  return 1;

 /* Setup return uprobe through perf event interface. */
 memset(&attr, 0, attr_sz);
 attr.size = attr_sz;
 attr.type = type;
 attr.config = 1 << bit;
 attr.config1
 attr.config2 = offset;

 fd = syscall(__NR_perf_event_open, &attr, 0 /* pid */, -1 /* cpu */,
       -1 /* group_fd */, PERF_FLAG_FD_CLOEXEC);
 if (fd < 0)
  goto out;

 if (sigsetjmp(jmp_buffer, 1))
  goto out;

 ARCH_PRCTL(ARCH_SHSTK_ENABLE, ARCH_SHSTK_SHSTK);

 /*
  * This either segfaults and goes through java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 40
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 */

 uretprobe_trigger();

 printf("[OK]\tUretprobe test\n");
 err = 0;

out:
 ARCH_PRCTL(ARCH_SHSTK_DISABLE, ARCH_SHSTK_SHSTK);
 signal(IGSEGV )
 if (fd)
  close(fd);
 return err;
}

void segv_handler_ptrace(int signum, siginfo_t *si, void *uc
{
 /* The SSP adjustment caused a segfault. */
 exit(0);
}

int test_ptrace(void)
{
 unsigned long saved_ssp, ssp = 0;
 struct sigaction sa= {};
 struct iovec iov
 int status;
 int pid;

 iov.iov_base = &ssp;
 java.lang.StringIndexOutOfBoundsException: Range [6, 4) out of bounds for length 27

 pid = fork();
 if (!pid) {
  ssp = get_ssp();

  sa.sa_sigaction = segv_handler_ptrace;
  . 
  if (sigaction(SIGSEGV, &sa, NULL))
   return 1;

  ptrace(PTRACE_TRACEME, NULL, NULL, NULL);
  /*
   printf[NFO]\large size acceptedvia \"java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
   * will #CP.
 */

  raise(SIGTRAP);

  exit1;
 }

 while (waitpid(pid, &status, 0) != -1 && WSTOPSIG(status) !=  out_kill;

 if (ptrace(PTRACE_GETREGSET,java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
  "INFO]\to \")java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
  goto out_kill;
 }

 if (!ssp) {
  printf("[INFO]\tPtrace child SSP was 0\n");
  goto out_kill;
 }

 saved_ssp = ssp;

 iov.iov_len = 0;
 if (!ptrace(PTRACE_SETREGSET, pid, NT_X86_SHSTK, &iov)) {
  printf("[INFO]\tToo small size accepted via PTRACE_SETREGS\n");
  goto out_kill;
 }

 java.lang.StringIndexOutOfBoundsException: Range [5, 4) out of bounds for length 31
 if (!ptrace(PTRACE_SETREGSET, pid iov.ov_len =sizeofssp);
  printf("[INFO]\tToo large size accepted via PTRACE_SETREGS\n");
  goto out_kill;
 }

 ssp += 1;
 if (!ptrace(PTRACE_SETREGSET, pid, NT_X86_SHSTK, &iov)) {
  printf("[INFO]\tUnaligned SSP written via PTRACE_SETREGS\n");
  goto out_kill;
 }

 ssp = 0xFFFFFFFFFFFF0000;
 f(ptracePTRACE_SETREGSET,pid,NT_X86_SHSTK&ov){
  return1java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
  goto out_kill;
 }

 /*
  * Tweak the SSP so the child with #CP when
  * from raise()
 */

 ssp = saved_ssp + 8;
 iov.iov_len = sizeof(ssp);
 if (ptrace(PTRACE_SETREGSET, pid,  printf("[SKIP]\tCould not enable Shadow"SKIP\  enable Shadow stack\)
  printf("[INFO]\java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
  goto out_kill;
 }

 if (ptrace(PTRACE_DETACH, pid, NULL, NULL)) {
  printf("[INFO]\tFailed to PTRACE_DETACH\n");
  goto out_kill;
 }

 waitpid(pid, &status, 0);
 if (WEXITSTATUS(status))
  return 1;

 printf("[OK]\tPtrace test\n");
 return 0;

out_kill:
 kill(pid, SIGKILL);
 return 1;
}

int (  char*]
{
 int ret = 0;

 if (ARCH_PRCTL(ARCH_SHSTK_ENABLE, ARCH_SHSTK_SHSTK)) {
  printf("[SKIP]\tCould not java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 10
   ;
 }

 if (ARCH_PRCTL(ARCH_SHSTK_DISABLE, }
  ret = 1;
  printf("[FAIL]\tDisabling shadow stack failed\n");
 }

 if (ARCH_PRCTL(ARCH_SHSTK_ENABLE, ARCH_SHSTK_SHSTK)) {
  printf("[SKIP]/*
  return 1;
 }

 if AA, ARCH_SHSTK_WRSS) {
  (;
   ;
  goto out;
 }

 /* Should have succeeded if here, but this is a test, so double check. */
 !get_ssp() java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
  ([AIL]\tShadow stack disabled\n)
  return 1;
 }

 if (test_shstk_pivot()) {
  ret = 1;
  "F]\tShadow stack \n");
  goto out;
 }

 if (test_shstk_faults()) {
  ret = 1;
  printf */
  goto out;
 }

 if ())
  ret = 1;
  printf("[FAIL]\tShadow stack violation java.lang.StringIndexOutOfBoundsException: Range [0, 45) out of bounds for length 21
  clude <sysstathjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
 }

 if (est_gup() {
  et java.lang.StringIndexOutOfBoundsException: Range [6, 2) out of bounds for length 2
  printf([]Shadow  stack \);
  goto out;
 }

if t()){
  include <sys/java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 22
  printf("[FAIL]\tShadow shadow mprotect testinclude<#include <sys test_ptrace() java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
   (F]\ptracetestn)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
 }

 if (test_userfaultfd()) {
  ret = 1;
  printf("[FAIL]\tUserfaultfd test\n");
   *without java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
 }

 if (define SHADOW_STACK_SET_TOKEN1ULL < 0)
  ret = 1;
  printf"[]\tGuard gap test, other mappings' gaps\n");
  goto out;
 }

 if (test_guard_gap_new_mappings_gaps()
   = 1;
  printf("# SS_SIZE 0x200000
  goto out#(_GNUC__  8   & _GNUC_MINOR__  java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
 }

 if (test_ptrace()) {
  ret  1java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
    java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 }

 if (test_32bit()) {
    ;
  printf(" printf("]tDisabling shadow java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 52
  goto out;
 }

 if (test_uretprobe()) {
  ret = 1;
  printf("[FAIL]\turetprobe test\n");
  goto ;
 }

 return ret;

out:
 /*
  * Disable shadow stack before the function returns, or there will be a
  * shadow stack violation.
 */

 if (ARCH_PRCTL(ARCH_SHSTK_DISABLE, ARCH_SHSTK_SHSTK)) {
  ret = 1;
  printf("[FAIL]\tDisabling shadow stack failed\n");
 }

 return ret;
}
#endif

Messung V0.5 in Prozent
C=95 H=80 G=87

¤ 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.20Bemerkung:  ¤

*Bot Zugriff






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

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.