bugGNU Screen - Bugs: bug #66158, Reading a screenrc leads to...

 
 

bug #66158: Reading a screenrc leads to segfault in 5.0.0

Submitter:  None
Submitted:  Sun 01 Sep 2024 11:50:06 AM UTC
   
 
Category:  Crash/Freeze/Infloop Severity:  3 - Normal
Priority:  * 5 - Normal Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Release:  None
Fixed Release:  None Planned Release:  None
Work Required:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 04 Oct 2024 04:14:28 PM UTC, comment #5: 

Thank you for your patience. I downloaded the newest version, unpacked it, ./configure, make, make install.

$ ~/.local/bin/screen --version
Screen version 5.0.0 (build on 2024-10-04 17:10:28)
$ ~/.local/bin/screen -ls
No Sockets found in /home/user/.screen.

$ ~/.local/bin/screen
$ ~/.local/bin/screen -ls
There is a screen on:
        6505.pts-1.myhost       (Attached)
1 Socket in /home/user/.screen.
$ touch /tmp/screenrc
$ file /tmp/screenrc
/tmp/screenrc: empty
$ ~/.local/bin/screen -X source /tmp/screenrc
$

→ Yep, the “vanilla” version works perfectly fine. My next step would be to contact the guys from Archlinux and file a bug report there – do you agree?

Claudio Ebel <prancing_gecko>
Sun 08 Sep 2024 01:02:53 PM UTC, comment #4: 


comment #3:

> What OS do you use?
> Arch Linux
>
> How did you build screen?
> I didn't because I used the precompiled Arch package.


Can you reproduce this problem by using your own build of the screen? Just donwload tarball, unpack it, ./configure, make, make install.

Alexander Naumov <anaumov>
Group administrator
Sun 08 Sep 2024 05:53:40 AM UTC, comment #3: 

Thank you for your answer!

What OS do you use?
Arch Linux

How did you build screen?
I didn't because I used the precompiled Arch package. According to this Arch forum post, the compile flags are on the default makepkg.conf file. Here is an excerpt from my:


#########################################################################
# ARCHITECTURE, COMPILE FLAGS
#########################################################################
#
CARCH="x86_64"
CHOST="x86_64-pc-linux-gnu"

#-- Compiler and Linker Flags
#CPPFLAGS=""
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
        -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security \
        -fstack-clash-protection -fcf-protection \
        -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"
CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now \
         -Wl,-z,pack-relative-relocs"
LTOFLAGS="-flto=auto"
RUSTFLAGS="-Cforce-frame-pointers=yes"
#-- Make Flags: change this for DistCC/SMP systems
#MAKEFLAGS="-j2"
#-- Debugging flags
DEBUG_CFLAGS="-g"
DEBUG_CXXFLAGS="$DEBUG_CFLAGS"
DEBUG_RUSTFLAGS="-C debuginfo=2"


Can you try to get the gdb stack from this segfault?
Following the tips on the Arch wiki:


$ coredumpctl info 3097
...
                Stack trace of thread 3097:
                #0  0x00007bd200d773f4 n/a (libc.so.6 + 0x963f4)
                #1  0x00007bd200d1e120 raise (libc.so.6 + 0x3d120)
                #2  0x00007bd200d054c3 abort (libc.so.6 + 0x244c3)
                #3  0x00007bd200d06354 n/a (libc.so.6 + 0x25354)
                #4  0x00007bd200e06799 __fortify_fail (libc.so.6 + 0x125799)
                #5  0x00007bd200e06124 __chk_fail (libc.so.6 + 0x125124)
                #6  0x00007bd200e07d39 __strncpy_chk (libc.so.6 + 0x126d39)
                #7  0x000059af9ec82190 n/a (screen-5.0.0 + 0x5190)
                #8  0x00007bd200d06e08 n/a (libc.so.6 + 0x25e08)
                #9  0x00007bd200d06ecc __libc_start_main (libc.so.6 + 0x25ecc)
                #10 0x000059af9ec83bd5 n/a (screen-5.0.0 + 0x6bd5)
                ELF object binary architecture: AMD x86-64

