From 018d790f16f1933c5235d17e34d5668b96abf652 Mon Sep 17 00:00:00 2001 From: volcanodragon Date: Mon, 29 Nov 2021 21:49:14 +0800 Subject: [PATCH] fix to support 64 bit --- ...ilesd-fix-abort-in-decant_cull_table.patch | 43 +++++++++++++++++++ cachefilesd.spec | 7 ++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 0001-cachefilesd-fix-abort-in-decant_cull_table.patch diff --git a/0001-cachefilesd-fix-abort-in-decant_cull_table.patch b/0001-cachefilesd-fix-abort-in-decant_cull_table.patch new file mode 100644 index 0000000..a95dd85 --- /dev/null +++ b/0001-cachefilesd-fix-abort-in-decant_cull_table.patch @@ -0,0 +1,43 @@ +From 3349ade9c1f40c0999c722dda4cd84b9869bebe2 Mon Sep 17 00:00:00 2001 +From: lixiaokeng +Date: Mon, 29 Nov 2021 21:15:56 +0800 +Subject: [PATCH] cachefilesd: fix abort() in decant_cull_table + +decant_cull_table only deals data with 32 bit, we should fix it +to support 64 bit, or it will coredump. + +Signed-off-by: volcanodragon +--- + cachefilesd.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/cachefilesd.c b/cachefilesd.c +index d4d236f..e9de4e4 100644 +--- a/cachefilesd.c ++++ b/cachefilesd.c +@@ -1512,6 +1512,13 @@ static void decant_cull_table(void) + { + unsigned loop, avail, copy, leave, space, n; + ++ long mask = 15; ++ long illegal = 6; ++ ++ /* 8 is bit of byte, 4 is valid bit of mask and illegal */ ++ mask = mask << (sizeof(void *) * 8 - 4); ++ illegal = illegal << (sizeof(void *) * 8 - 4); ++ + if (scan_cursor) + error("Can't decant cull table whilst scanning"); + +@@ -1567,7 +1574,7 @@ static void decant_cull_table(void) + + check: + for (loop = 0; loop < nr_in_ready_table; loop++) +- if (((long)cullready[loop] & 0xf0000000) == 0x60000000) ++ if (((long)cullready[loop] & mask) == illegal) + abort(); + } + +-- +1.8.3.1 + diff --git a/cachefilesd.spec b/cachefilesd.spec index b9e3304..0be12d4 100644 --- a/cachefilesd.spec +++ b/cachefilesd.spec @@ -1,12 +1,14 @@ Name: cachefilesd Version: 0.10.10 -Release: 8 +Release: 9 Summary: CacheFiles user-space management daemon Group: System Environment/Daemons License: GPLv2+ URL: http://people.redhat.com/~dhowells/fscache/ Source0: https://people.redhat.com/dhowells/cachefs/cachefilesd-%{version}.tar.bz2 +Patch1: 0001-cachefilesd-fix-abort-in-decant_cull_table.patch + BuildRequires: gcc systemd-units Requires(post): systemd-units Requires(preun): systemd-units @@ -62,6 +64,9 @@ install -D -m 644 cachefilesd.service %{buildroot}%{_unitdir}/cachefilesd.servic %{_mandir}/*/* %changelog +* Mon Nov 29 2021 volcanodragon - 0.10.10-9 +- DESC: fix decant_cull_table to support 64 bit. + * Fri Jul 30 2021 chenyanpanHW - 0.10.10-8 - DESC: delete -S git from %autosetup, and delete BuildRequires git