RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1855981 - rsync segfaults in --append mode when file on sender is large (> 2GB) and gets truncated
Summary: rsync segfaults in --append mode when file on sender is large (> 2GB) and get...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: rsync
Version: 8.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: 8.0
Assignee: Tomas Korbar
QA Contact: Ondrej Mejzlik
URL:
Whiteboard:
Depends On:
Blocks: 1894575 1955008
TreeView+ depends on / blocked
 
Reported: 2020-07-11 14:18 UTC by Renaud Métrich
Modified: 2023-10-06 21:03 UTC (History)
2 users (show)

Fixed In Version: rsync-3.1.3-11.el8
Doc Type: No Doc Update
Doc Text:
Clone Of:
: 1955008 (view as bug list)
Environment:
Last Closed: 2021-05-18 14:55:59 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github WayneD rsync issues 90 0 None closed Rsync segfaults with --append option when source file gets highly truncated 2021-01-26 06:04:21 UTC
Red Hat Product Errata RHBA-2021:1622 0 None None None 2021-05-18 14:56:05 UTC

Description Renaud Métrich 2020-07-11 14:18:45 UTC
This bug was initially created as a copy of Bug #1855979

I am copying this bug because: 

Also applies to RHEL8

Description of problem:

When syncing using "--append" and the file on the sender is > 2GB and gets truncated between rsync receiving the checksum and the actual transfer, rsync dies in Segmentation Fault.
This is due to having the "n" computation on line 108 below wrap (it's supposed to be a int32):
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
105 static void matched(int f, struct sum_struct *s, struct map_struct *buf,
106                     OFF_T offset, int32 i)
107 {
108         int32 n = (int32)(offset - last_match); /* max value: block_size (int32) */
109         int32 j;
 :
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------


Version-Release number of selected component (if applicable):

rsync-3.1.2 and rsync-3.1.3 (RHEL8)

How reproducible:

ALWAYS


Steps to Reproduce: notes: line numbers in reproducer are from RHEL8's rsync ...

1. Create 2 >2GB big files, sent file /root/file and received file /mnt/file, with /mnt/file < /root/file

# truncate -s 2760M /root/file
# truncate -s 2759M /mnt/file

2. Start rsync to sync /root/file -> /mnt under GDB, with a breakpoint on "receive_sums"

# gdb --args /usr/bin/rsync --append -vvvv /root/file /mnt
[...]
(gdb) break receive_sums
(gdb) run

3. At breakpoint, hit "next" until the checksum is computed (hence the -vvvv mode) but before /root/file gets opened for transfer

Breakpoint 1, receive_sums (f=5) at sender.c:332
332			if (!(s = receive_sums(f_in))) {
(gdb) next
71		if (!(s = new(struct sum_struct)))
(gdb) 
74		read_sum_head(f, s);
(gdb) 
76		s->sums = NULL;
(gdb) 
78		if (DEBUG_GTE(DELTASUM, 3)) {
(gdb) 
send_files (f_in=5, f_out=<optimized out>) at sender.c:332
332			if (!(s = receive_sums(f_in))) {
(gdb) 
count=53790 n=53784 rem=33608
338			fd = do_open(fname, O_RDONLY, 0);
(gdb) STOP HERE

4. From another terminal, truncate /root/file to 0

# truncate -s 0 /root/file

5. Continue rsync process

(gdb) cont

Actual results:

send_files mapped /root/file of size 0
calling match_sums /root/file
file

Program received signal SIGSEGV, Segmentation fault.
map_ptr (map=map@entry=0x0, offset=offset@entry=2893021184, len=len@entry=32768) at fileio.c:247
247		if (offset >= map->p_offset && offset+len <= map->p_offset+map->p_len)
(gdb)

Expected results:

Not dying

Comment 16 errata-xmlrpc 2021-05-18 14:55:59 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (rsync bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:1622


Note You need to log in before you can comment on or make changes to this bug.