Code

Added bts498183-segfault-madvise.
authorSebastian Harl <sh@tokkee.org>
Sat, 20 Sep 2008 19:12:39 +0000 (21:12 +0200)
committerSebastian Harl <sh@tokkee.org>
Sat, 20 Sep 2008 19:12:39 +0000 (21:12 +0200)
This fixes a segfault on sparc caused by a wrong argument passed to
madvise(2). Thanks to Jurij Smakov for valuable debugging information.

Closes: #498183
debian/changelog
debian/patches/bts498183-segfault-madvise [new file with mode: 0644]
debian/patches/series

index 8ad64ff90597e713ca995a5d3e547615f9c3e8d4..c808f3ff50bcc02224e88e54ca539c8cb1b4be1a 100644 (file)
@@ -3,8 +3,11 @@ rrdtool (1.3.1-4) unstable; urgency=low
   * debian/patches:
     - Added upstream patch bts499350-data-corruption to fix data corruption
       when updating multiple values in one go (Closes: #499350).
+    - Added bts498183-segfault-madvise to fix a segfault on sparc caused by a
+      wrong argument passed to madvise(2) - thanks to Jurij Smakov for
+      valuable debugging information (Closes: #498183).
 
- -- Sebastian Harl <sh@tokkee.org>  Sat, 20 Sep 2008 20:41:28 +0200
+ -- Sebastian Harl <sh@tokkee.org>  Sat, 20 Sep 2008 21:03:05 +0200
 
 rrdtool (1.3.1-3) unstable; urgency=low
 
diff --git a/debian/patches/bts498183-segfault-madvise b/debian/patches/bts498183-segfault-madvise
new file mode 100644 (file)
index 0000000..8d381ef
--- /dev/null
@@ -0,0 +1,27 @@
+diff a/src/rrd_open.c b/src/rrd_open.c
+--- a/src/rrd_open.c
++++ b/src/rrd_open.c
+@@ -363,14 +363,19 @@ void rrd_dontneed(
+             rrd->rra_def[i].row_cnt * rrd->stat_head->ds_cnt *
+             sizeof(rrd_value_t);
+     }
++
++    if (dontneed_start < rrd_file->file_len) {
+ #ifdef USE_MADVISE
+-    madvise(rrd_file->file_start + dontneed_start,
+-            rrd_file->file_len - dontneed_start, MADV_DONTNEED);
++          madvise(rrd_file->file_start + dontneed_start,
++                  rrd_file->file_len - dontneed_start, MADV_DONTNEED);
+ #endif
+ #ifdef HAVE_POSIX_FADVISE
+-    posix_fadvise(rrd_file->fd, dontneed_start,
+-                  rrd_file->file_len - dontneed_start, POSIX_FADV_DONTNEED);
++          posix_fadvise(rrd_file->fd, dontneed_start,
++                        rrd_file->file_len - dontneed_start,
++                        POSIX_FADV_DONTNEED);
+ #endif
++    }
++
+ #if defined DEBUG && DEBUG > 1
+     mincore_print(rrd_file, "after");
+ #endif
index a900298d1986ff063b94b9c8cf0facde178da40d..385c5ed2145eabf012412d5c1fc29f114d092440 100644 (file)
@@ -5,3 +5,4 @@ no-rpath-for-ruby
 no-rpath-for-perl
 implicit-decl-fix
 bts499350-data-corruption
+bts498183-segfault-madvise