Accumulated z-stream and y-stream patches.
This commit is contained in:
parent
4ba43e4868
commit
733266e0f4
122
SIGILL-catcher.patch
Normal file
122
SIGILL-catcher.patch
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
diff --git a/src/util.c b/src/util.c
|
||||||
|
index 2eebf30..4d1be64 100644
|
||||||
|
--- a/src/util.c
|
||||||
|
+++ b/src/util.c
|
||||||
|
@@ -44,6 +44,7 @@
|
||||||
|
#include <string.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
|
+#include <signal.h>
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
|
#include "util.h"
|
||||||
|
@@ -87,6 +88,23 @@ int checksum(const u8 * buf, size_t len)
|
||||||
|
return (sum == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* Static global variables which should only
|
||||||
|
+ * be used by the sigill_handler()
|
||||||
|
+ */
|
||||||
|
+static int sigill_error = 0;
|
||||||
|
+static Log_t *sigill_logobj = NULL;
|
||||||
|
+
|
||||||
|
+void sigill_handler(int ignore_this) {
|
||||||
|
+ sigill_error = 1;
|
||||||
|
+ if( sigill_logobj ) {
|
||||||
|
+ log_append(sigill_logobj, LOGFL_NODUPS, LOG_WARNING,
|
||||||
|
+ "SIGILL signal caught in mem_chunk()");
|
||||||
|
+ } else {
|
||||||
|
+ fprintf(stderr,
|
||||||
|
+ "** WARNING ** SIGILL signal caught in mem_chunk()\n");
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* Copy a physical memory chunk into a memory buffer.
|
||||||
|
* This function allocates memory.
|
||||||
|
@@ -100,15 +118,20 @@ void *mem_chunk(Log_t *logp, size_t base, size_t len, const char *devmem)
|
||||||
|
size_t mmoffset;
|
||||||
|
void *mmp;
|
||||||
|
#endif
|
||||||
|
-
|
||||||
|
- if((fd = open(devmem, O_RDONLY)) == -1) {
|
||||||
|
- log_append(logp, LOGFL_NORMAL, LOG_WARNING, "%s: %s", devmem, strerror(errno));
|
||||||
|
- return NULL;
|
||||||
|
+ sigill_logobj = logp;
|
||||||
|
+ signal(SIGILL, sigill_handler);
|
||||||
|
+ if(sigill_error || (fd = open(devmem, O_RDONLY)) == -1) {
|
||||||
|
+ log_append(logp, LOGFL_NORMAL, LOG_WARNING,
|
||||||
|
+ "Failed to open memory buffer (%s): %s",
|
||||||
|
+ devmem, strerror(errno));
|
||||||
|
+ p = NULL;
|
||||||
|
+ goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if((p = malloc(len)) == NULL) {
|
||||||
|
- log_append(logp, LOGFL_NORMAL, LOG_WARNING, "malloc: %s", strerror(errno));
|
||||||
|
- return NULL;
|
||||||
|
+ if(sigill_error || (p = malloc(len)) == NULL) {
|
||||||
|
+ log_append(logp, LOGFL_NORMAL, LOG_WARNING,"malloc: %s", strerror(errno));
|
||||||
|
+ p = NULL;
|
||||||
|
+ goto exit;
|
||||||
|
}
|
||||||
|
#ifdef USE_MMAP
|
||||||
|
#ifdef _SC_PAGESIZE
|
||||||
|
@@ -122,33 +145,49 @@ void *mem_chunk(Log_t *logp, size_t base, size_t len, const char *devmem)
|
||||||
|
* to read from /dev/mem using regular read() calls.
|
||||||
|
*/
|
||||||
|
mmp = mmap(0, mmoffset + len, PROT_READ, MAP_SHARED, fd, base - mmoffset);
|
||||||
|
- if(mmp == MAP_FAILED) {
|
||||||
|
+ if(sigill_error || (mmp == MAP_FAILED)) {
|
||||||
|
log_append(logp, LOGFL_NORMAL, LOG_WARNING, "%s (mmap): %s", devmem, strerror(errno));
|
||||||
|
free(p);
|
||||||
|
- return NULL;
|
||||||
|
+ p = NULL;
|
||||||
|
+ goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(p, (u8 *) mmp + mmoffset, len);
|
||||||
|
-
|
||||||
|
- if(munmap(mmp, mmoffset + len) == -1) {
|
||||||
|
+ if (sigill_error) {
|
||||||
|
+ log_append(logp, LOGFL_NODUPS, LOG_WARNING,
|
||||||
|
+ "Failed to do memcpy() due to SIGILL signal");
|
||||||
|
+ free(p);
|
||||||
|
+ p = NULL;
|
||||||
|
+ goto exit;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if(sigill_error || (munmap(mmp, mmoffset + len) == -1)) {
|
||||||
|
log_append(logp, LOGFL_NORMAL, LOG_WARNING, "%s (munmap): %s", devmem, strerror(errno));
|
||||||
|
+ free(p);
|
||||||
|
+ p = NULL;
|
||||||
|
+ goto exit;
|
||||||
|
}
|
||||||
|
#else /* USE_MMAP */
|
||||||
|
- if(lseek(fd, base, SEEK_SET) == -1) {
|
||||||
|
+ if(sigill_error || (lseek(fd, base, SEEK_SET) == -1)) {
|
||||||
|
log_append(logp, LOGFL_NORMAL, LOG_WARNING, "%s (lseek): %s", devmem, strerror(errno));
|
||||||
|
free(p);
|
||||||
|
- return NULL;
|
||||||
|
+ p = NULL;
|
||||||
|
+ goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if(myread(logp, fd, p, len, devmem) == -1) {
|
||||||
|
+ if(sigill_error || (myread(logp, fd, p, len, devmem) == -1)) {
|
||||||
|
free(p);
|
||||||
|
- return NULL;
|
||||||
|
+ p = NULL;
|
||||||
|
+ goto exit;
|
||||||
|
}
|
||||||
|
#endif /* USE_MMAP */
|
||||||
|
|
||||||
|
if(close(fd) == -1)
|
||||||
|
perror(devmem);
|
||||||
|
|
||||||
|
+ exit:
|
||||||
|
+ signal(SIGILL, SIG_DFL);
|
||||||
|
+ sigill_logobj = NULL;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
39
dmispec-remove.patch
Normal file
39
dmispec-remove.patch
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
From 39869fb9346cd46097bd6d70a90f351938d30296 Mon Sep 17 00:00:00 2001
|
||||||
|
From: David Sommerseth <davids@redhat.com>
|
||||||
|
Date: Fri, 5 Apr 2013 18:25:23 +0200
|
||||||
|
Subject: [PATCH 1/2] Do not add explictly 'dmispec' attributes inside
|
||||||
|
switch() in dmi_decode()
|
||||||
|
|
||||||
|
The dmispec attribute is added outside the switch() call, and must not be
|
||||||
|
duplicated. If this happens, an invalid XML file will be generated.
|
||||||
|
(Un)fortunately, libxml2 is quite forgiving to this error. But xmllint
|
||||||
|
will complain about it and other XML libraries (such as python-lxml)
|
||||||
|
may reject such XML data.
|
||||||
|
|
||||||
|
Signed-off-by: David Sommerseth <davids@redhat.com>
|
||||||
|
---
|
||||||
|
src/dmidecode.c | 2 --
|
||||||
|
1 file changed, 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/dmidecode.c b/src/dmidecode.c
|
||||||
|
index 17f2130..215c3f4 100644
|
||||||
|
--- a/src/dmidecode.c
|
||||||
|
+++ b/src/dmidecode.c
|
||||||
|
@@ -4784,7 +4784,6 @@ xmlNode *dmi_decode(xmlNode *prnt_n, dmi_codes_major *dmiMajor, struct dmi_heade
|
||||||
|
|
||||||
|
case 40: /* 3.3.41 Additional Information */
|
||||||
|
dmixml_AddAttribute(sect_n, "subtype", "AdditionalInformation");
|
||||||
|
- dmixml_AddAttribute(sect_n, "dmispec", "3.3.41");
|
||||||
|
|
||||||
|
if(h->length < 0x0B) {
|
||||||
|
break;
|
||||||
|
@@ -4795,7 +4794,6 @@ xmlNode *dmi_decode(xmlNode *prnt_n, dmi_codes_major *dmiMajor, struct dmi_heade
|
||||||
|
|
||||||
|
case 41: /* 3.3.42 Onboard Device Extended Information */
|
||||||
|
dmixml_AddAttribute(sect_n, "subtype", "OnboardDeviceExtendedInformation");
|
||||||
|
- dmixml_AddAttribute(sect_n, "dmispec", "3.3.42");
|
||||||
|
|
||||||
|
if(h->length < 0x0B) {
|
||||||
|
break;
|
||||||
|
--
|
||||||
|
1.7.10.2
|
@ -4,7 +4,7 @@
|
|||||||
Summary: Python module to access DMI data
|
Summary: Python module to access DMI data
|
||||||
Name: python-dmidecode
|
Name: python-dmidecode
|
||||||
Version: 3.10.13
|
Version: 3.10.13
|
||||||
Release: 7%{?dist}
|
Release: 8%{?dist}
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
URL: http://projects.autonomy.net.au/python-dmidecode/
|
URL: http://projects.autonomy.net.au/python-dmidecode/
|
||||||
@ -16,6 +16,11 @@ BuildRequires: libxml2-python
|
|||||||
BuildRequires: libxml2-devel
|
BuildRequires: libxml2-devel
|
||||||
BuildRequires: python-devel
|
BuildRequires: python-devel
|
||||||
|
|
||||||
|
# already in restored upstream git
|
||||||
|
Patch1: SIGILL-catcher.patch
|
||||||
|
# email upstream why not in git
|
||||||
|
Patch2: dmispec-remove.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
python-dmidecode is a python extension module that uses the
|
python-dmidecode is a python extension module that uses the
|
||||||
code-base of the 'dmidecode' utility, and presents the data
|
code-base of the 'dmidecode' utility, and presents the data
|
||||||
@ -23,6 +28,8 @@ as python data structures or as XML data using libxml2.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
%patch1 -p1 -b .SIGILL-catcher
|
||||||
|
%patch2 -p1 -b .dmispec-remove
|
||||||
|
|
||||||
%build
|
%build
|
||||||
make build
|
make build
|
||||||
@ -50,6 +57,10 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%{_datadir}/python-dmidecode/
|
%{_datadir}/python-dmidecode/
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Jun 17 2013 Ales Ledvinka <aledvink@redhat.com> - 3.10.13-8
|
||||||
|
- Attribute dmispec may cause invalid XML on some hardware.
|
||||||
|
- Signal handler for SIGILL.
|
||||||
|
|
||||||
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.10.13-7
|
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.10.13-7
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user