From 387a7a57e1dd8f07db10ada3f4c3010c96607bfa Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 25 Mar 2009 17:17:07 +0100 Subject: NEWS: Mention disable-pie, sdt.h compat, syscall wrappers and CVE-2009-0784. --- NEWS | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/NEWS b/NEWS index 4dae77d7..ed4572d4 100644 --- a/NEWS +++ b/NEWS @@ -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 -- cgit From 121e57ae36e2030093f72723b1fb74dc0507ddab Mon Sep 17 00:00:00 2001 From: William Cohen Date: Wed, 25 Mar 2009 18:26:01 -0400 Subject: Make aux_tapset.stp "long long" size agnostic so ia64 works. --- tapset/aux_syscalls.stp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 { -- cgit From 2a8c27f6bfdf2e7962def6fc8729ebb5fb54c701 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 25 Mar 2009 15:47:21 -0700 Subject: Add more file stats to the hash For kernel developers, it may be common practice to reuse the same kernel build tree for several kernel variants. Our previous hashing only considered the release version, architecture, and build path, which may all remain constant for such a developer. This change adds the file size and mtime of several kernel version files to the hash, so it should be a bit more robust against collisions. --- hash.cxx | 38 ++++++++++++++++++++++++-------------- hash.h | 1 + 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/hash.cxx b/hash.cxx index b8d5a0e4..c9121641 100644 --- a/hash.cxx +++ b/hash.cxx @@ -47,6 +47,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) { @@ -68,37 +82,33 @@ 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"); + // 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"); } diff --git a/hash.h b/hash.h index 0fe95e27..bb3d5ae1 100644 --- a/hash.h +++ b/hash.h @@ -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); }; -- cgit From a5e8d632f443c6a882dcabc669236dc4798b1fd7 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 25 Mar 2009 17:25:06 -0700 Subject: Add the kernel tree's git revision to the hash To better support kernel developers who work out of a single source tree, this adds the git HEAD revision to our caching hash. --- hash.cxx | 4 ++++ util.cxx | 27 +++++++++++++++++++++++++++ util.h | 1 + 3 files changed, 32 insertions(+) diff --git a/hash.cxx b/hash.cxx index c9121641..649e7ec0 100644 --- a/hash.cxx +++ b/hash.cxx @@ -95,6 +95,10 @@ get_base_hash (systemtap_session& s, hash& 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); diff --git a/util.cxx b/util.cxx index 7d191cd2..68cc27f7 100644 --- a/util.cxx +++ b/util.cxx @@ -248,4 +248,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 : */ diff --git a/util.h b/util.h index 2884e021..d385be02 100644 --- a/util.h +++ b/util.h @@ -12,6 +12,7 @@ void tokenize(const std::string& str, std::vector& 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 -- cgit