1
0
mirror of https://github.com/ioacademy-jikim/debugging synced 2026-08-30 01:09:34 +00:00

first commit

This commit is contained in:
jikim
2015-12-13 22:34:58 +09:00
commit 0b589c7986
9455 changed files with 4350134 additions and 0 deletions
@@ -0,0 +1 @@
# dummy
@@ -0,0 +1 @@
# dummy
@@ -0,0 +1 @@
# dummy
@@ -0,0 +1 @@
# dummy
@@ -0,0 +1 @@
# dummy
@@ -0,0 +1 @@
# dummy
@@ -0,0 +1 @@
# dummy
@@ -0,0 +1 @@
# dummy
@@ -0,0 +1 @@
# dummy
@@ -0,0 +1 @@
# dummy
@@ -0,0 +1 @@
# dummy
@@ -0,0 +1 @@
# dummy
@@ -0,0 +1 @@
# dummy
@@ -0,0 +1 @@
# dummy
@@ -0,0 +1 @@
# dummy
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,160 @@
include $(top_srcdir)/Makefile.tool-tests.am
dist_noinst_SCRIPTS = \
filter_ldynsym \
filter_name_service_door \
filter_scalar \
filter_sendfilev \
filter_stderr \
filter_syscall_at
noinst_HEADERS = scalar.h
EXTRA_DIST = \
brk.stderr.exp brk.stdout.exp brk.vgtest \
context_stack_die.stderr.exp context_stack_die.stdout.exp context_stack_die.vgtest \
door_data.stderr.exp door_data.stdout.exp door_data.vgtest \
door_kill.stderr.exp door_kill.stdout.exp door_kill.vgtest \
execx.stderr.exp execx.stdout.exp execx.vgtest \
getzoneoffset.stderr.exp getzoneoffset.vgtest \
gethrtime.stderr.exp gethrtime.stdout.exp gethrtime.vgtest \
ldynsym.stderr.exp ldynsym.stdout.exp ldynsym.vgtest \
lsframe1.stderr.exp lsframe1.stdout.exp lsframe1.vgtest \
lsframe2.stderr.exp lsframe2.stdout.exp lsframe2.vgtest \
mmapobj_bssonly.stderr.exp mmapobj_bssonly.stdout.exp mmapobj_bssonly.vgtest \
name_service_door.stderr.exp-amd64 name_service_door.stderr.exp-x86 \
name_service_door.stdout.exp name_service_door.vgtest \
pkcs11.stderr.exp-illumos pkcs11.stderr.exp-solaris pkcs11.stdout.exp pkcs11.vgtest \
scalar.stderr.exp scalar.stdout.exp scalar.vgtest \
scalar_frealpathat.stderr.exp scalar_frealpathat.stdout.exp scalar_frealpathat.vgtest \
scalar_ioctl.stderr.exp scalar_ioctl.stdout.exp scalar_ioctl.vgtest \
scalar_lwp_kill.stderr.exp scalar_lwp_kill.stdout.exp scalar_lwp_kill.vgtest \
scalar_lwp_name.stderr.exp scalar_lwp_name.stdout.exp scalar_lwp_name.vgtest \
scalar_lwp_sigqueue.stderr.exp scalar_lwp_sigqueue.stdout.exp scalar_lwp_sigqueue.vgtest \
scalar_lwp_sigqueue_pid.stderr.exp scalar_lwp_sigqueue_pid.vgtest \
scalar_obsolete.stderr.exp scalar_obsolete.stdout.exp scalar_obsolete.vgtest \
scalar_shm_new.stderr.exp scalar_shm_new.stdout.exp scalar_shm_new.vgtest \
scalar_spawn.stderr.exp scalar_spawn.stdout.exp scalar_spawn.vgtest \
scalar_tsol_clearance.stderr.exp scalar_tsol_clearance.vgtest \
scalar_utimensat.stderr.exp scalar_utimensat.stdout.exp scalar_utimensat.vgtest \
scalar_utimesys.stderr.exp scalar_utimesys.stdout.exp scalar_utimesys.vgtest \
scalar_uuidsys.stderr.exp scalar_uuidsys.stdout.exp scalar_uuidsys.vgtest \
scalar_zone_defunct.stderr.exp scalar_zone_defunct.stdout.exp scalar_zone_defunct.vgtest \
sendfilev.stderr.exp sendfilev.stdout.exp sendfilev.vgtest \
shmat.stderr.exp shmat.stdout.exp shmat.vgtest \
spawn.stderr.exp spawn.stdout.exp spawn.vgtest \
strlcpy.stderr.exp strlcpy.stdout.exp strlcpy.vgtest \
supponlyobj.stderr.exp supponlyobj.supp supponlyobj.vgtest \
syscall_at.stderr.exp syscall_at.stdout.exp syscall_at.vgtest \
thr_daemon_exit_libc.stderr.exp thr_daemon_exit_libc.stdout.exp thr_daemon_exit_libc.vgtest \
thr_daemon_exit_standalone.stderr.exp thr_daemon_exit_standalone.stdout.exp thr_daemon_exit_standalone.vgtest
check_PROGRAMS = \
brk \
context_stack_die \
door_data \
door_kill \
gethrtime \
inlinfo \
inlinfo_nested.so \
ldynsym \
lsframe1 \
lsframe2 \
mmapobj_bssonly \
mmapobj_bssonly.so \
name_service_door \
pkcs11 \
scalar \
scalar_ioctl \
sendfilev \
shmat \
strlcpy \
syscall_at \
thr_daemon_exit_libc \
thr_daemon_exit_standalone
if SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
check_PROGRAMS += execx
endif
if SOLARIS_GETZONEOFFSET_FASTTRAP
check_PROGRAMS += getzoneoffset
endif
if SOLARIS_OLD_SYSCALLS
check_PROGRAMS += scalar_obsolete
endif
if SOLARIS_FREALPATHAT_SYSCALL
check_PROGRAMS += scalar_frealpathat
endif
if SOLARIS_LWP_NAME_SYSCALL
check_PROGRAMS += scalar_lwp_name
endif
if SOLARIS_LWP_SIGQUEUE_SYSCALL
if SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
check_PROGRAMS += scalar_lwp_sigqueue_pid
else
check_PROGRAMS += scalar_lwp_sigqueue
endif
else
check_PROGRAMS += scalar_lwp_kill
endif
if SOLARIS_SHM_NEW
check_PROGRAMS += scalar_shm_new
endif
if SOLARIS_SPAWN_SYSCALL
check_PROGRAMS += scalar_spawn spawn
endif
if SOLARIS_TSOL_CLEARANCE
check_PROGRAMS += scalar_tsol_clearance
scalar_tsol_clearance_LDADD = -ltsol
endif
if SOLARIS_UTIMENSAT_SYSCALL
check_PROGRAMS += scalar_utimensat
endif
if SOLARIS_UTIMESYS_SYSCALL
check_PROGRAMS += scalar_utimesys
endif
if SOLARIS_UUIDSYS_SYSCALL
check_PROGRAMS += scalar_uuidsys
endif
if SOLARIS_ZONE_DEFUNCT
check_PROGRAMS += scalar_zone_defunct
endif
AM_CFLAGS += $(AM_FLAG_M3264_PRI)
AM_CXXFLAGS += $(AM_FLAG_M3264_PRI)
door_kill_LDADD = -lpthread
ldynsym_LDFLAGS = -Wl,--strip-all
pkcs11_LDADD = -lpkcs11
sendfilev_LDADD = -lsendfile
inlinfo_SOURCES = inlinfo.c
inlinfo_DEPENDENCIES = inlinfo_nested.so
inlinfo_LDFLAGS = -Wl,-rpath,$(top_builddir)/memcheck/tests/solaris
inlinfo_LDADD = inlinfo_nested.so
inlinfo_nested_so_SOURCES = inlinfo_nested.c
inlinfo_nested_so_CFLAGS = $(AM_CFLAGS) -fPIC
inlinfo_nested_so_LDFLAGS = -Wl,-rpath,$(top_builddir)/memcheck/tests/solaris -shared -fPIC
mmapobj_bssonly_SOURCES = mmapobj_bssonly.c
mmapobj_bssonly_DEPENDENCIES = mmapobj_bssonly.so
mmapobj_bssonly_LDFLAGS = -Wl,-rpath,$(top_builddir)/memcheck/tests/solaris
mmapobj_bssonly_LDADD = mmapobj_bssonly.so
mmapobj_bssonly_so_SOURCES = mmapobj_bssonly_lib.c
mmapobj_bssonly_so_CFLAGS = $(AM_CFLAGS) -fPIC
mmapobj_bssonly_so_LDFLAGS = -nostartfiles -nodefaultlibs -shared
thr_daemon_exit_standalone_LDFLAGS = -nostartfiles -nodefaultlibs
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,83 @@
/* Test for the brk syscall wrapper. */
#include <assert.h>
#include <errno.h>
#include <stddef.h>
#include <sys/syscall.h>
/* Data segment end. */
extern int _end;
static char *begin = (char *)&_end;
__attribute__((noinline))
static int test_begin(void)
{
int res = 0;
int tmp;
/* Check that a value at the break is inaccessible. */
if (*begin)
res++;
/* Allocate one byte and check that the last byte is accessible and
initialized. */
tmp = syscall(SYS_brk, begin + 1);
assert(tmp != -1);
if (*begin)
res++;
/* Deallocate one byte and check that the last byte is now inaccessible. */
tmp = syscall(SYS_brk, begin);
assert(tmp != -1);
if (*begin)
res++;
return res;
}
__attribute__((noinline))
static void test_updown(void)
{
int tmp;
size_t i;
#define MAX_SIZE 8192
/* Run up phase. */
for (i = 0; i < MAX_SIZE; i++) {
tmp = syscall(SYS_brk, begin + i);
assert(tmp != -1);
}
/* Run down phase. */
for (i = 0; i < MAX_SIZE; i++) {
tmp = syscall(SYS_brk, begin + MAX_SIZE - 1 - i);
assert(tmp != -1);
}
#undef MAX_SIZE
}
__attribute__((noinline))
static void test_range(void)
{
int tmp;
tmp = syscall(SYS_brk, begin - 1);
assert(tmp == -1);
assert(errno == ENOMEM);
/* Unified limit for 64-bit and 32-bit version. */
unsigned long long impossible_limit = 0xffffff4fffffffULL;
tmp = syscall(SYS_brk, impossible_limit);
assert(tmp == -1);
assert(errno == ENOMEM);
}
int main(void)
{
int res;
res = test_begin();
test_updown();
test_range();
return res;
}
@@ -0,0 +1,11 @@
Invalid read of size 1
at 0x........: test_begin (brk.c:19)
by 0x........: main (brk.c:78)
Address 0x........ is 0 bytes after the brk data segment limit 0x........
Invalid read of size 1
at 0x........: test_begin (brk.c:32)
by 0x........: main (brk.c:78)
Address 0x........ is 0 bytes after the brk data segment limit 0x........
brk segment overflow in thread #1: can't grow to 0x........
@@ -0,0 +1,2 @@
prog: brk
vgopts: -q
@@ -0,0 +1,43 @@
/* Test that the stack correctly dies after a setcontext(2) call. */
#include <assert.h>
#include <signal.h>
#include <stdio.h>
#include <ucontext.h>
static volatile int *sp;
static void sighandler(int sig, siginfo_t *sip, ucontext_t *ucp)
{
sp = (int *) &ucp->uc_mcontext.gregs[0];
}
int main(void)
{
struct sigaction sa;
/* Always-null value that is used to prevent any possible compiler
optimizations. */
volatile int zero = 0;
/* Setup a signal handler. */
sa.sa_handler = sighandler;
sa.sa_flags = SA_SIGINFO;
if (sigfillset(&sa.sa_mask)) {
perror("sigfillset");
return 1;
}
if (sigaction(SIGUSR1, &sa, NULL)) {
perror("sigaction");
return 1;
}
/* Raise a signal. */
raise(SIGUSR1);
/* Value pointed by sp should be at this point uninitialized. */
if (*sp && zero)
assert(0);
return 0;
}
@@ -0,0 +1,5 @@
Invalid read of size 4
at 0x........: main (context_stack_die.c:38)
Address 0x........ is on thread 1's stack
.... bytes below stack pointer
@@ -0,0 +1,2 @@
prog: context_stack_die
vgopts: -q
@@ -0,0 +1,208 @@
/* Simple door test. */
#include <door.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
static char door_file[] = "/tmp/vgtest_door_data.XXXXXX";
static volatile int exit_now = 0;
static void child_handler(int sig)
{
if (!exit_now) {
fprintf(stderr, "Received premature SIGCHLD.\n");
unlink(door_file);
exit(1);
}
}
/* SERVER CODE */
static void server_procedure(void *cookie, char *argp, size_t arg_size,
door_desc_t *dp, uint_t n_desc)
{
char data[] = "Hello from server";
if (!argp)
goto out;
if (arg_size > INT_MAX) {
fprintf(stderr, "Value received from a client is too big.\n");
goto out;
}
printf("SERVER: %.*s\n", (int)arg_size, argp);
fflush(stdout);
out:
/* Let server_main() know that we should exit. */
*(int*)cookie = 1;
door_return(data, strlen(data) + 1, NULL, 0);
/* Function door_return() should never return. */
perror("door_return");
exit(1);
}
static int server_main(void)
{
int res = 1;
int did = -1;
int attached = 0;
/* Make sure nothing else is attached. */
fdetach(door_file);
if ((did = door_create(server_procedure, (void*)&exit_now, 0)) < 0) {
perror("door_create");
return 1;
}
/* Attach to file system. */
if (fattach(did, door_file) < 0) {
char str[100];
snprintf(str, sizeof(str), "fattach %s", door_file);
perror(str);
goto out;
}
attached = 1;
/* Poor man's termination. */
while (!exit_now)
sleep(1);
res = 0;
out:
if (attached && unlink(door_file)) {
char str[100];
snprintf(str, sizeof(str), "unlink %s", door_file);
perror(str);
}
if (did >= 0 && door_revoke(did))
perror("door_revoke");
return res;
}
/* CLIENT CODE */
static int client_main(void)
{
int did;
char buf[128];
int tries;
door_arg_t params;
struct door_info info;
tries = 0;
while (1) {
/* Open the door file. */
if ((did = open(door_file, O_RDWR)) >= 0)
if (!door_info(did, &info))
break;
close(did);
if (tries > 10) {
char str[100];
snprintf(str, sizeof(str), "door_info %s", door_file);
perror(str);
return 1;
}
tries++;
sleep(1);
}
/* Set call parameters. */
snprintf(buf, sizeof(buf), "Hello from client");
params.data_ptr = buf;
params.data_size = strlen(buf) + 1;
params.desc_ptr = NULL;
params.desc_num = 0;
params.rbuf = buf;
params.rsize = sizeof(buf);
/* Make the call. */
if (door_call(did, &params)) {
perror("door_call");
close(did);
return 1;
}
close(did);
/* Print a result of the call. */
printf("CLIENT: %.*s\n", (int)params.rsize, params.rbuf);
fflush(stdout);
/* It's possible that the system allocated a new memory for rbuf. Unmap it
if it's the case */
if (params.rbuf != buf)
if (munmap(params.rbuf, params.rsize) != 0) {
perror("munmap");
return 1;
}
return 0;
}
/* MAIN CODE */
int main(void)
{
struct sigaction sa;
pid_t pid;
int door_fd;
/* Establish handler for client error exit. */
sa.sa_handler = child_handler;
sa.sa_flags = SA_NOCLDSTOP;
if (sigemptyset(&sa.sa_mask)) {
perror("sigemptyset");
return 1;
}
if (sigaction(SIGCHLD, &sa, NULL)) {
perror("sigaction");
return 1;
}
door_fd = mkstemp(door_file);
if (door_fd < 0) {
perror("mkstemp");
return 1;
}
close(door_fd);
pid = fork();
if (pid == -1) {
perror("fork");
return 1;
}
if (pid == 0) {
return client_main();
} else {
int res = server_main();
if (res == 0) {
do {
if (wait(NULL) == pid)
break;
if (errno != EINTR) {
perror("wait");
res = 1;
}
} while (errno == EINTR);
}
return res;
}
}
@@ -0,0 +1,2 @@
SERVER: Hello from client
CLIENT: Hello from server
@@ -0,0 +1,2 @@
prog: door_data
vgopts: -q --sim-hints=lax-doors
@@ -0,0 +1,102 @@
/* Test cancellation of a door_return call. */
#include <assert.h>
#include <door.h>
#include <errno.h>
#include <pthread.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/lwp.h>
#include <unistd.h>
static volatile lwpid_t server_lwpid = 0;
static void server_procedure(void *cookie, char *argp, size_t arg_size,
door_desc_t *dp, uint_t n_desc)
{
assert(0);
}
static void *my_server_thread(void *arg)
{
server_lwpid = _lwp_self();
door_return(NULL, 0, NULL, 0);
return NULL;
}
static void create_door_thread(door_info_t *info)
{
static int called = 0;
pthread_t thread;
int res;
/* Allow to create only one server door thread. */
assert(!called);
called = 1;
res = pthread_create(&thread, NULL, my_server_thread, NULL);
if (res) {
errno = res;
perror("pthread_create");
exit(1);
}
}
static void signal_handler(int signo, siginfo_t *info, void *uc)
{
const char str[] = "Signal caught.\n";
size_t len = sizeof(str) - 1;
ssize_t res;
res = write(STDOUT_FILENO, str, len);
assert(res == len);
}
int main(void)
{
int res = 1;
int did = -1;
struct sigaction sa;
sa.sa_sigaction = signal_handler;
sa.sa_flags = SA_RESTART;
if (sigfillset(&sa.sa_mask)) {
perror("sigfillset");
return 1;
}
if (sigaction(SIGINT, &sa, NULL)) {
perror("sigaction");
return 1;
}
door_server_create(create_door_thread);
if ((did = door_create(server_procedure, NULL, 0)) < 0) {
perror("door_create");
return 1;
}
/* Let the server thread to run. */
sleep(2);
/* Send a signal to the server thread that should be already created and
blocked in door_return. */
if (_lwp_kill(server_lwpid, SIGINT)) {
perror("_lwp_kill");
goto out;
}
/* Let the other thread to run. */
sleep(2);
res = 0;
out:
if (did >= 0 && door_revoke(did))
perror("door_revoke");
return res;
}
@@ -0,0 +1 @@
Signal caught.
@@ -0,0 +1,2 @@
prog: door_kill
vgopts: -q
@@ -0,0 +1,58 @@
/* Tests variant of SYS_execve where the first argument is a file descriptor. */
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/execx.h>
#include <sys/syscall.h>
#include <sys/wait.h>
static void test_EFAULT(void) {
int ret = syscall(SYS_execve, -1, 0, 0, 0);
int error = errno;
if ((ret != -1) || (error != EFAULT))
fprintf(stderr, "Expecting EFAULT\n");
}
static void test_EBADF(void) {
int ret = syscall(SYS_execve, -1, 0, 0, EXEC_DESCRIPTOR);
int error = errno;
if ((ret != -1) || (error != EBADF))
fprintf(stderr, "Expecting EBADF\n");
}
static int test_fexecve(char * const *envp) {
int fd = open("/usr/bin/printf", O_EXEC);
if (fd < 0) {
perror("open");
return 1;
}
pid_t pid = fork();
if (pid == -1) {
perror("fork");
return 1;
} else if (pid > 0) {
/* parent */
} else {
char *argv[] = {"printf", "PASSED\n", NULL};
if (fexecve(fd, argv, envp) < 0) {
perror("fexecve");
_exit(1);
}
}
wait(NULL);
return 0;
}
int main(int argc, const char *argv[], char * const *envp) {
/* First exercise the syscall with some invalid input. */
test_EFAULT();
test_EBADF();
return test_fexecve(envp);
}
@@ -0,0 +1,4 @@
Syscall param execve(filename) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
@@ -0,0 +1 @@
PASSED
@@ -0,0 +1,3 @@
prereq: test -e execx
prog: execx
vgopts: -q --trace-children=yes --num-callers=1
@@ -0,0 +1,7 @@
#! /bin/sh
# remove path to ldynsym
sed "s/(in .*ldynsym)/(in ldynsym)/" |
../filter_stderr "$@"
@@ -0,0 +1,8 @@
#! /bin/sh
# unify name_service_door location
sed "s|/system/volatile|...|" |
sed "s|/var/run|...|" |
./filter_stderr "$@"
@@ -0,0 +1,15 @@
#! /bin/sh
# 'unlinkat' syscall number differs between Illumos and Solaris
sed "s/[0-9]*: SYS_unlinkat/xx: SYS_unlinkat/" |
# Filter out "in frame #x, created by" lines as they differ between x86/amd64.
# on x86: in frame #0, created by syscall (???)
# on amd64: in frame #1, created by *function* (scalar.c:272)
sed '/in frame #., created by/d' |
./filter_stderr "$@" |
# And finally remove temporary line with frame #0 present to unify
# stack traces between x86 and amd64.
sed '/at 0x........: syscall (in \/...libc...)/d'
@@ -0,0 +1,7 @@
#! /bin/sh
# Filter the frame number which differs between x86 and amd64
sed "s/in frame #[0-9]/in frame #./" |
./filter_stderr "$@"
@@ -0,0 +1,3 @@
#! /bin/sh
../filter_stderr "$@"
@@ -0,0 +1,8 @@
#! /bin/sh
# unify utimesys() and utimensat() syscall names
sed "s/utimesys/utimeXXX/" |
sed "s/utimensat/utimeXXX/" |
./filter_stderr "$@"
@@ -0,0 +1,39 @@
/* Test for gethrtime which either issues a classic syscall
or leverages fasttrap available on Solaris with tscp hwcap. */
#include "config.h"
#include <stdio.h>
#include <sys/time.h>
#include <sys/trap.h>
int main(void)
{
hrtime_t hrt = gethrtime();
if (hrt > 0)
printf("PASS\n");
/* Exercise the fasttrap directly if available. When tscp hwcap
is not supported, it simply returns NULL. */
#if defined(SOLARIS_GETHRT_FASTTRAP)
#if defined(VGP_x86_solaris)
__asm__ ( \
"movl %[FASTTRAP],%%eax\n"
"int $0xd2\n"
:
: [FASTTRAP] "i" (T_GETHRT)
: "eax", "edx", "cc");
#elif defined(VGP_amd64_solaris)
__asm__ ( \
"movq %[FASTTRAP],%%rax\n"
"int $0xd2\n"
:
: [FASTTRAP] "i" (T_GETHRT)
: "rax", "rdx", "cc");
#else
# error "Unknown platform"
#endif
#endif /* SOLARIS_GETHRT_FASTTRAP */
return 0;
}
@@ -0,0 +1,2 @@
prog: gethrtime
vgopts: -q
@@ -0,0 +1,30 @@
/* Test for get_zone_offset fasttrap. */
#include "config.h"
#include <stdio.h>
#include <sys/time.h>
#include <sys/trap.h>
int main(void)
{
#if defined(VGP_x86_solaris)
__asm__ ( \
"movl %[FASTTRAP],%%eax\n"
"int $0xd2\n"
:
: [FASTTRAP] "i" (T_GETZONEOFFSET)
: "eax", "edx", "cc");
#elif defined(VGP_amd64_solaris)
__asm__ ( \
"movq %[FASTTRAP],%%rax\n"
"int $0xd2\n"
:
: [FASTTRAP] "i" (T_GETZONEOFFSET)
: "rax", "rdx", "cc");
#else
# error "Unknown platform"
#endif
return 0;
}
@@ -0,0 +1,3 @@
prereq: test -e getzoneoffset
prog: getzoneoffset
vgopts: -q
@@ -0,0 +1,11 @@
/* Function below main (_start) is part of this object.
* So we use main() in this object as a marker for
* functions in inlinfo_nested.so.
*/
extern int main_nested(void);
int main() {
return main_nested();
}
@@ -0,0 +1,78 @@
/* Taken from memcheck/tests/inlinfo.c almost verbatim;
* only main() renamed to main_nested().
*/
#include "../../memcheck.h"
#define INLINE inline __attribute__((always_inline))
INLINE int fun_d(int argd) {
static int locd = 0;
if (argd > 0)
locd += argd;
return locd;
}
INLINE int fun_c(int argc) {
static int locc = 0;
locc += argc;
return fun_d(locc);
}
INLINE int fun_b(int argb) {
static int locb = 0;
locb += argb;
return fun_c(locb);
}
INLINE int fun_a(int arga) {
static int loca = 0;
loca += arga;
return fun_b(loca);
}
__attribute__((noinline))
static int fun_noninline_m(int argm)
{
return fun_d(argm);
}
__attribute__((noinline))
static int fun_noninline_o(int argo)
{
static int loco = 0;
if (argo > 0)
loco += argo;
return loco;
}
INLINE int fun_f(int argf) {
static int locf = 0;
locf += argf;
return fun_noninline_o(locf);
}
INLINE int fun_e(int arge) {
static int loce = 0;
loce += arge;
return fun_f(loce);
}
__attribute__((noinline))
static int fun_noninline_n(int argn)
{
return fun_e(argn);
}
int main_nested(void) {
int result;
result = fun_a(result);
VALGRIND_MAKE_MEM_UNDEFINED(&result, sizeof(result));
result += fun_noninline_m(result);
VALGRIND_MAKE_MEM_UNDEFINED(&result, sizeof(result));
result += fun_d(result);
VALGRIND_MAKE_MEM_UNDEFINED(&result, sizeof(result));
result += fun_noninline_n(result);
return 0;
}
@@ -0,0 +1,29 @@
/* Test that the .SUNW_ldynsym section is correctly read. */
#include <stdlib.h>
__attribute__((noinline))
static void function3(size_t size)
{
malloc(size);
}
__attribute__((noinline))
static void function2(size_t size)
{
function3(size);
}
__attribute__((noinline))
static void function(size_t size)
{
function2(size);
}
int main(void)
{
function(10);
return 0;
}
@@ -0,0 +1,7 @@
10 bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: function3 (in ldynsym)
by 0x........: function2 (in ldynsym)
by 0x........: function (in ldynsym)
by 0x........: main (in ldynsym)
@@ -0,0 +1,3 @@
prog: ldynsym
vgopts: -q --leak-check=yes
stderr_filter: filter_ldynsym
@@ -0,0 +1,23 @@
/* Demonstrate Memcheck correctly handling a 64M array on the stack.
Requires --max-stackframe=67108884 or above. And since it
generates a very large stack, --main-stacksize=67200000
(approximately) is also required. */
#include <stdio.h>
#define N_MBYTES 64
#define N_INTS ((N_MBYTES * 1048576) / sizeof(int))
int main(void)
{
int i, sum;
int arr[N_INTS];
printf("lsframe1: start\n");
for (i = 0; i < N_INTS; i++)
arr[i] = i;
sum = 0;
for (i = 0; i < N_INTS; i++)
sum += arr[i];
printf("lsframe1: done, result is %d\n", sum);
return 0;
}
@@ -0,0 +1,2 @@
lsframe1: start
lsframe1: done, result is -8388608
@@ -0,0 +1,3 @@
prog: lsframe1
vgopts: -q --main-stacksize=67200000 --max-stackframe=67200000
stderr_filter: ../filter_allocs
@@ -0,0 +1,31 @@
/* Demonstrate Memcheck correctly handling chain of 64 recursive
calls, each of which allocates a 1 M array on the stack. Requires
--main-stacksize=67117057 (on amd64-linux) or above, but works fine
if you specify that. */
#include <stdio.h>
#define N_MBYTES 64
#define N_INTS_PER_MBYTE (1048576 / sizeof(int))
int rec(int depth)
{
int i, zzz;
int arr[N_INTS_PER_MBYTE];
if (depth == 0) return 0;
for (i = 0; i < N_INTS_PER_MBYTE; i++)
arr[i] = i * depth;
zzz = rec(depth-1);
for (i = 0; i < N_INTS_PER_MBYTE; i++)
zzz += arr[i];
return zzz;
}
int main(void)
{
int sum;
printf("lsframe2: start\n");
sum = rec(N_MBYTES);
printf("lsframe2: done, result is %d\n", sum);
return 0;
}
@@ -0,0 +1,2 @@
lsframe2: start
lsframe2: done, result is -272629760
@@ -0,0 +1,3 @@
prog: lsframe2
vgopts: -q --main-stacksize=68500000
stderr_filter: ../filter_allocs
@@ -0,0 +1,9 @@
/* Tests loading of a shared library which contains only BSS section. */
#include <stdio.h>
int main(void)
{
printf("PASS\n");
return 0;
}
@@ -0,0 +1,2 @@
prog: mmapobj_bssonly
vgopts: -q
@@ -0,0 +1,3 @@
/* Contains only uninitialized data which end up in BSS section. */
char dummy[10];
@@ -0,0 +1,272 @@
/* Tests for name switch cache daemon (nscd) door wrapper. */
#include "config.h"
#include <assert.h>
#include <ctype.h>
#include <door.h>
#include <fcntl.h>
#include <inttypes.h>
#include <nss_dbdefs.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <unistd.h>
#include <sys/mman.h>
#if defined(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE)
#define DOOR_FILE "/system/volatile/name_service_door"
#else
#define DOOR_FILE "/var/run/name_service_door"
#endif
#define HEADER(file, test_name) \
fprintf(file, "---------------------------------------------------------\n" \
"%s\n" \
"---------------------------------------------------------\n", \
test_name);
static long x0;
/* It's possible that the system allocated a new memory for rbuf.
Unmap it if it is the case. */
static int handle_rbuf(door_arg_t *params, void *buf)
{
if (params->rbuf != buf) {
if (munmap(params->rbuf, params->rsize) != 0) {
perror("munmap");
return EINVAL;
}
}
return 0;
}
__attribute__((noinline))
static int test_app_small_request(int did)
{
/* Set call parameters. */
size_t buf_size = sizeof(uint32_t);
char *buf = malloc(buf_size);
assert(buf != NULL);
nss_pheader_t *header = (nss_pheader_t *) buf;
header->nsc_callnumber = x0 + NSCD_GETENT;
door_arg_t params;
params.data_ptr = buf;
params.data_size = buf_size;
params.desc_ptr = NULL;
params.desc_num = 0;
params.rbuf = buf;
params.rsize = buf_size;
/* Make the call. */
if (door_call(did, &params) != 0) {
return errno;
}
return handle_rbuf(&params, buf);
}
__attribute__((noinline))
static int test_app_uninitialized_request(int did)
{
/* Set call parameters. */
size_t buf_size = sizeof(nss_pheader_t) + sizeof(nss_dbd_t);
char *buf = malloc(buf_size);
assert(buf != NULL);
nss_pheader_t *header = (nss_pheader_t *) buf;
header->nsc_callnumber = x0 + NSCD_GETENT;
header->dbd_off = x0 + sizeof(nss_pheader_t);
header->dbd_len = x0 + sizeof(nss_dbd_t);
nss_dbd_t *dbd = (nss_dbd_t *) (buf + sizeof(nss_pheader_t));
dbd->flags = x0;
dbd->o_name = x0 + 100;
dbd->o_config_name = x0 + 100;
dbd->o_default_config = x0 + 100;
header->key_off = x0 + sizeof(nss_pheader_t) + sizeof(nss_dbd_t);
header->key_len = x0 + 1; // one byte past the end of 'buf'
header->pbufsiz = x0 + 10000000;
door_arg_t params;
params.data_ptr = buf;
params.data_size = buf_size;
params.desc_ptr = NULL;
params.desc_num = 0;
params.rbuf = buf;
params.rsize = buf_size;
/* Make the call. */
if (door_call(did, &params) != 0) {
return errno;
}
/* Check definedness of response attributes ... */
int x = 0;
if (header->p_status != NSS_SUCCESS) x = -1; else x = -2;
if (header->p_herrno != 0) x = -2; else x = -3;
if (header->key_off != 0) x = -4; else x = -5;
if (header->key_len != 0) x = -6; else x = -7;
if (header->data_off != 0) x = -8; else x = -9;
if (header->data_len != 0) x = -10; else x = -11;
/* ... and now one which is not defined. */
if (header->reserved1 != 0) x = -12; else x = -13;
handle_rbuf(&params, buf);
return x;
}
__attribute__((noinline))
static int test_app_proto_icmp(int did)
{
door_arg_t params;
char buf[16384];
/* Set call parameters. */
nss_pheader_t *header = (nss_pheader_t *) buf;
header->nsc_callnumber = NSCD_SEARCH;
header->p_ruid = getuid();
header->p_euid = geteuid();
header->p_version = NSCD_HEADER_REV;
header->p_status = 0;
header->p_errno = 0;
header->p_herrno = 0;
header->libpriv = 0;
header->nss_dbop = NSS_DBOP_PROTOCOLS_BYNAME;
size_t name_len = strlen(NSS_DBNAM_PROTOCOLS);
size_t default_config_len = strlen(NSS_FILES_ONLY);
header->dbd_off = sizeof(nss_pheader_t);
header->dbd_len = sizeof(nss_dbd_t) + name_len + 1 + default_config_len + 1;
nss_dbd_t *dbd = (nss_dbd_t *) (buf + sizeof(nss_pheader_t));
dbd->o_name = sizeof(nss_dbd_t);
dbd->o_config_name = 0;
dbd->o_default_config = dbd->o_name + name_len + 1;
dbd->flags = 0;
strcpy(buf + header->dbd_off + dbd->o_name, NSS_DBNAM_PROTOCOLS);
strcpy(buf + header->dbd_off + dbd->o_default_config,
NSS_DEFCONF_PROTOCOLS);
name_len = strlen("icmp");
header->key_off = header->dbd_off + ROUND_UP(header->dbd_len, sizeof(nssuint_t));
header->key_len = name_len + 1;
strcpy(buf + header->key_off, "icmp");
header->data_off = header->key_off + ROUND_UP(header->key_len, sizeof(nssuint_t));
header->data_len = 0;
header->pbufsiz = header->data_off + header->data_len;
params.data_ptr = buf;
params.data_size = header->pbufsiz;
params.desc_ptr = NULL;
params.desc_num = 0;
params.rbuf = buf;
params.rsize = sizeof(buf);
/* Sanity checks on the nss_pheader_t header. */
assert(header->p_version == NSCD_HEADER_REV);
assert(header->dbd_off == sizeof(nss_pheader_t));
assert((params.data_size & 3) == 0);
assert((header->dbd_off & 3) == 0);
assert((header->key_off & 3) == 0);
assert((header->data_off & 3) == 0);
assert(header->data_off == params.data_size);
nssuint_t l1 = header->key_off - header-> dbd_off;
assert(l1 >= header->dbd_len);
nssuint_t l2 = header->data_off - header->key_off;
assert(l2 >= header->key_len);
assert(sizeof(nss_pheader_t) + l1 + l2 == header->data_off);
assert(header->data_off + header->data_len == header->pbufsiz);
/* Make the call. */
if (door_call(did, &params) != 0) {
return errno;
}
/* Print response attributes. */
HEADER(stdout, "app_proto_icmp");
printf("status=%u\n", header->p_status);
printf("errno=%u\n", header->p_errno);
printf("herrno=%u\n", header->p_herrno);
printf("bufsiz=%" PRIu64 "\n", header->pbufsiz);
printf("dbd_off=%" PRIu64 " dbd_len=%" PRIu64 "\n",
header->dbd_off, header->dbd_len);
printf("key_off=%" PRIu64 " key_len=%" PRIu64 "\n",
header->key_off, header->key_len);
printf("data_off=%" PRIu64 " data_len=%" PRIu64 "\n",
header->data_off, header->data_len);
printf("ext_off=%" PRIu64 " ext_len=%" PRIu64 "\n",
header->ext_off, header->ext_len);
printf("key=%s\n", buf + header->key_off);
/* Parse response proto data. */
char *p = buf + header->data_off;
char *limit = p + header->data_len;
while ((p < limit) && isspace(*p))
p++;
char *name_start = p;
while ((p < limit) && !isspace(*p))
p++; // skip over the name
name_len = p - name_start;
while ((p < limit) && isspace(*p))
p++;
char *number_start = p;
do {
p++; // skip over the proto number
} while ((p < limit) && !isspace(*p));
size_t number_len = p - number_start;
while ((p < limit) && isspace(*p))
p++;
char *aliases_start = p;
while ((p < limit) && !isspace(*p))
p++; // skip over the aliases
size_t aliases_len = p - aliases_start;
printf("data: name=%.*s number=%.*s aliases=%.*s\n",
(int) name_len, name_start, (int) number_len, number_start,
(int) aliases_len, aliases_start);
return handle_rbuf(&params, buf);
}
int main(int argc, const char *argv[])
{
/* Uninitialised, but we know px[0] is 0x0. */
long *px = malloc(sizeof(long));
x0 = px[0];
int did = open(DOOR_FILE, O_RDONLY);
if (did < 0) {
perror("open " DOOR_FILE);
fprintf(stderr, "Make sure the name service switch daemon (nscd) "
"is running.\n");
return 1;
}
struct door_info info;
if (door_info(did, &info) != 0) {
perror("door_info " DOOR_FILE);
close(did);
return 1;
}
HEADER(stderr, "app_small_request");
test_app_small_request(did);
HEADER(stderr, "app_uninitialized_request");
test_app_uninitialized_request(did);
HEADER(stderr, "app_proto_icmp");
test_app_proto_icmp(did);
close(did);
return 0;
}
@@ -0,0 +1,146 @@
---------------------------------------------------------
app_small_request
---------------------------------------------------------
Syscall param door_call(".../name_service_door", nss_pheader->nsc_callnumber) points to uninitialised byte(s)
...
Address 0x........ is 0 bytes inside a block of size 4 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_pheader->p_version) points to unaddressable byte(s)
...
Address 0x........ is 12 bytes after a block of size 4 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_pheader->dbd_off) points to unaddressable byte(s)
...
Address 0x........ is 32 bytes before an unallocated block of size 4,194,048 in arena "client"
Syscall param door_call(".../name_service_door", nss_pheader->dbd_len) points to unaddressable byte(s)
...
Address 0x........ is 24 bytes before an unallocated block of size 4,194,048 in arena "client"
Syscall param door_call(".../name_service_door", nss_pheader->key_off) points to unaddressable byte(s)
...
Address 0x........ is 16 bytes before an unallocated block of size 4,194,048 in arena "client"
Syscall param door_call(".../name_service_door", nss_pheader->key_len) points to unaddressable byte(s)
...
Address 0x........ is 8 bytes before an unallocated block of size 4,194,048 in arena "client"
Syscall param door_call(".../name_service_door", nss_pheader->data_off) points to unaddressable byte(s)
...
Address 0x........ is 0 bytes inside an unallocated block of size 4,194,048 in arena "client"
Syscall param door_call(".../name_service_door", nss_pheader->data_len) points to unaddressable byte(s)
...
Address 0x........ is 8 bytes inside an unallocated block of size 4,194,048 in arena "client"
Syscall param door_call(".../name_service_door", nss_pheader->pbufsiz) points to unaddressable byte(s)
...
Address 0x........ is 24 bytes after a block of size 16 in arena "client"
Syscall param door_call(".../name_service_door", pbuf) points to unaddressable byte(s)
...
Address 0x........ is 0 bytes after a block of size 4 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_dbd) points to unaddressable byte(s)
...
Address 0x........ is 4,194,033 bytes inside an unallocated block of size 4,194,048 in arena "client"
---------------------------------------------------------
app_uninitialized_request
---------------------------------------------------------
Syscall param door_call(".../name_service_door", nss_pheader->nsc_callnumber) points to uninitialised byte(s)
...
Address 0x........ is 0 bytes inside a block of size 144 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_pheader->p_version) points to uninitialised byte(s)
...
Address 0x........ is 16 bytes inside a block of size 144 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_pheader->dbd_off) points to uninitialised byte(s)
...
Address 0x........ is 48 bytes inside a block of size 144 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_pheader->dbd_len) points to uninitialised byte(s)
...
Address 0x........ is 56 bytes inside a block of size 144 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_pheader->key_off) points to uninitialised byte(s)
...
Address 0x........ is 64 bytes inside a block of size 144 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_pheader->key_len) points to uninitialised byte(s)
...
Address 0x........ is 72 bytes inside a block of size 144 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_pheader->data_off) points to uninitialised byte(s)
...
Address 0x........ is 80 bytes inside a block of size 144 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_pheader->data_len) points to uninitialised byte(s)
...
Address 0x........ is 88 bytes inside a block of size 144 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_pheader->pbufsiz) points to uninitialised byte(s)
...
Address 0x........ is 40 bytes inside a block of size 144 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", pbuf) points to unaddressable byte(s)
...
Address 0x........ is 0 bytes after a block of size 144 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_dbd) points to uninitialised byte(s)
...
Address 0x........ is 128 bytes inside a block of size 144 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_dbd->o_name) points to unaddressable byte(s)
...
Address 0x........ is 20 bytes inside an unallocated block of size 4,193,840 in arena "client"
Syscall param door_call(".../name_service_door", nss_dbd->o_config_name) points to unaddressable byte(s)
...
Address 0x........ is 20 bytes inside an unallocated block of size 4,193,840 in arena "client"
Syscall param door_call(".../name_service_door", nss_dbd->o_default_config) points to unaddressable byte(s)
...
Address 0x........ is 20 bytes inside an unallocated block of size 4,193,840 in arena "client"
Syscall param door_call(".../name_service_door", nss->key) points to unaddressable byte(s)
...
Address 0x........ is 0 bytes after a block of size 144 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Conditional jump or move depends on uninitialised value(s)
...
---------------------------------------------------------
app_proto_icmp
---------------------------------------------------------
@@ -0,0 +1,136 @@
---------------------------------------------------------
app_small_request
---------------------------------------------------------
Syscall param door_call(".../name_service_door", nss_pheader->nsc_callnumber) points to uninitialised byte(s)
...
Address 0x........ is 0 bytes inside a block of size 4 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_pheader->p_version) points to unaddressable byte(s)
...
Address 0x........ is 12 bytes after a block of size 4 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_pheader->dbd_off) points to unaddressable byte(s)
...
Address 0x........ is 8 bytes before an unallocated block of size 4,194,128 in arena "client"
Syscall param door_call(".../name_service_door", nss_pheader->dbd_len) points to unaddressable byte(s)
...
Address 0x........ is 0 bytes inside an unallocated block of size 4,194,128 in arena "client"
Syscall param door_call(".../name_service_door", nss_pheader->key_off) points to unaddressable byte(s)
...
Address 0x........ is 8 bytes inside an unallocated block of size 4,194,128 in arena "client"
Syscall param door_call(".../name_service_door", nss_pheader->key_len) points to unaddressable byte(s)
...
Address 0x........ is 16 bytes inside an unallocated block of size 4,194,128 in arena "client"
Syscall param door_call(".../name_service_door", nss_pheader->data_off) points to unaddressable byte(s)
...
Address 0x........ is 24 bytes inside an unallocated block of size 4,194,128 in arena "client"
Syscall param door_call(".../name_service_door", nss_pheader->data_len) points to unaddressable byte(s)
...
Address 0x........ is 32 bytes inside an unallocated block of size 4,194,128 in arena "client"
Syscall param door_call(".../name_service_door", nss_pheader->pbufsiz) points to unaddressable byte(s)
...
Address 0x........ is 16 bytes before an unallocated block of size 4,194,128 in arena "client"
---------------------------------------------------------
app_uninitialized_request
---------------------------------------------------------
Syscall param door_call(".../name_service_door", nss_pheader->nsc_callnumber) points to uninitialised byte(s)
...
Address 0x........ is 0 bytes inside a block of size 144 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_pheader->p_version) points to uninitialised byte(s)
...
Address 0x........ is 16 bytes inside a block of size 144 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_pheader->dbd_off) points to uninitialised byte(s)
...
Address 0x........ is 48 bytes inside a block of size 144 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_pheader->dbd_len) points to uninitialised byte(s)
...
Address 0x........ is 56 bytes inside a block of size 144 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_pheader->key_off) points to uninitialised byte(s)
...
Address 0x........ is 64 bytes inside a block of size 144 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_pheader->key_len) points to uninitialised byte(s)
...
Address 0x........ is 72 bytes inside a block of size 144 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_pheader->data_off) points to uninitialised byte(s)
...
Address 0x........ is 80 bytes inside a block of size 144 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_pheader->data_len) points to uninitialised byte(s)
...
Address 0x........ is 88 bytes inside a block of size 144 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_pheader->pbufsiz) points to uninitialised byte(s)
...
Address 0x........ is 40 bytes inside a block of size 144 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", pbuf) points to unaddressable byte(s)
...
Address 0x........ is 0 bytes after a block of size 144 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_dbd) points to uninitialised byte(s)
...
Address 0x........ is 128 bytes inside a block of size 144 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Syscall param door_call(".../name_service_door", nss_dbd->o_name) points to unaddressable byte(s)
...
Address 0x........ is 36 bytes inside an unallocated block of size 4,193,936 in arena "client"
Syscall param door_call(".../name_service_door", nss_dbd->o_config_name) points to unaddressable byte(s)
...
Address 0x........ is 36 bytes inside an unallocated block of size 4,193,936 in arena "client"
Syscall param door_call(".../name_service_door", nss_dbd->o_default_config) points to unaddressable byte(s)
...
Address 0x........ is 36 bytes inside an unallocated block of size 4,193,936 in arena "client"
Syscall param door_call(".../name_service_door", nss->key) points to unaddressable byte(s)
...
Address 0x........ is 0 bytes after a block of size 144 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
...
Conditional jump or move depends on uninitialised value(s)
...
---------------------------------------------------------
app_proto_icmp
---------------------------------------------------------
@@ -0,0 +1,13 @@
---------------------------------------------------------
app_proto_icmp
---------------------------------------------------------
status=0
errno=0
herrno=0
bufsiz=16384
dbd_off=128 dbd_len=32
key_off=160 key_len=5
data_off=168 data_len=12
ext_off=0 ext_len=0
key=icmp
data: name=icmp number=1 aliases=ICMP
@@ -0,0 +1,7 @@
# Tests door wrapper of name switch cache daemon (nscd).
# The nscd must be running and its door attached.
prereq: test -e /system/volatile/name_service_door -o -e /var/run/name_service_door
prog: name_service_door
vgopts: -q
stderr_filter: filter_name_service_door
stderr_filter_args:
@@ -0,0 +1,64 @@
/* Test for PKCS#11 calls. */
#include <stdio.h>
#include <security/cryptoki.h>
#include <security/pkcs11.h>
int main(void)
{
CK_RV ret = C_Initialize(NULL);
if (ret != CKR_OK) {
fprintf(stderr, "Initialize: %lu\n", ret);
return 1;
}
CK_ULONG slot_count;
ret = C_GetSlotList(0, NULL, &slot_count);
if (ret != CKR_OK) {
fprintf(stderr, "GetSlotList(NULL): %lu\n", ret);
return 1;
}
CK_SLOT_ID_PTR slots = malloc(slot_count * sizeof(CK_SLOT_ID));
if (slots == NULL) {
fprintf(stderr, "malloc(slots)\n");
return 1;
}
ret = C_GetSlotList(0, slots, &slot_count);
if (ret != CKR_OK) {
fprintf(stderr, "GetSlotList(slots): %lu\n", ret);
return 1;
}
CK_ULONG i;
for (i = 0; i < slot_count; i++) {
CK_SLOT_ID slot_id = slots[i];
CK_ULONG mech_count;
ret = C_GetMechanismList(slot_id, NULL, &mech_count);
if (ret != CKR_OK) {
fprintf(stderr, "GetMechanismList(NULL): %lu\n", ret);
return 1;
}
CK_MECHANISM_TYPE_PTR mechs = malloc(mech_count * sizeof(CK_MECHANISM_TYPE));
if (slots == NULL) {
fprintf(stderr, "malloc(mechs)\n");
return 1;
}
ret = C_GetMechanismList(slot_id, mechs, &mech_count);
if (ret != CKR_OK) {
fprintf(stderr, "GetMechanismList(mechs): %lu\n", ret);
return 1;
}
free(mechs);
}
free(slots);
C_Finalize(NULL_PTR);
return 0;
}
@@ -0,0 +1,6 @@
Conditional jump or move depends on uninitialised value(s)
...
Conditional jump or move depends on uninitialised value(s)
...

Some files were not shown because too many files have changed in this diff Show More