Package: util-linux
Version: 2.40.4-3
Severity: important

Dear Maintainer,

this is the first bug report I'm sending, so I hope all the formatting is correct.

I am running Debian Trixie in a Proxmox VM. I noticed that on the login screen there are errors of agetty crashing with a segfault. There's nothing special about the VM, it's a blank VM running the daily cloud images of Debian Trixie.

The VM is running Linux 6.12.12-1 with util-linux 2.40.4-3 and libc6 2.40-7.

I debugged this with ltrace and believe I found the error, or at least some invalid behaviour.

In agetty.c in the debian sources for util-linux, right at the end of the function parse_args, there's code that tries to figure out the terminal name using a call to get_terminal_name. For some reason, this function call seems to fail on my machine and it prints the error "could not get terminal name".

This causes it to set &op->tty to NULL, and unfortunately, a couple lines later, that variable is used in a strncmp call, causing it to crash.

Here's the corresponding lines from the ltrace log:

strtok(nil, ",")                                 = nil
free(0x557c64154be0)                             = <void>
strcmp("-", "-")                                 = 0
isatty(0)                                        = 0
isatty(1)                                        = 0
isatty(2)                                        = 0
dcgettext(nil, "could not get terminal name: %d", 5) = "could not get terminal name: %d"
openlog("agetty", 1, 80)                         = <void>
__vsyslog_chk(4, 1, 0x557c2a49d4d8, 0x7ffda1325e40) = 0
closelog()                                       = <void>
strncmp(nil, "tty", 3 <no return ...>
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++


I can provide the full ltrace log and/or a crash dump file if necessary - what's the best way to provide these? Upload at a filehoster and send the link in response to this bug report?

Unfortunately, I was not yet able to figure out why on my machine the code seems to run into this code path with the "could not get terminal name" warning. But nevertheless, it's a valid code path, and it's just a warning not an error, so the code that comes after it should be able to handle this without crashing.

Best regards,
Florian

Reply via email to