# Memory test. Tries userspace copies covering # the entire 32-bit address space. global addr %{ static char buf[16384]; %} function copy_more:long(addr:long) %{ char __user *src = (char __user *)(long)THIS->addr; if (access_ok(VERIFY_READ, src, 2048)) THIS->__retvalue = _stp_copy_from_user (buf, src, 2048); else THIS->__retvalue = -1; %} probe kernel.function("sys_read") { printf("copying from %x ... ", addr) ret = copy_more(addr) if (ret) if (ret == -1) printf("FAILED (bad address)\n") else printf("FAILED (page_fault)\n") else printf("GOOD\n") addr += 4096 if (addr > 0xffffffff) exit() } probe end { printf("\nDONE. Test succeeded if you see this and there\n") printf("are no might_sleep warnings in the system log.\n") }