Bug 1959049 - It looks like strip command cannot be run simultaneous
Summary: It looks like strip command cannot be run simultaneous
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: binutils
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Nick Clifton
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-05-10 16:06 UTC by Mikhail
Modified: 2021-05-20 15:18 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2021-05-20 15:18:33 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Sourceware 27850 0 P2 UNCONFIRMED It looks like strip command cannot be run simultaneous 2021-05-11 12:17:57 UTC

Description Mikhail 2021-05-10 16:06:08 UTC
Description of problem:
Fedora build system uses script `/usr/lib/rpm/brp-strip` for removing debug symbols.
And xargs can run strip command simultaneously several times. Here is copy-paste of code from `/usr/lib/rpm/brp-strip`:

> # Strip ELF binaries
> find "$RPM_BUILD_ROOT" -type f \! -regex "${RPM_BUILD_ROOT}/*usr/lib/debug.*" -print0 | \
>     xargs -0 -r -P$NCPUS -n32 sh -c "file \"\$@\" | sed -n -e 's/^\(.*\):[ 	]*ELF.*, not stripped.*/\1/p' | xargs -I\{\} $STRIP -g \{\}" ARG0

I found file combination which cause strip error on simultaneous execution.

https://drive.google.com/file/d/1UlkJu2bg26c6Iooa60ruRvWiNzTrhgmM/view?usp=sharing

Here is archive with files and demo script test.sh
When my test script will will be launched all files from the "assets1" directory would successfully processed, but the same files from "assets2" directory processing would failed with exit code 123.

The identical of files in directories was verified by the diff utility:

[mikhail@fedora brp-strip-bug-demo]$ diff -r assets1 assets2
[mikhail@fedora brp-strip-bug-demo]$

Comment 1 Mikhail 2021-05-10 20:00:29 UTC
Backtarace:
Breakpoint 1 at 0x50f0
Starting program: /usr/bin/strip -g -v /home/mikhail/brp-strip-bug-demo/assets2/radeon_dri.so

