Bug 878 - sudo segfaults when "Defaults mailerpath" is set in sudoers
sudo segfaults when "Defaults mailerpath" is set in sudoers
Status: RESOLVED FIXED
Product: Sudo
Classification: Unclassified
Component: Sudo
1.8.27
PC Linux
: low normal
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-04-18 12:31 MDT by Kim Scarborough
Modified: 2019-10-14 10:35 MDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kim Scarborough 2019-04-18 12:31:33 MDT
I'm on Arch Linux. My sudoers include these lines:

Defaults mail_always
Defaults mailerpath=/usr/bin/sendmail

Whenever I execute a sudo command, it runs fine but no e-mail is sent. These lines appear in the system journal:

Apr 18 13:19:02 plankton kernel: sudo[590]: segfault at 0 ip 00007ff2c77b36e5 sp 00007ffc664bb8c8 error 4 in libc-2.28.so[7ff2c7676000+14b000]
Apr 18 13:19:02 plankton kernel: Code: 00 00 0f 1f 00 31 c0 c5 f8 77 c3 66 2e 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 89 f9 48 89 fa c5 f9 ef c0 83 e1 3f 83 f9 20 77 2b <c5> fd 74 0f c5 fd d7 c1 85 c0 0f 85 eb 00 00 00 48 83 c7 20 83 e1

Please let me know what further information you need from me.
Comment 1 Kim Scarborough 2019-04-18 12:35:58 MDT
Possibly related: Arch upgraded glibc 2.28 last week. But I hadn't been running this configuration before today, so I can't tell you if it worked before. I tried downgrading glibc and sudo but I still get the error.
Comment 2 Todd C. Miller 2019-04-18 12:43:42 MDT
Do you have mailerflags set in sudoers as well?
Comment 3 Kim Scarborough 2019-04-18 12:47:16 MDT
No other mail-related commands in my sudoers. I can post the whole thing if you like, it's only a few lines.

Also, I tried changing the mailerpath to a script that just records the arguments to see how it was invoking sendmail. The script didn't execute at all, so it looks like this segfault is happening before the invocation.
Comment 4 Todd C. Miller 2019-04-19 10:02:11 MDT
Thanks, that is helpful.  I haven't been able to reproduce this on other Linux systems so I installed arch linux in a VM and can reproduce it there.  However, if I rebuild sudo from source the crash no longer occurs.
Comment 5 Todd C. Miller 2019-04-19 10:14:58 MDT
I see the problem.  Since sendmail was not detected during build, mailerflags was not set.  You can work around this by adding:

Defaults mailerflags="-t"

to sudoers.

I have committed a fix for the issue:
https://www.sudo.ws/repos/sudo/rev/6c57f5ddca54
Comment 6 Todd C. Miller 2019-10-14 10:35:21 MDT
Fixed in sudo 1.8.28