SHA256
1
0
forked from pool/haveged
haveged/f2193587.patch
Tomáš Chvátal 433852052d Accepting request 636617 from home:WernerFink:branches:security
- Add patch f2193587.patch from github pull request
  * Fix segfault on arm machines which do not eport the cache size
    or say it is -1 in sysfs
- Refresh patches

OBS-URL: https://build.opensuse.org/request/show/636617
OBS-URL: https://build.opensuse.org/package/show/security/haveged?expand=0&rev=123
2018-09-19 10:25:55 +00:00

28 lines
1.0 KiB
Diff

From f2193587e8e51aa42b192c17ad39467931e2d4c2 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Wed, 19 Sep 2018 09:51:43 +0200
Subject: [PATCH] Fix segfault on arm machines
Some ARM cpus does not report the cache size or say it is -1 in sysfs.
It has been observed on xgene and thunderx machines.
Fall back to the generic cache size when that happens so we don't
segfault.
Should fix https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=866306
---
src/havegetune.c | 2 ++
1 file changed, 2 insertions(+)
--- a/src/havegetune.c
+++ b/src/havegetune.c 2018-09-19 09:25:27.016773887 +0000
@@ -795,6 +795,8 @@ static int vfs_configInfoCache(
ctype = vfs_configFile(pAnchor, path, vfs_configType);
strcpy(path+plen, "size");
size = vfs_configFile(pAnchor, path, vfs_configInt);
+ if (size == -1)
+ size = ctype == 'I' ? GENERIC_ICACHE : GENERIC_DCACHE;
cfg_cacheAdd(pAnchor, SRC_VFS_INDEX, pArgs[1], level, ctype, size);
}
}