Codebase list dmidecode / e1693fe
new patch 05-dmidecode-avoid-sigbus.patch Jörg Frings-Fürst 8 years ago
3 changed file(s) with 59 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
0 dmidecode (3.0-2) unstable; urgency=medium
1
2 * New debian/patches/05-dmidecode-avoid-sigbus.patch (Closes: #796963):
3 - Avoid SIGBUS on mmap failure
4
5 -- Jörg Frings-Fürst <debian@jff-webhosting.net> Thu, 01 Oct 2015 07:42:13 +0200
6
07 dmidecode (3.0-1) unstable; urgency=medium
18
29 * Correct typo at debian/changelog.
1623 * New debian/upstream/metadata:
1724 - Add some DEP-12 upstream metadata.
1825
19 -- Jörg Frings-Fürst <debian@jff-webhosting.net> Mon, 28 Sep 2015 14:38:46 +0200
26 -- Jörg Frings-Fürst <debian@jff-webhosting.net> Tue, 29 Sep 2015 05:42:43 +0200
2027
2128 dmidecode (2.12-4) unstable; urgency=low
2229
0 Description: Avoid SIGBUS on mmap failure
1 mmap will fail with SIGBUS if trying to map a non-existent portion of
2 a file. While this should never happen with /dev/mem, it can happen if
3 passing a regular file with option -d. While people should no longer
4 do that, failure gracefully seems better than crashing. So check for
5 the file size before calling mmap.
6 Author: Jean Delvare <jdelvare@suse.de>
7 Origin: https://savannah.nongnu.org/bugs/download.php?file_id=35008
8 Bug: https://savannah.nongnu.org/bugs/index.php?46066
9 Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=796963
10 Last-Update: 2015-10-01
11 ----
12 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
13 --- dmidecode.orig/util.c 2015-09-29 11:27:02.136566009 +0200
14 +++ dmidecode/util.c 2015-09-29 11:37:24.746191083 +0200
15 @@ -152,6 +152,7 @@ void *mem_chunk(off_t base, size_t len,
16 void *p;
17 int fd;
18 #ifdef USE_MMAP
19 + struct stat statbuf;
20 off_t mmoffset;
21 void *mmp;
22 #endif
23 @@ -169,6 +170,26 @@ void *mem_chunk(off_t base, size_t len,
24 }
25
26 #ifdef USE_MMAP
27 + if (fstat(fd, &statbuf) == -1)
28 + {
29 + fprintf(stderr, "%s: ", devmem);
30 + perror("stat");
31 + free(p);
32 + return NULL;
33 + }
34 +
35 + /*
36 + * mmap() will fail with SIGBUS if trying to map beyond the end of
37 + * the file.
38 + */
39 + if (S_ISREG(statbuf.st_mode) && base + (off_t)len > statbuf.st_size)
40 + {
41 + fprintf(stderr, "mmap: Can't map beyond end of file %s\n",
42 + devmem);
43 + free(p);
44 + return NULL;
45 + }
46 +
47 #ifdef _SC_PAGESIZE
48 mmoffset = base % sysconf(_SC_PAGESIZE);
49 #else
00 01-ansi-c.patch
11 02-hurd.patch
22 03-build.patch
3 05-dmidecode-avoid-sigbus.patch