yadifad crashes on start up

Bug #2068731 reported by Y:A:D::I::F:A
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
yadifa (Ubuntu)
New
Undecided
Unassigned

Bug Description

Compiler optimization bug generates wrong assembly causing SEGFAULT.

# apt -y install yadifa

---
# systemctl start yadifa

# systemctl status yadifa
× yadifa.service - YADIFA Domain Name Server
     Loaded: loaded (/usr/lib/systemd/system/yadifa.service; enabled; preset: enabled)
     Active: failed (Result: core-dump) since Fri 2024-06-07 12:30:24 UTC; 9min ago
   Duration: 1.284s
       Docs: man:yadifad(8)
    Process: 240604 ExecStart=/usr/sbin/yadifad --nodaemon -c $YADIFA_CONF (code=dumped, signal=SEGV)
   Main PID: 240604 (code=dumped, signal=SEGV)
        CPU: 274ms

Jun 07 12:30:22 ubuntu-2404 systemd[1]: Started yadifa.service - YADIFA Domain Name Server.
Jun 07 12:30:24 ubuntu-2404 systemd[1]: yadifa.service: Main process exited, code=dumped, status=11/SEGV
Jun 07 12:30:24 ubuntu-2404 systemd[1]: yadifa.service: Failed with result 'core-dump'.

---
# /usr/sbin/yadifad
Segmentation fault (core dumped)

---
# apt-cache policy yadifa
yadifa:
  Installed: 2.6.5-1build2
  Candidate: 2.6.5-1build2
  Version table:
 *** 2.6.5-1build2 500
        500 http://be.archive.ubuntu.com/ubuntu noble/universe amd64 Packages
        100 /var/lib/dpkg/status

---
# lsb_release -rd
No LSB modules are available.
Description: Ubuntu 24.04 LTS
Release: 24.04

---
Suggested workaround by disabling lto in debian/rules (confirmed locally)

"DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=-lto"

This bug is specific for ubuntu 24.04 (gcc 13.2). It does not affect ubuntu 22.04 or Debian 12 (gcc 12.2).

Revision history for this message
Y:A:D::I::F:A (yadifa) wrote :

Root cause (credit Richard Biener) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115432

struct file_output_stream
{

    union
    {
        void *voidp;
        int fd;
    } data;

    const output_stream_vtbl* vtbl;
};

struct output_stream
{
    void* data;
    const output_stream_vtbl* vtbl;
};

those are two unrelated types. Doing

 ((file_output_stream *)p)->vtbl = x;
 ... = ((output_stream *)p)->vtbl;

is invoking undefined behavior (unless -fno-strict-aliasing).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.