Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 917517 - net-misc/rsync-3.2.7-r2 terminated due to buffer overflow
Summary: net-misc/rsync-3.2.7-r2 terminated due to buffer overflow
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: 847148
  Show dependency tree
 
Reported: 2023-11-17 18:25 UTC by raffaele
Modified: 2023-12-28 04:15 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
patch file (fortify_strlcpy_crash.patch,692 bytes, patch)
2023-11-23 19:13 UTC, raffaele
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description raffaele 2023-11-17 18:25:59 UTC
System recently switched to hardened profile from desktop, an rsync-based backup script now fails.
This is possibly an upstream known bug: https://github.com/WayneD/rsync/issues/511

Reproducible: Always

Steps to Reproduce:
1. issue the following command:
rsync -avx --delete --filter 'dir-merge /.exclude_from_backup' --filter 'dir-merge /.include_in_backup' --exclude-from /root/excluded_from_backup --include-from /root/included_in_backup /etc/ /mnt/backup/etc/

Actual Results:  
sending incremental file list
*** buffer overflow detected ***: terminated
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(231) [sender=3.2.7]
rsync: [receiver] write error: Broken pipe (32)
rsync error: error in socket IO (code 10) at io.c(848) [receiver=3.2.7]

Expected Results:  
Before switching to hardened profile the script copied the data without problems

Portage 3.0.55 (python 3.11.6-final-0, default/linux/amd64/17.1/hardened, gcc-13, glibc-2.38-r7, 6.6.1-gentoo x86_64)
=================================================================
System uname: Linux-6.6.1-gentoo-x86_64-AMD_Ryzen_9_5900X_12-Core_Processor-with-glibc2.38
KiB Mem:    65768828 total,  62531304 free
KiB Swap:   21504028 total,  21504028 free
Timestamp of repository gentoo: Sun, 12 Nov 2023 15:30:01 +0000
Head commit of repository gentoo: 3224edf96bf428368b5f26d015f01064a3cb7ac8
sh bash 5.2_p21
ld GNU ld (Gentoo 2.41 p2) 2.41.0
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p21::gentoo
dev-lang/perl:             5.38.0-r1::gentoo
dev-lang/python:           3.11.6::gentoo, 3.12.0_p1::gentoo
dev-lang/rust:             1.73.0::gentoo
dev-util/cmake:            3.27.7::gentoo
dev-util/meson:            1.2.3::gentoo
sys-apps/baselayout:       2.14-r1::gentoo
sys-apps/openrc:           0.51::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-devel/autoconf:        2.13-r8::gentoo, 2.71-r7::gentoo
sys-devel/automake:        1.16.5-r1::gentoo
sys-devel/binutils:        2.41-r2::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           17.0.4::gentoo
sys-devel/gcc:             13.2.1_p20231014::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/lld:             17.0.4::gentoo
sys-devel/llvm:            16.0.6::gentoo, 17.0.4::gentoo
sys-devel/make:            4.4.1-r1::gentoo
sys-kernel/linux-headers:  6.6::gentoo (virtual/os-headers)
sys-libs/glibc:            2.38-r7::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    volatile: False
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-jobs: 1
    sync-rsync-extra-opts: 
    sync-rsync-verify-metamanifest: yes

local
    location: /var/db/repos/local
    masters: gentoo
    volatile: False

Installed sets: @x11
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=native -pipe"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--quiet-build --keep-going --jobs 24 --load-average 24.0"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O2 -march=native -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userpriv usersandbox usersync xattr"
FFLAGS="-O2 -march=native -pipe"
GENTOO_MIRRORS="http://gentoo.mirror.web4u.cz/ rsync://mirror.aarnet.edu.au/pub/gentoo/ rsync://ftp-stud.hs-esslingen.de/gentoo/"
LANG="C.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
LINGUAS="en it"
MAKEOPTS="-j24 -l24.0"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="X a52 aac acl acpi alsa amd64 bluetooth branding bzip2 cairo cdda cdr cet cli crypt cups dbus dri dts dvd dvdr elogind encode exif flac gdbm gif gpm gtk gui hardened hpcups iconv icu jpeg lcms libnotify libtirpc logrotate mad mng mp3 mp4 mpeg mtp multilib ncurses nls nptl nsplugin ogg opengl openmp pam pango pcre pcsc-lite pdf pie png policykit ppds pulseaudio qt5 readline sdl seccomp sound spell split-usr ssl ssp startup-notification svg test-rust tiff tpm truetype udev udisks unicode upower usb vorbis wxwidgets x264 xattr xcb xfce xft xml xtpax xv xvid zlib" ABI_X86="64" ADA_TARGET="gnat_2021" ALSA_CARDS="hda-intel" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" CAMERAS="canon" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev" KERNEL="linux" L10N="en it" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby31" SANE_BACKENDS="niash" VIDEO_CARDS="nouveau" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 raffaele 2023-11-23 19:13:07 UTC
Created attachment 875442 [details, diff]
patch file

Patch derived from the indicated link. Per comments, seems more like a workaround than a fix but works for me
Comment 2 Larry the Git Cow gentoo-dev 2023-12-28 04:15:08 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=49fc4a8567531cb5d8f889832663c784d6a36ddf

commit 49fc4a8567531cb5d8f889832663c784d6a36ddf
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-12-28 04:11:47 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-12-28 04:11:47 +0000

    net-misc/rsync: fix crash w/ FORTIFY_SOURCE=3
    
    Closes: https://bugs.gentoo.org/917517
    Signed-off-by: Sam James <sam@gentoo.org>

 .../rsync/files/rsync-3.2.7-fortify-source-3.patch |  54 ++++++
 net-misc/rsync/rsync-3.2.7-r3.ebuild               | 204 +++++++++++++++++++++
 2 files changed, 258 insertions(+)