GNU bug report logs -
#43583
[PATCH 0/4] Fix DFLTCC segfault when compressing or decompressing two files
Previous Next
Reported by: Ilya Leoshkevich <iii <at> linux.ibm.com>
Date: Wed, 23 Sep 2020 22:10:02 UTC
Severity: normal
Tags: patch
Done: Jim Meyering <jim <at> meyering.net>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 43583 in the body.
You can then email your comments to 43583 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gzip <at> gnu.org
:
bug#43583
; Package
gzip
.
(Wed, 23 Sep 2020 22:10:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Ilya Leoshkevich <iii <at> linux.ibm.com>
:
New bug report received and forwarded. Copy sent to
bug-gzip <at> gnu.org
.
(Wed, 23 Sep 2020 22:10:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi!
We found an issue with IBM Z hardware compression support: gzip
segfaults when processing two files. This patch series fixes the issue,
adds a test and performs two minor cleanups: fixes clang build and
updates .gitignore files.
Best regards,
Ilya
Ilya Leoshkevich (4):
Update .gitignore files
Fix building DFLTCC with clang
Fix DFLTCC segfault when compressing or decompressing two files
Add a test for compressing and decompressing two files
dfltcc.c | 21 ++++++++++++++-------
lib/.gitignore | 14 ++++++++++++++
m4/.gitignore | 3 +++
tests/Makefile.am | 1 +
tests/two-files | 31 +++++++++++++++++++++++++++++++
5 files changed, 63 insertions(+), 7 deletions(-)
create mode 100755 tests/two-files
--
2.25.4
Information forwarded
to
bug-gzip <at> gnu.org
:
bug#43583
; Package
gzip
.
(Wed, 23 Sep 2020 22:11:02 GMT)
Full text and
rfc822 format available.
Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
clang does not support .machinemode, so put it under an #ifdef.
---
dfltcc.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/dfltcc.c b/dfltcc.c
index 432c68c..86aa56e 100644
--- a/dfltcc.c
+++ b/dfltcc.c
@@ -160,10 +160,15 @@ is_dfltcc_enabled (void)
/* STFLE is supported since z9-109 and only in z/Architecture mode. When
* compiling with -m31, gcc defaults to ESA mode, however, since the kernel
* is 64-bit, it's always z/Architecture mode at runtime. */
- __asm__ (".machinemode push\n"
+ __asm__ (
+#ifndef __clang__
+ ".machinemode push\n"
".machinemode zarch\n"
+#endif
"stfle %[facilities]\n"
+#ifndef __clang__
".machinemode pop\n"
+#endif
: [facilities] "=Q"(facilities), [r0] "+r"(r0) :: "cc");
return is_bit_set (facilities, DFLTCC_FACILITY);
}
--
2.25.4
Information forwarded
to
bug-gzip <at> gnu.org
:
bug#43583
; Package
gzip
.
(Wed, 23 Sep 2020 22:12:01 GMT)
Full text and
rfc822 format available.
Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):
It ensures that compression and decompression state of the first file
does not affect the second file.
---
tests/Makefile.am | 1 +
tests/two-files | 31 +++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+)
create mode 100755 tests/two-files
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a87a594..2f7c9c3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -27,6 +27,7 @@ TESTS = \
reproducible \
stdin \
timestamp \
+ two-files \
trailing-nul \
unpack-invalid \
unpack-valid \
diff --git a/tests/two-files b/tests/two-files
new file mode 100755
index 0000000..efdfb4f
--- /dev/null
+++ b/tests/two-files
@@ -0,0 +1,31 @@
+#!/bin/sh
+# Ensure that gzip can compress more than one file.
+
+# Copyright 2020 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+# limit so don't run it by default.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ..
+
+dd if=/dev/urandom of=a count=5000 bs=1
+dd if=/dev/urandom of=b count=5000 bs=1
+cp a a.exp
+cp b b.exp
+gzip -1 a b || fail=1
+gzip -d a.gz b.gz || fail=1
+compare a.exp a || fail=1
+compare b.exp b || fail=1
+
+Exit $fail
--
2.25.4
Information forwarded
to
bug-gzip <at> gnu.org
:
bug#43583
; Package
gzip
.
(Wed, 23 Sep 2020 22:12:02 GMT)
Full text and
rfc822 format available.
Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):
The value in total_in global variable from processing the first file
affected processing of the second file. Fix by making total_in local.
---
dfltcc.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/dfltcc.c b/dfltcc.c
index 86aa56e..3a5b92d 100644
--- a/dfltcc.c
+++ b/dfltcc.c
@@ -242,10 +242,8 @@ dfltcc_gdht (struct dfltcc_param_v0 *param)
dfltcc (DFLTCC_GDHT, param, NULL, NULL, &next_in, &avail_in, NULL);
}
-static off_t total_in;
-
static dfltcc_cc
-dfltcc_cmpr_xpnd (struct dfltcc_param_v0 *param, int fn)
+dfltcc_cmpr_xpnd (struct dfltcc_param_v0 *param, int fn, off_t *total_in)
{
uch *next_out = outbuf + outcnt;
size_t avail_out = OUTBUFSIZ - outcnt;
@@ -257,7 +255,7 @@ dfltcc_cmpr_xpnd (struct dfltcc_param_v0 *param, int fn)
window);
off_t consumed_in = next_in - (inbuf + inptr);
inptr += consumed_in;
- total_in += consumed_in;
+ *total_in += consumed_in;
outcnt += ((OUTBUFSIZ - outcnt) - avail_out);
return cc;
}
@@ -349,6 +347,7 @@ dfltcc_deflate (int pack_level)
union aligned_dfltcc_param_v0 ctx_v0;
struct dfltcc_param_v0 *param = init_param (&ctx_v0);
+ off_t total_in = 0;
/* Compress ifd into ofd in a loop. */
while (true)
@@ -398,7 +397,8 @@ dfltcc_deflate (int pack_level)
}
/* Compress inbuf into outbuf. */
- while (dfltcc_cmpr_xpnd (param, DFLTCC_CMPR) == DFLTCC_CC_AGAIN)
+ while (dfltcc_cmpr_xpnd (param, DFLTCC_CMPR, &total_in)
+ == DFLTCC_CC_AGAIN)
;
/* Unmask the input data. */
@@ -427,6 +427,7 @@ dfltcc_inflate (void)
union aligned_dfltcc_param_v0 ctx_v0;
struct dfltcc_param_v0 *param = init_param (&ctx_v0);
+ off_t total_in = 0;
/* Decompress ifd into ofd in a loop. */
while (true)
@@ -446,7 +447,8 @@ dfltcc_inflate (void)
/* Decompress inbuf into outbuf. */
dfltcc_cc cc;
- while ((cc = dfltcc_cmpr_xpnd (param, DFLTCC_XPND)) == DFLTCC_CC_AGAIN)
+ while ((cc = dfltcc_cmpr_xpnd (param, DFLTCC_XPND, &total_in))
+ == DFLTCC_CC_AGAIN)
;
if (cc == DFLTCC_CC_OK)
{
--
2.25.4
Information forwarded
to
bug-gzip <at> gnu.org
:
bug#43583
; Package
gzip
.
(Thu, 24 Sep 2020 23:39:02 GMT)
Full text and
rfc822 format available.
Message #17 received at submit <at> debbugs.gnu.org (full text, mbox):
Thanks, I installed those with minor rewording to one commit message.
bug closed, send any further explanations to
43583 <at> debbugs.gnu.org and Ilya Leoshkevich <iii <at> linux.ibm.com>
Request was from
Jim Meyering <jim <at> meyering.net>
to
control <at> debbugs.gnu.org
.
(Fri, 13 Aug 2021 14:26:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 11 Sep 2021 11:24:09 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 221 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.