Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-admin/sysstat/, app-admin/sysstat/files/
Date: Fri, 05 May 2017 19:48:21
Message-Id: 1494013687.76dafed4ccc9c99b6d30d8cba37e6ba13734645d.vapier@gentoo
1 commit: 76dafed4ccc9c99b6d30d8cba37e6ba13734645d
2 Author: Mike Frysinger <vapier <AT> chromium <DOT> org>
3 AuthorDate: Fri May 5 19:47:12 2017 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Fri May 5 19:48:07 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=76dafed4
7
8 app-admin/sysstat: fix from Chromium OS for unaligned memory errors
9
10 .../sysstat/files/sysstat-11.4.3-memalign.patch | 40 ++++++++++++++++++++++
11 ...stat-11.5.5.ebuild => sysstat-11.4.3-r1.ebuild} | 13 +++++--
12 app-admin/sysstat/sysstat-11.5.5.ebuild | 1 +
13 3 files changed, 51 insertions(+), 3 deletions(-)
14
15 diff --git a/app-admin/sysstat/files/sysstat-11.4.3-memalign.patch b/app-admin/sysstat/files/sysstat-11.4.3-memalign.patch
16 new file mode 100644
17 index 00000000000..ab5fa7dbc95
18 --- /dev/null
19 +++ b/app-admin/sysstat/files/sysstat-11.4.3-memalign.patch
20 @@ -0,0 +1,40 @@
21 +sysstat declares 16 bytes alignment for many structs. But realloc does not
22 +guarantee 16 byte alignment (it maxes out at 8 bytes for most systems).
23 +Because of declared 16 byte alignement, the compiler is free to generate SIMD
24 +16 byte loads which require aligned addresses. Use posix_memalign instead to
25 +enforce 16 bytes data alignment to avoid crashes.
26 +
27 +https://github.com/sysstat/sysstat/issues/148
28 +
29 +Patch by Manoj Gupta <manojgupta@××××××.com>
30 +
31 +--- a/common.h
32 ++++ b/common.h
33 +@@ -11,6 +11,7 @@
34 +
35 + #include <time.h>
36 + #include <sched.h> /* For __CPU_SETSIZE */
37 ++#include <stdlib.h>
38 + #include <limits.h>
39 +
40 + #ifdef HAVE_SYS_SYSMACROS_H
41 +@@ -91,13 +92,18 @@
42 + TYPE *_p_; \
43 + _p_ = S; \
44 + if (SIZE) { \
45 +- if ((S = (TYPE *) realloc(S, (SIZE))) == NULL) { \
46 ++ void *_ptr = NULL; \
47 ++ int error = posix_memalign(&_ptr, 16, SIZE); \
48 ++ if (error || _ptr == NULL) { \
49 + perror("realloc"); \
50 + exit(4); \
51 + } \
52 ++ S = (TYPE *)_ptr; \
53 + /* If the ptr was null, then it's a malloc() */ \
54 + if (!_p_) { \
55 + memset(S, 0, (SIZE)); \
56 ++ } else { \
57 ++ memcpy(S, _p_, (SIZE)); \
58 + } \
59 + } \
60 + if (!S) { \
61
62 diff --git a/app-admin/sysstat/sysstat-11.5.5.ebuild b/app-admin/sysstat/sysstat-11.4.3-r1.ebuild
63 similarity index 84%
64 copy from app-admin/sysstat/sysstat-11.5.5.ebuild
65 copy to app-admin/sysstat/sysstat-11.4.3-r1.ebuild
66 index c9bea3b2b27..74edb096177 100644
67 --- a/app-admin/sysstat/sysstat-11.5.5.ebuild
68 +++ b/app-admin/sysstat/sysstat-11.4.3-r1.ebuild
69 @@ -10,10 +10,15 @@ SRC_URI="${HOMEPAGE}${P}.tar.xz"
70
71 LICENSE="GPL-2"
72 SLOT="0"
73 -KEYWORDS=""
74 -IUSE="debug nls lm_sensors selinux static"
75 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
76 +IUSE="debug isag nls lm_sensors selinux static"
77
78 CDEPEND="
79 + isag? (
80 + dev-lang/tk:0
81 + dev-vcs/rcs
82 + sci-visualization/gnuplot
83 + )
84 nls? ( virtual/libintl )
85 lm_sensors? ( sys-apps/lm_sensors )
86 "
87 @@ -28,6 +33,7 @@ RDEPEND="
88 PATCHES=(
89 "${FILESDIR}"/${PN}-10.0.4-flags.patch
90 "${FILESDIR}"/${PN}-11.0.4-cron.patch
91 + "${FILESDIR}"/${PN}-11.4.3-memalign.patch
92 )
93
94 SYSSTAT_FAKE_RC_DIR=Gentoo-does-not-use-rc.d
95 @@ -57,6 +63,7 @@ src_configure() {
96 rcdir=${SYSSTAT_FAKE_RC_DIR} \
97 econf \
98 $(use_enable debug debuginfo) \
99 + $(use_enable isag install-isag) \
100 $(use_enable lm_sensors sensors) \
101 $(use_enable nls) \
102 --enable-copy-only \
103 @@ -79,7 +86,7 @@ src_install() {
104 MANGRPARG='' \
105 install
106
107 - dodoc -r contrib/
108 + dodoc contrib/sargraph/sargraph
109
110 rm -r "${D}/${SYSSTAT_FAKE_RC_DIR}" || die
111 newinitd "${FILESDIR}"/${PN}.init.d ${PN}
112
113 diff --git a/app-admin/sysstat/sysstat-11.5.5.ebuild b/app-admin/sysstat/sysstat-11.5.5.ebuild
114 index c9bea3b2b27..73565a64f83 100644
115 --- a/app-admin/sysstat/sysstat-11.5.5.ebuild
116 +++ b/app-admin/sysstat/sysstat-11.5.5.ebuild
117 @@ -28,6 +28,7 @@ RDEPEND="
118 PATCHES=(
119 "${FILESDIR}"/${PN}-10.0.4-flags.patch
120 "${FILESDIR}"/${PN}-11.0.4-cron.patch
121 + "${FILESDIR}"/${PN}-11.4.3-memalign.patch
122 )
123
124 SYSSTAT_FAKE_RC_DIR=Gentoo-does-not-use-rc.d