There are per default no symbols in the binaries. Starting screen with the program downloads the debug information (I'm impressed about that btw), but running the program just hangs the terminal, "Ctrl-C", "Ctrl-Z", "q" doesn't do anything and I have to kill gdb by sending TERM.

$ gdb --args screen -X source /tmp/screenrc
Reading symbols from screen...

This GDB supports auto-downloading debuginfo from the following URLs:
  <https://debuginfod.archlinux.org>
Enable debuginfod for this session? (y or [n]) y
Debuginfod has been enabled.
To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit.
Reading symbols from /home/user/.cache/debuginfod_client/9d742cd03e4f4867744f279b3b229c18bd9f8e65/debuginfo...
(gdb) r
Starting program: /usr/bin/screen -X source /tmp/screenrc
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

It seems to me the started process does not crash then, but I don't know how to check that or interact with it. Do you have a hint, maybe?

Can you try to reproduce it without existing screen sessions?
Could you point me what command I should execute then?

As background information: In my default setup, I want to

  • always have a screen session running
  • reattach to the previous screen session when (accidentally) closing the terminal emulator

so I added the line `screen -xRR autoscreen` to my ~/.bashrc. The bug occurs in this setup.

When I remove the line from my bashrc, Ctrl-D the screen and terminal emulator, restart and

$ screen -ls
No Sockets found in /home/user/.screen.

$ screen -xRR autoscreen -c /tmp/screenrc
$ screen -ls
There is a screen on:
        5516.autoscreen (Attached)
1 Socket in /home/user/.screen.
$

a new screen session is successfully started.

Claudio Ebel <prancing_gecko>
Fri 06 Sep 2024 05:30:37 PM UTC, comment #2: 


> $ screen --version
> Screen version 5.0.0 (build on 2024-08-29 01:08:49)
> $ touch /tmp/screenrc
> $ file /tmp/screenrc
> /tmp/screenrc: empty
> $ screen -X source /tmp/screenrc
> * buffer overflow detected *: terminated
> Aborted (core dumped)

What OS do you use? How did you build screen?
Can you try to get the gdb stack from this segfault?


> Both commands were executed while an open and attached screen (socket).

Can you try to reproduce it without existing screen sessions?


> Originally I had a broken hard status, as in bug #66141, but by trying to narrow down the origin discovered this potential common cause. I'll mention this issue on the other bug, too.

Let's talk here about some concrete problem :)

Alexander Naumov <anaumov>
Group administrator
Sun 01 Sep 2024 12:13:01 PM UTC, comment #1: 

Original poster here. The comment is to “link” this bug report to my fresh user account. For readability the bug report in markup:

= Description =
Since the update from 4.09.01 to 5.0.0, reading a screenrc leads to a segfault.

== Behavior in different versions ==
Expected behavior (tested):

$ screen --version
Screen version 4.09.01 (GNU) 20-Aug-23
$ touch /tmp/screenrc
$ file /tmp/screenrc
/tmp/screenrc: empty
screen -X source /tmp/screenrc
$

All works. Buggy behavior in new version:

$ screen --version
Screen version 5.0.0 (build on 2024-08-29 01:08:49)
$ touch /tmp/screenrc
$ file /tmp/screenrc
/tmp/screenrc: empty
$ screen -X source /tmp/screenrc
* buffer overflow detected *: terminated
Aborted (core dumped)

Both commands were executed while an open and attached screen (socket). Originally I had a broken hard status, as in bug #66141, but by trying to narrow down the origin discovered this potential common cause. I'll mention this issue on the other bug, too.

Claudio Ebel <prancing_gecko>
Sun 01 Sep 2024 11:50:06 AM UTC, original submission:  

Description:
Since the update from 4.09.01 to 5.0.0, reading a screenrc leads to a segfault.
Expected behavior (tested):
```shell
$ screen --version
Screen version 4.09.01 (GNU) 20-Aug-23
$ touch /tmp/screenrc
$ file /tmp/screenrc
/tmp/screenrc: empty
screen -X source /tmp/screenrc
$
```
All works. Buggy behavior in new version:
```shell
$ screen --version
Screen version 5.0.0 (build on 2024-08-29 01:08:49)
$ touch /tmp/screenrc
$ file /tmp/screenrc
/tmp/screenrc: empty
$ screen -X source /tmp/screenrc
* buffer overflow detected *: terminated
Aborted (core dumped)
```
Both commands were executed while an open and attached screen (socket). Originally I had a broken hard status, as in https://savannah.gnu.org/bugs/?66141, but by trying to narrow down the origin discovered this potential common cause. I'll mention this issue on the other bug, too.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by anaumov (Posted a comment)
  • -email is unavailable- added by prancing_gecko (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.14-573e.
    Corresponding source code