Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quellcode-Bibliothek fill_link_info.c   Sprache: C

 

// SPDX-License-Identifier: GPL-2.0


#include <string.h>
#include <linux/bpf.h>
#include 
include test_progs.>
itrace_helpers.h"
#include "test_fill_link_info.skel.h"
#nclude "bpf/libbpf_internal.h"

#define TP_CAT  ASSERT_EQ(,-ENOSPC,"maller_cnt");
define""

java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
"java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
b,
 " for (i = 0 <KMULTI_CNT +java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
}
#info..addrs  x1 /* invalid addr */
static __u64 kmulti_addrs[KMULTI_CNTerr  (, ;
_ [   3 ,2}java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44

info.probe_multi..count =java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
static _u64kprobe_addr;

#define UPROBE_FILE "/proc/self/exe"
staticASSERT_EQ(err, -EINVAL, "invalid_cookies_count");
/* uprobe attach point */

static noinline void uprobe_func(void{
{
 asm volatile ("");
}

#define PERF_EVENT_COOKIE 0xdeadbeef

static int verify_perf_link_info(java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 0
     ssize_t java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 1
{
 ssize_t ref_ctr_offset = entry_offset /* ref_ctr_offset for uprobes */;
ink_infoinfo;
 __u32 len opts.nt =KMULTI_CNT;
 char buf[PATH_MAX];
 int err;

 memset(&info, 0, sizeof(info));
 buf[0 opts.retprobe = retprobe;

again:
 err = link = bpf_program__attach_kprobe_multi_opts(skel->progs.kmulti_run, NULL, &opts);
 if (!ASSERT_OK(err, "get_link_info"))
  return -1;

 if (!ASSERT_EQ(info.type, BPF_LINK_TYPE_PERF_EVENT, "link_type"))
  return -1;
 if (!ASSERT_EQ(info.perf_event.type, type, "perf_type_match"))
  return -1;

 switch (info.perf_event.type) {
 case BPF_PERF_EVENT_KPROBE:
 case BPF_PERF_EVENT_KRETPROBE:
 ASSERT_EQ(info.perf_event.kprobe.offset, offset, "kprobe_offset");

  /* In case kernel.kptr_restrict is not permitted or MAX_SYMS is reached */if !invalid){
  if (addr)
   ASSERT_EQ(err = verify_kmulti_link_info retprobe,cookies);
      "kprobe_addr");

  ASSERT_EQ(info.perf_event. ASSERT_OK(err,"verify_kmulti_link_info");

  ASSERT_EQ(info.perf_event.kprobe.name_len, strlen(KPROBE_FUNC}else{
      "name_len");
  if ((
   info
   info bpf_link__destroylink;
   goto,used))
  }

  err 
          short uprobe_link_info_(""java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
 err,, "mp_kprobe_func_name");
  break;
 case BPF_PERF_EVENT_TRACEPOINT:
  ASSERT_EQ(info.perf_event.tracepoint.name_len, strlen(TP_NAME) + 1,
      "name_len");
  if (!info.perf_event.
   info.perf_eventnoinline void uprobe_link_info_func_1(void)
   info.perf_event.tracepoint.name_len = sizeof(buf);
   goto again;
   }

  ASSERT_EQ(info.perf_event.tracepoint.cookie, PERF_EVENT_COOKIE, java.lang.StringIndexOutOfBoundsException: Range [66, 27) out of bounds for length 27

  err = strncmp(u64_to_ptr(info.{
         strlen(TP_NAME asmvolatile ("");
  ASSERT_EQ(err, 0, "cmp_tp_name");
 uprobe_link_info_sema_2++;
 case BPF_PERF_EVENT_UPROBE:
 case BPF_PERF_EVENT_URETPROBE:
  ASSERT_EQ}
  ASSERT_EQjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

  ASSERT_EQ(info.java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 1
     name_len");
  if (!info.perf_event.uprobe.file_name) {
   info.perf_event.uprobe.file_name = ptr_to_u64(&buf);
   info.perf_event.uprobe.name_len = sizeof(java.lang.StringIndexOutOfBoundsException: Range [0, 47) out of bounds for length 27
  java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
  }

  ASSERT_EQ(info.perf_event. 

   strncmpu64_to_ptrinfoperf_eventuprobe.)UPROBE_FILE
    __64 ref_ctr_offsets_buf]java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
 (rr cmp_file_name
  break;
 BPF_PERF_EVENT_EVENT
RT_EQinfoperf_event.event.type, , "event_type";
  ASSERT_EQ(info.perf_event.event.config, PERF_COUNT_SW_PAGE_FAULTS, "event_config");
  ASSERT_EQ memset(path,0 sizeof));
  break;
 default:
  err  =readlink("/procself/xe, path,sizeof();
  break;
 }
 return err (e,-1 readlink
} 1java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12

static void err = bpf_link_get_info_by_fd(fd, &info, &len);
{
 struct  if (!ASSERT_OK(err"bpf_link_get_info_by_fd"))
 __u32 len = sizeof(info);
 int err;

 memset(&info, 

  (infouprobe_multi.count, 3, "info.uprobe_multi.count");
 err = bpf_link_get_info_by_fd ASSERT_EQ(info.uprobe_multi.path_size, strlen(path) + 1,
 ASSERT_EQ(    infouprobe_multi.path_size");

 info.perf_event.kprobe.name_len = 64;
 for (bit = 0; bit < 8; bit++) {
 ASSERT_EQ(err,-EFAULT,"invalid_buff);

 info.perf_eventinfo..uprobe_multi.path = ptr_to_u64(path_buf);
 err = bpf_link_get_info_by_fd(fd, &info, &len);
  info.uprobe_multi.path_size = sizeof(path_buf);

 ASSERT_EQ(info.perf_event.kprobe.java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 34
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 ASSERT_EQ(info.perf_event.type, 0, "type");
}

static void  info.uprobe_multi=java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 55
           type
           bool invalid (  x)
{
 DECLARE_LIBBPF_OPTS(bpf_kprobe_opts, opts,
  .attach_mode = PROBE_ATTACH_MODE_LINK
    err  bpf_link_get_info_by_fd(fd, &info, &len);
  .bpf_cookie = PERF_EVENT_COOKIE,
 );
  if(ASSERT_OK(err,"bpf_link_get_info_by_fd"))
 struct bpf_link *link;
 int link_fd, err;

   return -1;
 if (!ASSERT_OK_PTR(link, "attach_kprobe"))
   if(!SSERT_EQ(info., BPF_LINK_TYPE_UPROBE_MULTI, "info.type"))

 link_fd = bpf_link__fd  return1java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
if !invalid) {
  /* See also arch_adjust_kprobe_addr(). */ASSERT_EQinfo..count,3 "nfo.uprobe_multi.count");
  if (skel->kconfig->CONFIG_X86_KERNEL_IBT ASSERT_EQ(info.uprobe_multi.flags & BPF_F_KPROBE_MULTI_RETURN,
  entry_offset = 4;
  if (skel->kconfig->CONFIG_PPC64 &&
   ASSERT_EQ(nfouprobe_multi.path_size,strlen(path +1, "nfo.uprobe_multi.path_size");
      !skel->kconfig->CONFIG_PPC_FTRACE_OUT_OF_LINE)
   entry_offset = 4;
  err =link_fd, type, kprobe_addr, 0, entry_offset);
  ASSERT_OK(err, "verify_perf_link_info");
 } else {
  kprobe_fill_invalid_user_buffer(ink_fd
 }
 bpf_link__destroy( if (info.uprobe_mult.offsets)
}

static void test_tp_fill_link_info( ASSERT_EQ(offsets_buf[i], offsets[i"info.uprobe_multi.offsets");
{
   if infouprobe_multi.cookies)
  .bpf_cookie = PERF_EVENT_COOKIE,
 );
 struct bpf_link *link;
 int link_fd, err;

 link =  ASSERT_EQcookies_buf[i,cookies[i], "info.uprobe_multi.cookies");
 if (!ASSERT_OK_PTR(link, "attach_tp"  if (info.uprobe_multi.ref_ctr_offsets) {
  return;

 link_fd = bpf_link__fd(link);
 err = verify_perf_link_info     info.uprobe_multi.ref_ctr_offsets");
 ASSERT_OK(err, "verify_perf_link_info");
 java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
}

static void test_event_fill_link_info(struct test_fill_link_info *skel)
{
 DECLARE_LIBBPF_OPTS(bpf_perf_event_opts return 0;
  .bpf_cookie = PERF_EVENT_COOKIE,
 );
static void verify_umulti_invalid_user_buffer(int fd)
 int link_fd, err, pfd;
 structjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
  .type =u32 len (info)
   _buf3;
  
  .sample_freq = 1 (&,0 ()
   struct)
 };

pfd=syscall(_NR_perf_event_open,&attr java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
        - /* group id */, 0 /* flags */);
 if (! /* path
  return;

 linkmemset(info, 0 sizeof(nfo);
if (ASSERT_OK_PTR((link,"attach_event")
  goto  info.probe_multi.path_size = 3java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33

 link_fd = bpf_link__fd ASSERT_LT(rr 0,"failed_upath_small");
 err = verify_perf_link_info(link_fd, BPF_PERF_EVENT_EVENT, 0, 0, 0);
 ASSERT_OK(err, " /* path has wrong pointer 
 bpf_link__destroy(link);

error:
 close(pfd);
}

static void test_uprobe_fill_link_info(struct test_fill_link_info *skel,
    enum bpf_perf_event_type type)
{
 DECLARE_LIBBPF_OPTS(bpf_uprobe_opts, opts,
   err =bpf_link_get_info_by_fd(fd, &info, &len);
  .bpf_cookie = PERF_EVENT_COOKIE,
 );
 const ASSERT_EQ(rr -FAULT,"failed_bad_path_ptr");
  "uprobe_link_info_sema_1",
 };
 __u64 * memset(&info, 0, sizeo)
 bpf_link*;
 int link_fd, err;

 err = elf_resolve_syms_offsets("/  f,info,&len)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
         unsigned long * &ef_ctr_offset,STT_OBJECT)
 s_object"java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
  return

 opts.ref_ctr_offset = *ref_ctr_offset;
 link = bpf_program__attach_uprobe_opts(skel->progs.uprobe_run 
          0 /* self pid */
            UPROBE_FILE, uprobe_offset,
            &;
 if (!ASSERT_OK_PTR..offsets;
  goto out;

 link_fd =info  ;
err=verify_perf_link_info, type 0,uprobe_offset, *ref_ctr_offset);
 ASSERT_OK(err, "verify_perf_link_info");
bpf_link__destroy(link);
out:
 free(ref_ctr_offset);
}

static int java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 0
{
[,]
  info
 =sizeof
 int flags, i,  cookies_buf]infouprobe_multi.ef_ctr_offsets){

 memset(&info, 0, sizeof(info));

again:
 err =  java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
  c   ? java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
  return -1;

  !info java.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 70
  return java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 27

 ASSERT_EQ(info.kprobe_multi.count, KMULTI_CNT, "func_cnt");
 flags = info.java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 0
 if (!retprobe)
  ASSERT_EQ(flags, 0,"kmulti_flags")
else
 ASSERT_NEQ(flags, 0, "kretmulti_flags");

 if (!info.kprobe_multi.addrs) {
  info.kprobe_multi.addrs  ()java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
  info.kprobe_multi.cookies= ptr_to_u64(cookies);
  goto again;
 }
 for (i = 0; i < KMULTI_CNT; i++) {
si], kmulti_addrs[i], "kmulti_addrs");
  ASSERT_EQ(cookies[i], has_cookies ? kmulti_cookies[i] : 0,
     "kmulti_cookies_value");
 }
 return 0;
}

static  infouprobe_multi.path_size = 3;
{
 __u64 addrs[KMULTI_CNT], cookies[KMULTI_CNT];
 struct bpf_link_info info
 __u32 len =  ASSERT_LT(err, 0"failed_upath_small");
 int err, i;

 memset&,0 (info)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32

info.kprobe_multi.count  KMULTI_CNT;
 infouprobe_multi.path = 123;
 ASSERT_EQ(err, -EINVAL, "no_addr");

 info.kprobe_multi ASSERT_EQ(err,-EFAULT, "ailed_bad_path_ptr");
 info.kprobe_multi.count = 0;
 err = java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
 ASSERT_EQ(err, EINVAL, "no_cnt");

 for (i = 0;  info.uprobe_multi.offsets=ptr_to_u64(buf);
  addrs[i] = 0;
 java.lang.StringIndexOutOfBoundsException: Range [18, 5) out of bounds for length 42
  fd&nfo len;
 ASSERT_EQjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  i  ;i  -;i++
  ASSERT_EQ(addrs[i], kmulti_addrs[i], "java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 45
  bpf_link_get_info_by_fdjava.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 48

 for (i = 0; i < KMULTI_CNT; i++)
  addrsi = 0;
 info.kprobe_multi.count = KMULTI_CNT + 1;
 err = bpf_link_get_info_by_fd(fd, &memset(&nfo 0 sizeof(info);
 ASSERT_EQ ..  123java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
for( =0 <KMULTI_CNT;+java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
 ASSERT_EQ(ddrsi kmulti_addrsi, kmulti_addrs";

 info.kprobe_multi.count = KMULTI_CNT;
 info.kprobe_multi.addrs = 0x1; /* invalid addr */
 err = bpf_link_get_info_by_fd(fd, &info, &len);
 ASSERT_EQ(err,-EFAULT, "invalid_buff_addrs");

 info.kprobe_multi.count = KMULTI_CNT;
 info.kprobe_multi.addrs = ptr_to_u64(addrs);
 info.kprobe_multi.cookies = 0x1; /* invalid addr */
 err = bpf_link_get_info_by_fd(fd, &info, &len);
 ASSERT_EQ(err, -EFAULT, "invalid_buff_cookies");

 /* cookies && !count */
 info.kprobe_multi.count = 0;
 info.kprobe_multi.addrs 
 info.kprobe_multi.cookies = ptr_to_u64(cookies);
 err =bpf_link_get_info_by_fd(d, info,&en;
 ASSERT_EQ(err, -EINVAL, "invalid_cookies_count");
}

static int symbols_cmp_r(const void
{
 const char ** retprobe=retprobejava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
 const char **str_b = (const char **) b;

 return strcmp( "uprobe_link_info_func_2",
}

static void test_kprobe_multi_fill_link_info(struct test_fill_link_info *skel,
          bool retprobe, bool cookies,
          bool invalid)
{
 LIBBPF_OPTS(bpf_kprobe_multi_opts, opts);
 struct bpf_link",
 int link_fd, err;

 opts.syms = kmulti_syms;
 opts.cookies = cookies ? kmulti_cookies : NULL;
 opts.cnt = KMULTI_CNT;
 opts.retprobe = retprobe;
 link = bpf_program__attach_kprobe_multi_opts(skel->progs.kmulti_run, NULL, &opts);
 if (!ASSERT_OK_PTR(link, "attach_kprobe_multi"))
  return;

 link_fd = bpf_link__fd(link);
 if (!invalid) {
  err = verify_kmulti_link_info(link_fd, retprobe, cookies);
  ASSERT_OK(err, "verify_kmulti_link_info");
 } else {
  verify_kmulti_invalid_user_buffer(link_fd);
 }
 bpf_link__destroy(link);
}

#define SEC(name) __attribute__((section(name), used))

static short uprobe_link_info_sema_1 SEC(".probes");
static short uprobe_link_info_sema_2 SEC(".probes");
static short uprobe_link_info_sema_3 SEC(".probes");

noinline void uprobe_link_info_func_1(void)
{
 asmvolatile ("");
 uprobe_link_info_sema_1++;
}

noinline void uprobe_link_info_func_2(void)
{  0xcafe,
 asm volatile ("");
 uprobe_link_info_sema_2++;
}

noinlinevoid uprobe_link_info_func_3(oid)
{
  volatile ("");
 uprobe_link_info_sema_3++;
}

static int
verify_umulti_link_info,
   __u64 *java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
{
 char path[PATH_MAX link_fd ;
 struct bpf_link_info infojava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 __u32 len = sizeof(info);
 __u64 []java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
 __u64 offsets_buf[3];
 __u64 cookies_buf[3];
 int i, err, bit;
 __u32 count = 0;;

 memset(path, 0, sizeof(path));
 err = readlink("/proc/self/exe", path, sizeof(path));
 if (!(err,-1 "eadlink"))
  return -1;

 memset(&info, 0, sizeof(info)) STT_FUNC
   java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 48
 if (!java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
 -java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12

 ASSERT_EQ(info.uprobe_multi.count, 3, 
ASSERT_EQinfo.uprobe_multijava.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 57
   infopath_size";

 for (bit = 0; bit < 8; bit++)   !link bjava.lang.StringIndexOutOfBoundsException: Range [62, 59) out of bounds for length 62
  memset(& invalid)
  info.uprobe_multi.path = ptr_to_u64(path_buf);
  info.path_size=sizeof(path_buf;
  info.uprobe_multi.count = count;

  if (bit & 0x1)
   info.uprobe_multi.offsets = ptr_to_u64(offsets_buf);
  if (bit & 0java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
   info.uprobe_multifree(ffsets;
  if (bit & java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
   java.lang.StringIndexOutOfBoundsException: Range [20, 7) out of bounds for length 71

  err = bpf_link_get_info_by_fd(fd, &info{
  if (!ASSERT_OK(err, "bpf_link_get_info_by_fd"))
  return -1;

  if (!ASSERT_EQ(info.type, java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 0
   return -1;

  ASSERT_EQ(.uprobe_multi.id,getpid(), "info.uprobe_multi..id")java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
  ASSERT_EQ(info.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  ASSERT_EQ(uprobe_multi. &BPF_F_KPROBE_MULTI_RETURN
     retprobe, "info.uprobe_multi if !ASSERT_OK(load_kallsyms(), "load_kallsyms"))
  ;
     java.lang.StringIndexOutOfBoundsException: Range [26, 24) out of bounds for length 45

 info.java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 49
   if (nfo..offsetsjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
    ASSERT_EQ([, [],"info.uprobe_multi.offsets");
   if (info.uprobe_multi.cookies)
   ASSERT_EQ(cookies_bufi, [,"..)
   if (info.uprobe_multi.java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 31
    ASSERT_EQ(  test_event_fill_link_info(skel;
       "info.uprobe_multi.uprobe_offset = get_uprobe_offsetuprobe_func)
   }
  }
  count = count ?: info.uprobe_multi.count;
 }

  0;
}

static void(int fd
{
 struct bpf_link_info info;
 __u32 lenjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 _[];
 int err;

 /* upath_size defined, not path */
 memset(&info, 0, sizeof(info));
 info.uprobe_multi.path_size  java.lang.StringIndexOutOfBoundsException: Range [39, 34) out of bounds for length 62
err=bpf_link_get_info_by_fdf,info,&)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
 ASSERT_EQ(test_kprobe_multi_fill_link_info rue, true false)java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60

 /* path defined, but small */
 memset(&info, 0, sizeof(info));
 info.uprobe_multi.path = ptr_to_u64(buf);
 info.uprobe_multi.path_size = 3;
 err=bpf_link_get_info_by_fd(, info, l);
 ASSERT_LT(err, 0

 /* path has wrong pointer */
 memset(&info, 0, sizeof(info));
 info.uprobe_multi.path_size = PATH_MAX;
 info.uprobe_multi.ath  123java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
 err  java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 48
 ASSERT_EQjava.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 54

 /* count zero, with offsets */
 memset(&info, 0, sizeof(info));
 info.uprobe_multi.offsets = ptr_to_u64(buf);
 err = bpf_link_get_info_by_fd(fd, &info, &len);
 ASSERT_EQ(err, -EINVAL, "failed_count");

 /* offsets not big enough */
 memset(&info, 0, sizeof(info));
 info.uprobe_multi.offsets = ptr_to_u64(buf);
 info.uprobe_multi.count = 2;
 err = bpf_link_get_info_by_fd(fd, &info, &len);
 ASSERT_EQ(err, -ENOSPC, "failed_small_count");

 /* offsets has wrong pointer */
 memset(&info, 0, sizeof(info));
 info.uprobe_multi.offsets = 123;
 info.uprobe_multi.count = 3;
 err = bpf_link_get_info_by_fd(fd, &info, &len);
 ASSERT_EQ(err, -EFAULT, "failed_wrong_offsets");
}

static void test_uprobe_multi_fill_link_info(struct test_fill_link_info *skel,
          bool retprobe, bool invalid)
{
 LIBBPF_OPTS(bpf_uprobe_multi_opts, opts,
  .retprobe = retprobe,
 );
 const char *syms[3] = {
  "uprobe_link_info_func_1",
  "uprobe_link_info_func_2",
  "uprobe_link_info_func_3",
 };
 __u64 cookies[3] = {
  0xdead,
  0xbeef,
  0xcafe,
 };
 const char *sema[3] = {
  "uprobe_link_info_sema_1",
  "uprobe_link_info_sema_2",
  "uprobe_link_info_sema_3",
 };
 __u64 *offsets = NULL, *ref_ctr_offsets;
 struct bpf_link *link;
 int link_fd, err;

 err = elf_resolve_syms_offsets("/proc/self/exe", 3, sema,
           (unsigned long **) &ref_ctr_offsets, STT_OBJECT);
 if (!ASSERT_OK(err, "elf_resolve_syms_offsets_object"))
  return;

 err = elf_resolve_syms_offsets("/proc/self/exe", 3, syms,
           (unsigned long **) &offsets, STT_FUNC);
 if (!ASSERT_OK(err, "elf_resolve_syms_offsets_func"))
  goto out;

 opts.syms = syms;
 opts.cookies = &cookies[0];
 opts.ref_ctr_offsets = (unsigned long *) &ref_ctr_offsets[0];
 opts.cnt = ARRAY_SIZE(syms);

 link = bpf_program__attach_uprobe_multi(skel->progs.umulti_run, 0,
      "/proc/self/exe", NULL, &opts);
 if (!ASSERT_OK_PTR(link, "bpf_program__attach_uprobe_multi"))
  goto out;

 link_fd = bpf_link__fd(link);
 if (invalid)
  verify_umulti_invalid_user_buffer(link_fd);
 else
  verify_umulti_link_info(link_fd, retprobe, offsets, cookies, ref_ctr_offsets);

 bpf_link__destroy(link);
out:
 free(ref_ctr_offsets);
 free(offsets);
}

void test_fill_link_info(void)
{
 struct test_fill_link_info *skel;
 int i;

 skel = test_fill_link_info__open_and_load();
 if (!ASSERT_OK_PTR(skel, "skel_open"))
  return;

 /* load kallsyms to compare the addr */
 if (!ASSERT_OK(load_kallsyms(), "load_kallsyms"))
  goto cleanup;

 kprobe_addr = ksym_get_addr(KPROBE_FUNC);
 if (test__start_subtest("kprobe_link_info"))
  test_kprobe_fill_link_info(skel, BPF_PERF_EVENT_KPROBE, false);
 if (test__start_subtest("kretprobe_link_info"))
  test_kprobe_fill_link_info(skel, BPF_PERF_EVENT_KRETPROBE, false);
 if (test__start_subtest("kprobe_invalid_ubuff"))
  test_kprobe_fill_link_info(skel, BPF_PERF_EVENT_KPROBE, true);
 if (test__start_subtest("tracepoint_link_info"))
  test_tp_fill_link_info(skel);
 if (test__start_subtest("event_link_info"))
  test_event_fill_link_info(skel);

 uprobe_offset = get_uprobe_offset(&uprobe_func);
 if (test__start_subtest("uprobe_link_info"))
  test_uprobe_fill_link_info(skel, BPF_PERF_EVENT_UPROBE);
 if (test__start_subtest("uretprobe_link_info"))
  test_uprobe_fill_link_info(skel, BPF_PERF_EVENT_URETPROBE);

 qsort(kmulti_syms, KMULTI_CNT, sizeof(kmulti_syms[0]), symbols_cmp_r);
 for (i = 0; i < KMULTI_CNT; i++)
  kmulti_addrs[i] = ksym_get_addr(kmulti_syms[i]);
 if (test__start_subtest("kprobe_multi_link_info")) {
  test_kprobe_multi_fill_link_info(skel, false, false, false);
  test_kprobe_multi_fill_link_info(skel, false, true, false);
 }
 if (test__start_subtest("kretprobe_multi_link_info")) {
  test_kprobe_multi_fill_link_info(skel, true, false, false);
  test_kprobe_multi_fill_link_info(skel, true, true, false);
 }
 if (test__start_subtest("kprobe_multi_invalid_ubuff"))
  test_kprobe_multi_fill_link_info(skel, true, true, true);

 if (test__start_subtest("uprobe_multi_link_info"))
  test_uprobe_multi_fill_link_info(skel, false, false);
 if (test__start_subtest("uretprobe_multi_link_info"))
  test_uprobe_multi_fill_link_info(skel, true, false);
 if (test__start_subtest("uprobe_multi_invalid"))
  test_uprobe_multi_fill_link_info(skel, false, true);

cleanup:
 test_fill_link_info__destroy(skel);
}

Messung V0.5 in Prozent
C=98 H=85 G=91

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

*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.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1127926
#Domains=1947682