This file is indexed.

/usr/share/systemtap/runtime/kprobes-common.c is in systemtap-common 1.6-1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* -*- linux-c -*- 
 * kprobe Functions
 * Copyright (C) 2010 Red Hat Inc.
 *
 * This file is part of systemtap, and is free software.  You can
 * redistribute it and/or modify it under the terms of the GNU General
 * Public License (GPL); either version 2, or (at your option) any
 * later version.
 */

#ifndef _KPROBE_COMMON_C_
#define _KPROBE_COMMON_C_

#ifdef KPROBES_TASK_FINDER

/* The task_finder_callback */
static int stap_kprobe_process_found (struct stap_task_finder_target *finder, struct task_struct *tsk, int register_p, int process_p) {
  struct stap_dwarf_probe *p = container_of(finder, struct stap_dwarf_probe, finder);
  unsigned short sdt_semaphore = 0;
  if (! process_p) return 0; /* ignore threads */
  #ifdef DEBUG_TASK_FINDER_VMA
  _stp_dbug (__FUNCTION__,__LINE__, "%cproc pid %d stf %p %p path %s\n", register_p?'+':'-', tsk->tgid, finder, p, p->pathname);
  #endif
  p->tsk = tsk;
  p->sdt_sem_address = p->sdt_sem_offset;
  if (get_user (sdt_semaphore, (unsigned short __user *) p->sdt_sem_address) == 0) {
    sdt_semaphore ++;
    #ifdef DEBUG_UPROBES
    _stp_dbug (__FUNCTION__,__LINE__, "+semaphore %#x @ %#lx\n", sdt_semaphore, p->sdt_sem_address);
    #endif
    put_user (sdt_semaphore, (unsigned short __user *) p->sdt_sem_address);
  }
  return 0;
}

/* The task_finder_mmap_callback */
static int stap_kprobe_mmap_found (struct stap_task_finder_target *finder, struct task_struct *tsk, char *path, struct dentry *dentry, unsigned long addr, unsigned long length, unsigned long offset, unsigned long vm_flags) {
  struct stap_dwarf_probe *p = container_of(finder, struct stap_dwarf_probe, finder);
  int rc = 0;
  if (path == NULL || strcmp (path, p->pathname)) return 0;
  if (p->sdt_sem_offset && p->sdt_sem_address == 0) {
    p->tsk = tsk;
    if (vm_flags & VM_EXECUTABLE) {
      p->sdt_sem_address = addr + p->sdt_sem_offset;
    }
    else {
      p->sdt_sem_address = (addr - offset) + p->sdt_sem_offset;
    }
  }
  if (p->sdt_sem_address && (vm_flags & VM_WRITE)) {
    unsigned short sdt_semaphore = 0;
    if (get_user (sdt_semaphore, (unsigned short __user *) p->sdt_sem_address) == 0) {
      sdt_semaphore ++;
      #ifdef DEBUG_UPROBES
      _stp_dbug (__FUNCTION__,__LINE__, "+semaphore %#x @ %#lx\n", sdt_semaphore, p->sdt_sem_address);
      #endif
      put_user (sdt_semaphore, (unsigned short __user *) p->sdt_sem_address);
    }
  }
  return 0;
}

#endif /* KPROBES_TASK_FINDER */

#endif /* _KPROBE_COMMON_C_ */