diff options
-rw-r--r-- | NEWS | 12 | ||||
-rw-r--r-- | hash.cxx | 42 | ||||
-rw-r--r-- | hash.h | 1 | ||||
-rw-r--r-- | tapset/aux_syscalls.stp | 3 | ||||
-rw-r--r-- | util.cxx | 27 | ||||
-rw-r--r-- | util.h | 1 |
6 files changed, 71 insertions, 15 deletions
@@ -66,6 +66,18 @@ every reentrancy event, including the probe points of the resident and interloper probes. +- Default to --disable-pie for configure. + Use --enable-pie to turn it back on. + +- Improved sdt.h compatibility and test suite for static dtrace + compatible user space markers. + +- Some architectures now use syscall wrappers (HAVE_SYSCALL_WRAPPERS). + The syscall tapset has been enhanced to take care of the syscall + wrappers in this release. + +- Security fix for CVE-2009-0784: stapusr module-path checking race. + * What's new in version 0.9 - Typecasting is now supported using the @cast operator. A script can @@ -48,6 +48,20 @@ hash::add(const unsigned char *buffer, size_t size) void +hash::add_file(const std::string& filename) +{ + struct stat st; + + if (stat(filename.c_str(), &st) == 0) + { + add(filename); + add(st.st_size); + add(st.st_mtime); + } +} + + +void hash::result(string& r) { ostringstream rstream; @@ -68,37 +82,37 @@ hash::result(string& r) static void get_base_hash (systemtap_session& s, hash& h) { - struct stat st; - // Hash kernel release and arch. h.add(s.kernel_release); h.add(s.kernel_build_tree); h.add(s.architecture); + // Hash a few kernel version/build-id files too + // (useful for kernel developers reusing a single source tree) + h.add_file(s.kernel_build_tree + "/.config"); + h.add_file(s.kernel_build_tree + "/.version"); + h.add_file(s.kernel_build_tree + "/include/linux/compile.h"); + h.add_file(s.kernel_build_tree + "/include/linux/version.h"); + h.add_file(s.kernel_build_tree + "/include/linux/utsrelease.h"); + + // If the kernel is a git working directory, then add the git HEAD + // revision to our hash as well. + h.add(git_revision(s.kernel_build_tree)); + // Hash runtime path (that gets added in as "-R path"). h.add(s.runtime_path); // Hash compiler path, size, and mtime. We're just going to assume // we'll be using gcc. XXX: getting kbuild to spit out out would be // better. - string gcc_path = find_executable ("gcc"); - if (stat(gcc_path.c_str(), &st) == 0) - { - h.add(gcc_path); - h.add(st.st_size); - h.add(st.st_mtime); - } + h.add_file(find_executable("gcc")); // Hash the systemtap size and mtime. We could use VERSION/DATE, // but when developing systemtap that doesn't work well (since you // can compile systemtap multiple times in 1 day). Since we don't // know exactly where we're getting run from, we'll use // /proc/self/exe. - if (stat("/proc/self/exe", &st) == 0) - { - h.add(st.st_size); - h.add(st.st_mtime); - } + h.add_file("/proc/self/exe"); } @@ -30,6 +30,7 @@ public: void add(const char *s) { add((const unsigned char *)s, strlen(s)); } void add(const std::string& s) { add((const unsigned char *)s.c_str(), s.length()); } + void add_file(const std::string& filename); void result(std::string& r); }; diff --git a/tapset/aux_syscalls.stp b/tapset/aux_syscalls.stp index 87ea4e04..009b0532 100644 --- a/tapset/aux_syscalls.stp +++ b/tapset/aux_syscalls.stp @@ -325,7 +325,8 @@ function _struct_sockaddr_u:string(uaddr:long, len:long) struct sockaddr_ll *sll = (struct sockaddr_ll *)buf; snprintf(str, strlen, "{AF_PACKET, proto=%d, ind=%d, hatype=%d, pkttype=%d, halen=%d, addr=0x%llx}", (int)sll->sll_protocol, sll->sll_ifindex, (int)sll->sll_hatype, (int)sll->sll_pkttype, - (int)sll->sll_halen, *(uint64_t *)sll->sll_addr); + (int)sll->sll_halen, + (long long)(*(uint64_t *)sll->sll_addr)); } else { @@ -267,4 +267,31 @@ const string cmdstr_quoted(const string& cmd) return quoted_cmd; } + +string +git_revision(const string& path) +{ + string revision = "(not-a-git-repository)"; + string git_dir = path + "/.git/"; + + struct stat st; + if (stat(git_dir.c_str(), &st) == 0) + { + string command = "git --git-dir=\"" + git_dir + + "\" rev-parse HEAD 2>/dev/null"; + + char buf[50]; + FILE *fp = popen(command.c_str(), "r"); + if (fp != NULL) + { + char *bufp = fgets(buf, sizeof(buf), fp); + int rc = pclose(fp); + if (bufp != NULL && rc == 0) + revision = buf; + } + } + + return revision; +} + /* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */ @@ -13,6 +13,7 @@ void tokenize(const std::string& str, std::vector<std::string>& tokens, const std::string& delimiters); std::string find_executable(const std::string& name); const std::string cmdstr_quoted(const std::string& cmd); +std::string git_revision(const std::string& path); // stringification generics |