Breakpoint 1, bfd_errmsg (error_tag=bfd_error_file_truncated) at /usr/src/debug/binutils-2.36.1-9.fc35.x86_64/bfd/bfd.c:785
785	{

Thread 1 (process 1014082 "strip"):
#0  bfd_errmsg (error_tag=bfd_error_file_truncated) at /usr/src/debug/binutils-2.36.1-9.fc35.x86_64/bfd/bfd.c:785
        buf = <optimized out>
        msg = <optimized out>
#1  0x00005555555727b5 in bfd_nonfatal_message (filename=0x0, abfd=0x555555585410, section=0x555555587d00, format=0x0) at /usr/src/debug/binutils-2.36.1-9.fc35.x86_64/binutils/bucomm.c:86
        errmsg = <optimized out>
        section_name = <optimized out>
        args = {{gp_offset = 5648, fp_offset = 0, overflow_arg_area = 0x5555556d0420, reg_save_area = 0x555555587560}}
        err = <optimized out>
#2  0x0000555555562ac3 in copy_section (ibfd=0x555555585410, isection=0x555555587d00, obfdarg=0x555555586570) at /usr/src/debug/binutils-2.36.1-9.fc35.x86_64/binutils/objcopy.c:4402
        memhunk = 0x0
        obfd = 0x555555586570
        p = <optimized out>
        osection = 0x555555599928
        size = 5648
#3  0x00007ffff7ebafc7 in bfd_map_over_sections (abfd=0x555555585410, operation=0x5555555627b0 <copy_section>, user_storage=0x555555586570) at /usr/src/debug/binutils-2.36.1-9.fc35.x86_64/bfd/section.c:1382
        sect = 0x555555587d00
        i = 3
        __PRETTY_FUNCTION__ = "bfd_map_over_sections"
#4  0x000055555555fd38 in copy_object (ibfd=<optimized out>, obfd=<optimized out>, input_arch=<optimized out>) at /usr/src/debug/binutils-2.36.1-9.fc35.x86_64/binutils/objcopy.c:3291
        start = <optimized out>
        symcount = <optimized out>
        osections = <optimized out>
        osec = <optimized out>
        gnu_debuglink_section = <optimized out>
        gaps = <optimized out>
        max_gap = <optimized out>
        symsize = <optimized out>
        dhandle = <optimized out>
        iarch = <optimized out>
--Type <RET> for more, q to quit, c to continue without paging--        imach = <optimized out>
        num_sec = <optimized out>
        i = <optimized out>
        merged_note_sections = <optimized out>
#5  0x0000555555561f03 in copy_file (input_filename=0x7fffffffe2ad "/home/mikhail/brp-strip-bug-demo/assets2/radeon_dri.so", output_filename=0x5555555853d0 "/home/mikhail/brp-strip-bug-demo/assets2/st2T0r1i", ofd=3, in_stat=<optimized out>, input_target=0x0, output_target=0x7ffff7f5f439 "elf32-i386", input_arch=0x0) at /usr/src/debug/binutils-2.36.1-9.fc35.x86_64/binutils/objcopy.c:3865
        obfd = 0x555555586570
        ibfd = 0x555555585410
        obj_matching = 0x0
        core_matching = 0xc0
        size = <optimized out>
#6  0x000055555555b25a in strip_main (argv=<optimized out>, argc=<optimized out>) at /usr/src/debug/binutils-2.36.1-9.fc35.x86_64/binutils/objcopy.c:4852
        statbuf = {st_dev = 2049, st_ino = 95420891, st_nlink = 6, st_mode = 33261, st_uid = 1000, st_gid = 1000, __pad0 = 0, st_rdev = 0, st_size = 20118836, st_blksize = 4096, st_blocks = 39296, st_atim = {tv_sec = 1620676626, tv_nsec = 998922948}, st_mtim = {tv_sec = 1620676513, tv_nsec = 602343903}, st_ctim = {tv_sec = 1620676513, tv_nsec = 602343903}, __glibc_reserved = {0, 0, 0}}
        tmpfd = 3
        hold_status = <optimized out>
        tmpname = 0x5555555853d0 "/home/mikhail/brp-strip-bug-demo/assets2/st2T0r1i"
        copyfd = 4
        input_target = <optimized out>
        output_target = <optimized out>
        show_version = 0
        c = <optimized out>
        i = <optimized out>
        merge_notes_set = -8848
        formats_info = <optimized out>
        output_file = 0x0
        input_target = <optimized out>
        output_target = <optimized out>
        show_version = <optimized out>
        formats_info = <optimized out>
        c = <optimized out>
        i = <optimized out>
        output_file = <optimized out>
        merge_notes_set = <optimized out>
        hold_status = <optimized out>
        statbuf = {st_dev = <optimized out>, st_ino = <optimized out>, st_nlink = <optimized out>, st_mode = <optimized out>, st_uid = <optimized out>, st_gid = <optimized out>, __pad0 = <optimized out>, st_rdev = <optimized out>, st_size = <optimized out>, st_blksize = <optimized out>, st_blocks = <optimized out>, st_atim = {tv_sec = <optimized out>, tv_nsec = <optimized out>}, st_mtim = {tv_sec = <optimized out>, tv_nsec = <optimized out>}, st_ctim = {tv_sec = <optimized out>, tv_nsec = <optimized out>}, __glibc_reserved = {<optimized out>, <optimized out>, <optimized out>}}
        tmpname = <optimized out>
        tmpfd = <optimized out>
        copyfd = <optimized out>
#7  main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/binutils-2.36.1-9.fc35.x86_64/binutils/objcopy.c:6047
No locals.
(gdb) quit
A debugging session is active.

	Inferior 1 [process 1014082] will be killed.

Quit anyway? (y or n) [answered Y; input not from terminal]

Comment 2 Nick Clifton 2021-05-20 15:18:33 UTC
As explained in PR 27850, this behaviour is expected.  Running strip in parallel where the same file is being stripped by more than one process is not supported.


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