Add recommended patches
Jörg Frings-Fürst
8 years ago
0 | dmidecode (3.0-3) UNRELEASED; urgency=medium | |
1 | ||
2 | * Rename patches. | |
3 | * Add recommended patches from upstream: | |
4 | - 0110-nosysfs.patch | |
5 | - 0115-no_smbios_DMI_entry_point.patch | |
6 | - 0120-return_actual_data_size.patch | |
7 | - 0125-use_read_file_to_read_DMI_table_from_sysfs.patch | |
8 | - 0130-use_DWORD_for_table_max_size.patch | |
9 | - 0135-hide_fixup_msg.patch | |
10 | ||
11 | -- Jörg Frings-Fürst <debian@jff-webhosting.net> Sun, 15 May 2016 13:33:37 +0200 | |
12 | ||
0 | 13 | dmidecode (3.0-2) unstable; urgency=medium |
1 | 14 | |
2 | 15 | * New debian/patches/05-dmidecode-avoid-sigbus.patch (Closes: #796963): |
2 | 2 | Priority: optional |
3 | 3 | Maintainer: Jörg Frings-Fürst <debian@jff-webhosting.net> |
4 | 4 | Build-Depends: debhelper (>= 9) |
5 | Standards-Version: 3.9.6 | |
5 | Standards-Version: 3.9.7 | |
6 | 6 | Vcs-Browser: http://anonscm.debian.org/cgit/collab-maint/dmidecode.git |
7 | 7 | Vcs-Git: git://anonscm.debian.org/collab-maint/dmidecode.git |
8 | 8 | Homepage: http://dmidecode.nongnu.org/ |
0 | Author: Svante Signell <svante.signell@telia.com> | |
1 | Description: Enable build of all targets on GNU/Hurd (Closes: #643649). | |
2 | ||
3 | Index: trunk/Makefile | |
4 | =================================================================== | |
5 | --- trunk.orig/Makefile | |
6 | +++ trunk/Makefile | |
7 | @@ -43,7 +43,7 @@ INSTALL_PROGRAM := $(INSTALL) -m 755 | |
8 | RM := rm -f | |
9 | ||
10 | # BSD make provides $MACHINE, but GNU make doesn't | |
11 | -MACHINE ?= $(shell uname -m 2>/dev/null) | |
12 | +MACHINE ?= $(shell uname -m 2>/dev/null | cut - -d- -f 1) | |
13 | ||
14 | # These programs are only useful on x86 | |
15 | PROGRAMS-i386 := biosdecode ownership vpddecode |
0 | Author: Daniel Baumann <daniel.baumann@progress-technologies.net> | |
1 | Description: Avoid overwriting build environment rather than to just extend it. | |
2 | ||
3 | Index: trunk/Makefile | |
4 | =================================================================== | |
5 | --- trunk.orig/Makefile | |
6 | +++ trunk/Makefile | |
7 | @@ -13,7 +13,7 @@ | |
8 | # | |
9 | ||
10 | CC = gcc | |
11 | -CFLAGS = -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \ | |
12 | +CFLAGS += -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \ | |
13 | -Wcast-align -Wwrite-strings -Wmissing-prototypes -Winline -Wundef | |
14 | ||
15 | # Let lseek and mmap support 64-bit wide offsets | |
16 | @@ -27,7 +27,7 @@ CFLAGS += -O2 | |
17 | #CFLAGS += -g | |
18 | ||
19 | # Pass linker flags here | |
20 | -LDFLAGS = | |
21 | +#LDFLAGS = | |
22 | ||
23 | DESTDIR = | |
24 | prefix = /usr/local |
0 | Author: Petter Reinholdtsen <pere@hungry.com> | |
1 | Description: | |
2 | Make sure the code compiles when using -ansi. Renames non-ANSI C 'inline' to | |
3 | '__inline'. | |
4 | ||
5 | diff -Naurp dmidecode.orig/types.h dmidecode/types.h | |
6 | --- dmidecode.orig/types.h 2011-09-27 17:09:22.211059414 +0200 | |
7 | +++ dmidecode/types.h 2011-09-27 17:21:35.362694344 +0200 | |
8 | @@ -32,7 +32,7 @@ typedef struct { | |
9 | #endif | |
10 | ||
11 | #ifdef ALIGNMENT_WORKAROUND | |
12 | -static inline u64 U64(u32 low, u32 high) | |
13 | +static __inline u64 U64(u32 low, u32 high) | |
14 | { | |
15 | u64 self; | |
16 |
0 | Author: Petter Reinholdtsen <pere@hungry.com> | |
1 | Description: | |
2 | Make sure the code compiles when using -ansi. Renames non-ANSI C 'inline' to | |
3 | '__inline'. | |
4 | ||
5 | diff -Naurp dmidecode.orig/types.h dmidecode/types.h | |
6 | --- dmidecode.orig/types.h 2011-09-27 17:09:22.211059414 +0200 | |
7 | +++ dmidecode/types.h 2011-09-27 17:21:35.362694344 +0200 | |
8 | @@ -32,7 +32,7 @@ typedef struct { | |
9 | #endif | |
10 | ||
11 | #ifdef ALIGNMENT_WORKAROUND | |
12 | -static inline u64 U64(u32 low, u32 high) | |
13 | +static __inline u64 U64(u32 low, u32 high) | |
14 | { | |
15 | u64 self; | |
16 |
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 |
0 | From 33b5aafc6ee6b5de9f2526fb1cf4b14d1e16e4f0 Mon Sep 17 00:00:00 2001 | |
1 | From: Roy Franz <roy.franz@linaro.org> | |
2 | Date: Thu, 01 Oct 2015 06:41:43 +0000 | |
3 | Subject: Add "--no-sysfs" option description to -h output | |
4 | ||
5 | A description of --no-sysfs was not added to the output of "-h" when | |
6 | the feature was added, so add it now. | |
7 | --- | |
8 | Index: trunk/CHANGELOG | |
9 | =================================================================== | |
10 | --- trunk.orig/CHANGELOG | |
11 | +++ trunk/CHANGELOG | |
12 | @@ -1,3 +1,7 @@ | |
13 | +2015-10-01 Roy Franz <roy.franz@linaro.org> | |
14 | + | |
15 | + * dmiopt.c: Add "--no-sysfs" option description to -h output. | |
16 | + | |
17 | 2015-09-03 Jean Delvare <jdelvare@suse.de> | |
18 | ||
19 | * version.h: Set version to 3.0. | |
20 | Index: trunk/dmiopt.c | |
21 | =================================================================== | |
22 | --- trunk.orig/dmiopt.c | |
23 | +++ trunk/dmiopt.c | |
24 | @@ -314,6 +314,7 @@ void print_help(void) | |
25 | " -u, --dump Do not decode the entries\n" | |
26 | " --dump-bin FILE Dump the DMI data to a binary file\n" | |
27 | " --from-dump FILE Read the DMI data from a binary file\n" | |
28 | + " --no-sysfs Do not attempt to read DMI data from sysfs files\n" | |
29 | " -V, --version Display the version and exit\n"; | |
30 | ||
31 | printf("%s", help); |
0 | From bf7bad24ce141dab5b5acc3ffb98ce5fe4a8e0f9 Mon Sep 17 00:00:00 2001 | |
1 | From: Xie XiuQi <xiexiuqi@huawei.com> | |
2 | Date: Wed, 21 Oct 2015 13:12:50 +0000 | |
3 | Subject: Fix 'No SMBIOS nor DMI entry point found' on SMBIOS3 | |
4 | ||
5 | address_from_efi may return a SMBIOS or SMBIOS3 format entry | |
6 | point, so add this condition. | |
7 | --- | |
8 | Index: trunk/AUTHORS | |
9 | =================================================================== | |
10 | --- trunk.orig/AUTHORS | |
11 | +++ trunk/AUTHORS | |
12 | @@ -19,6 +19,7 @@ Jarod Wilson <jarod@redhat.com> | |
13 | Anton Arapov <anton@redhat.com> | |
14 | Roy Franz <roy.franz@linaro.org> | |
15 | Tyler Bell <tyler.bell@hp.com> | |
16 | +Xie XiuQi <xiexiuqi@huawei.com> | |
17 | ||
18 | MANY THANKS TO (IN CHRONOLOGICAL ORDER) | |
19 | Werner Heuser | |
20 | Index: trunk/CHANGELOG | |
21 | =================================================================== | |
22 | --- trunk.orig/CHANGELOG | |
23 | +++ trunk/CHANGELOG | |
24 | @@ -1,3 +1,7 @@ | |
25 | +2015-10-21 Xie XiuQi <xiexiuqi@huawei.com> | |
26 | + | |
27 | + * dmidecode.c: Handle SMBIOS 3.0 entry points on EFI systems. | |
28 | + | |
29 | 2015-10-01 Roy Franz <roy.franz@linaro.org> | |
30 | ||
31 | * dmiopt.c: Add "--no-sysfs" option description to -h output. | |
32 | Index: trunk/dmidecode.c | |
33 | =================================================================== | |
34 | --- trunk.orig/dmidecode.c | |
35 | +++ trunk/dmidecode.c | |
36 | @@ -4864,8 +4864,16 @@ int main(int argc, char * const argv[]) | |
37 | goto exit_free; | |
38 | } | |
39 | ||
40 | - if (smbios_decode(buf, opt.devmem, 0)) | |
41 | - found++; | |
42 | + if (memcmp(buf, "_SM3_", 5) == 0) | |
43 | + { | |
44 | + if (smbios3_decode(buf, opt.devmem, 0)) | |
45 | + found++; | |
46 | + } | |
47 | + else if (memcmp(buf, "_SM_", 4) == 0) | |
48 | + { | |
49 | + if (smbios_decode(buf, opt.devmem, 0)) | |
50 | + found++; | |
51 | + } | |
52 | goto done; | |
53 | ||
54 | memory_scan: |
0 | From de9a74e1c60210bee229fcf55b1678a99d1b44dd Mon Sep 17 00:00:00 2001 | |
1 | From: Jean Delvare <jdelvare@suse.de> | |
2 | Date: Mon, 02 Nov 2015 08:45:26 +0000 | |
3 | Subject: Let read_file return the actual data size | |
4 | ||
5 | Let read_file return the actual data size to the caller. This gives | |
6 | the caller the possibility to check that the data size is as expected | |
7 | and large enough for the purpose, and report to the user if not. | |
8 | --- | |
9 | Index: trunk/CHANGELOG | |
10 | =================================================================== | |
11 | --- trunk.orig/CHANGELOG | |
12 | +++ trunk/CHANGELOG | |
13 | @@ -1,3 +1,8 @@ | |
14 | +2015-11-02 Jean Delvare <jdelvare@suse.de> | |
15 | + | |
16 | + * dmidecode.c, util.c, util.h: Let read_file return the actual data | |
17 | + size. | |
18 | + | |
19 | 2015-10-21 Xie XiuQi <xiexiuqi@huawei.com> | |
20 | ||
21 | * dmidecode.c: Handle SMBIOS 3.0 entry points on EFI systems. | |
22 | Index: trunk/dmidecode.c | |
23 | =================================================================== | |
24 | --- trunk.orig/dmidecode.c | |
25 | +++ trunk/dmidecode.c | |
26 | @@ -4748,6 +4748,7 @@ int main(int argc, char * const argv[]) | |
27 | int ret = 0; /* Returned value */ | |
28 | int found = 0; | |
29 | off_t fp; | |
30 | + size_t size; | |
31 | int efi; | |
32 | u8 *buf; | |
33 | ||
34 | @@ -4817,8 +4818,9 @@ int main(int argc, char * const argv[]) | |
35 | * contain one of several types of entry points, so read enough for | |
36 | * the largest one, then determine what type it contains. | |
37 | */ | |
38 | + size = 0x20; | |
39 | if (!(opt.flags & FLAG_NO_SYSFS) | |
40 | - && (buf = read_file(0x20, SYS_ENTRY_FILE)) != NULL) | |
41 | + && (buf = read_file(&size, SYS_ENTRY_FILE)) != NULL) | |
42 | { | |
43 | if (!(opt.flags & FLAG_QUIET)) | |
44 | printf("Getting SMBIOS data from sysfs.\n"); | |
45 | Index: trunk/util.c | |
46 | =================================================================== | |
47 | --- trunk.orig/util.c | |
48 | +++ trunk/util.c | |
49 | @@ -94,10 +94,11 @@ int checksum(const u8 *buf, size_t len) | |
50 | * needs to be freed by the caller. | |
51 | * This provides a similar usage model to mem_chunk() | |
52 | * | |
53 | - * Returns pointer to buffer of max_len bytes, or NULL on error | |
54 | + * Returns pointer to buffer of max_len bytes, or NULL on error, and | |
55 | + * sets max_len to the length actually read. | |
56 | * | |
57 | */ | |
58 | -void *read_file(size_t max_len, const char *filename) | |
59 | +void *read_file(size_t *max_len, const char *filename) | |
60 | { | |
61 | int fd; | |
62 | size_t r2 = 0; | |
63 | @@ -115,7 +116,7 @@ void *read_file(size_t max_len, const ch | |
64 | return(NULL); | |
65 | } | |
66 | ||
67 | - if ((p = malloc(max_len)) == NULL) | |
68 | + if ((p = malloc(*max_len)) == NULL) | |
69 | { | |
70 | perror("malloc"); | |
71 | return NULL; | |
72 | @@ -123,7 +124,7 @@ void *read_file(size_t max_len, const ch | |
73 | ||
74 | do | |
75 | { | |
76 | - r = read(fd, p + r2, max_len - r2); | |
77 | + r = read(fd, p + r2, *max_len - r2); | |
78 | if (r == -1) | |
79 | { | |
80 | if (errno != EINTR) | |
81 | @@ -140,6 +141,8 @@ void *read_file(size_t max_len, const ch | |
82 | while (r != 0); | |
83 | ||
84 | close(fd); | |
85 | + *max_len = r2; | |
86 | + | |
87 | return p; | |
88 | } | |
89 | ||
90 | Index: trunk/util.h | |
91 | =================================================================== | |
92 | --- trunk.orig/util.h | |
93 | +++ trunk/util.h | |
94 | @@ -25,7 +25,7 @@ | |
95 | #define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0])) | |
96 | ||
97 | int checksum(const u8 *buf, size_t len); | |
98 | -void *read_file(size_t len, const char *filename); | |
99 | +void *read_file(size_t *len, const char *filename); | |
100 | void *mem_chunk(off_t base, size_t len, const char *devmem); | |
101 | int write_dump(size_t base, size_t len, const void *data, const char *dumpfile, int add); | |
102 | u64 u64_range(u64 start, u64 end); |
0 | From 364055211b1956539c6a6268e111e244e1292c8c Mon Sep 17 00:00:00 2001 | |
1 | From: Jean Delvare <jdelvare@suse.de> | |
2 | Date: Mon, 02 Nov 2015 08:45:31 +0000 | |
3 | Subject: dmidecode: Use read_file() to read the DMI table from sysfs | |
4 | ||
5 | We shouldn't use mem_chunk() to read the DMI table from sysfs. This | |
6 | will fail for SMBIOS v3 implementations which specify a maximum length | |
7 | for the table rather than its exact length. The kernel will trim the | |
8 | table to the actual length, so the DMI file will be shorter than the | |
9 | length announced in entry point. | |
10 | ||
11 | read_file() fits the bill in this case, as it deals with end of file | |
12 | nicely. | |
13 | ||
14 | This also helps with corrupted DMI tables, as the kernel will not | |
15 | export the part of the table that it wasn't able to parse, effectively | |
16 | trimming it. | |
17 | ||
18 | This fixes bug #46176: | |
19 | https://savannah.nongnu.org/bugs/?46176 | |
20 | Unexpected end of file error | |
21 | --- | |
22 | Index: trunk/CHANGELOG | |
23 | =================================================================== | |
24 | --- trunk.orig/CHANGELOG | |
25 | +++ trunk/CHANGELOG | |
26 | @@ -2,6 +2,9 @@ | |
27 | ||
28 | * dmidecode.c, util.c, util.h: Let read_file return the actual data | |
29 | size. | |
30 | + * dmidecode.c: Use read_file to read the DMI table from sysfs. | |
31 | + This fixes Savannah bug #46176: | |
32 | + https://savannah.nongnu.org/bugs/?46176 | |
33 | ||
34 | 2015-10-21 Xie XiuQi <xiexiuqi@huawei.com> | |
35 | ||
36 | Index: trunk/dmidecode.c | |
37 | =================================================================== | |
38 | --- trunk.orig/dmidecode.c | |
39 | +++ trunk/dmidecode.c | |
40 | @@ -4521,16 +4521,29 @@ static void dmi_table(off_t base, u32 le | |
41 | printf("\n"); | |
42 | } | |
43 | ||
44 | - /* | |
45 | - * When we are reading the DMI table from sysfs, we want to print | |
46 | - * the address of the table (done above), but the offset of the | |
47 | - * data in the file is 0. When reading from /dev/mem, the offset | |
48 | - * in the file is the address. | |
49 | - */ | |
50 | if (flags & FLAG_NO_FILE_OFFSET) | |
51 | - base = 0; | |
52 | + { | |
53 | + /* | |
54 | + * When reading from sysfs, the file may be shorter than | |
55 | + * announced. For SMBIOS v3 this is expcted, as we only know | |
56 | + * the maximum table size, not the actual table size. For older | |
57 | + * implementations (and for SMBIOS v3 too), this would be the | |
58 | + * result of the kernel truncating the table on parse error. | |
59 | + */ | |
60 | + size_t size = len; | |
61 | + buf = read_file(&size, devmem); | |
62 | + if (!(opt.flags & FLAG_QUIET) && num && size != (size_t)len) | |
63 | + { | |
64 | + printf("Wrong DMI structures length: %u bytes " | |
65 | + "announced, only %lu bytes available.\n", | |
66 | + len, (unsigned long)size); | |
67 | + } | |
68 | + len = size; | |
69 | + } | |
70 | + else | |
71 | + buf = mem_chunk(base, len, devmem); | |
72 | ||
73 | - if ((buf = mem_chunk(base, len, devmem)) == NULL) | |
74 | + if (buf == NULL) | |
75 | { | |
76 | fprintf(stderr, "Table is unreachable, sorry." | |
77 | #ifndef USE_MMAP |
0 | From ab02b117511230e46bbef7febbd854b9c832c13c Mon Sep 17 00:00:00 2001 | |
1 | From: Xie XiuQi <xiexiuqi@huawei.com> | |
2 | Date: Mon, 01 Feb 2016 08:30:31 +0000 | |
3 | Subject: Use DWORD for Structure table maximum size in SMBIOS3 | |
4 | ||
5 | 0Ch DWORD "Structure table maximum size" | |
6 | ||
7 | Maximum size of SMBIOS Structure Table, pointed to by | |
8 | the Structure Table Address, in bytes. The actual size is | |
9 | guaranteed to be less or equal to the maximum size. | |
10 | ||
11 | Signed-off-by: Xie XiuQi <xiexiuqi@huawei.com> | |
12 | Signed-off-by: Jean Delvare <jdelvare@suse.de> | |
13 | --- | |
14 | Index: trunk/dmidecode.c | |
15 | =================================================================== | |
16 | --- trunk.orig/dmidecode.c | |
17 | +++ trunk/dmidecode.c | |
18 | @@ -4612,7 +4612,7 @@ static int smbios3_decode(u8 *buf, const | |
19 | } | |
20 | ||
21 | dmi_table(((off_t)offset.h << 32) | offset.l, | |
22 | - WORD(buf + 0x0C), 0, ver, devmem, flags | FLAG_STOP_AT_EOT); | |
23 | + DWORD(buf + 0x0C), 0, ver, devmem, flags | FLAG_STOP_AT_EOT); | |
24 | ||
25 | if (opt.flags & FLAG_DUMP_BIN) | |
26 | { |
0 | From cff11afa886a0147d734b650755d232b5e7f2099 Mon Sep 17 00:00:00 2001 | |
1 | From: Jean Delvare <jdelvare@suse.de> | |
2 | Date: Tue, 03 May 2016 13:32:21 +0000 | |
3 | Subject: dmidecode: Hide irrelevant fixup message | |
4 | ||
5 | Only display the message about type 34 length fixup if the entry in | |
6 | question is going to be displayed. Otherwise it's only confusing. | |
7 | ||
8 | This fixes bug #109024: | |
9 | http://savannah.nongnu.org/support/?109024 | |
10 | ||
11 | Fixes: 3f70b3515d91 ("dmidecode: Fix up invalid DMI type 34 structure length") | |
12 | --- | |
13 | Index: trunk/dmidecode.c | |
14 | =================================================================== | |
15 | --- trunk.orig/dmidecode.c | |
16 | +++ trunk/dmidecode.c | |
17 | @@ -2946,7 +2946,7 @@ static void dmi_64bit_memory_error_addre | |
18 | * first 5 characters of the device name to be trimmed. It's easy to | |
19 | * check and fix, so do it, but warn. | |
20 | */ | |
21 | -static void dmi_fixup_type_34(struct dmi_header *h) | |
22 | +static void dmi_fixup_type_34(struct dmi_header *h, int display) | |
23 | { | |
24 | u8 *p = h->data; | |
25 | ||
26 | @@ -2954,7 +2954,9 @@ static void dmi_fixup_type_34(struct dmi | |
27 | if (h->length == 0x10 | |
28 | && is_printable(p + 0x0B, 0x10 - 0x0B)) | |
29 | { | |
30 | - printf("Invalid entry length (%u). Fixed up to %u.\n", 0x10, 0x0B); | |
31 | + if (!(opt.flags & FLAG_QUIET) && display) | |
32 | + printf("Invalid entry length (%u). Fixed up to %u.\n", | |
33 | + 0x10, 0x0B); | |
34 | h->length = 0x0B; | |
35 | } | |
36 | } | |
37 | @@ -4443,7 +4445,7 @@ static void dmi_table_decode(u8 *buf, u3 | |
38 | ||
39 | /* Fixup a common mistake */ | |
40 | if (h.type == 34) | |
41 | - dmi_fixup_type_34(&h); | |
42 | + dmi_fixup_type_34(&h, display); | |
43 | ||
44 | /* look for the next handle */ | |
45 | next = data + h.length; |
0 | Author: Svante Signell <svante.signell@telia.com> | |
1 | Description: Enable build of all targets on GNU/Hurd (Closes: #643649). | |
2 | ||
3 | Index: trunk/Makefile | |
4 | =================================================================== | |
5 | --- trunk.orig/Makefile | |
6 | +++ trunk/Makefile | |
7 | @@ -43,7 +43,7 @@ INSTALL_PROGRAM := $(INSTALL) -m 755 | |
8 | RM := rm -f | |
9 | ||
10 | # BSD make provides $MACHINE, but GNU make doesn't | |
11 | -MACHINE ?= $(shell uname -m 2>/dev/null) | |
12 | +MACHINE ?= $(shell uname -m 2>/dev/null | cut - -d- -f 1) | |
13 | ||
14 | # These programs are only useful on x86 | |
15 | PROGRAMS-i386 := biosdecode ownership vpddecode |
0 | Author: Daniel Baumann <daniel.baumann@progress-technologies.net> | |
1 | Description: Avoid overwriting build environment rather than to just extend it. | |
2 | ||
3 | Index: trunk/Makefile | |
4 | =================================================================== | |
5 | --- trunk.orig/Makefile | |
6 | +++ trunk/Makefile | |
7 | @@ -13,7 +13,7 @@ | |
8 | # | |
9 | ||
10 | CC = gcc | |
11 | -CFLAGS = -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \ | |
12 | +CFLAGS += -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \ | |
13 | -Wcast-align -Wwrite-strings -Wmissing-prototypes -Winline -Wundef | |
14 | ||
15 | # Let lseek and mmap support 64-bit wide offsets | |
16 | @@ -27,7 +27,7 @@ CFLAGS += -O2 | |
17 | #CFLAGS += -g | |
18 | ||
19 | # Pass linker flags here | |
20 | -LDFLAGS = | |
21 | +#LDFLAGS = | |
22 | ||
23 | DESTDIR = | |
24 | prefix = /usr/local |
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 |
0 | 01-ansi-c.patch | |
1 | 02-hurd.patch | |
2 | 03-build.patch | |
3 | 05-dmidecode-avoid-sigbus.patch | |
0 | 0100-ansi-c.patch | |
1 | 0001-hurd.patch | |
2 | 0005-build.patch | |
3 | 0105-dmidecode-avoid-sigbus.patch | |
4 | 0110-nosysfs.patch | |
5 | 0115-no_smbios_DMI_entry_point.patch | |
6 | 0120-return_actual_data_size.patch | |
7 | 0125-use_read_file_to_read_DMI_table_from_sysfs.patch | |
8 | 0130-use_DWORD_for_table_max_size.patch | |
9 | 0135-hide_fixup_msg.patch |