cron can crash (SIGSEGV) when trying to re-parent orphans

Bug #1846025 reported by buck
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cron (Ubuntu)
New
Undecided
Unassigned

Bug Description

We sometimes have people come and go, leaving behind
old crontab files that, when they return, and are given
the same username, no longer have the correct uid.
This can cause cron to crash when it has the old crontab
file on its orphans list. Below's a lightly-edited
backtrace, with username replaced by "joeuser".

Here's the user's (former) crontab:

-rw------- 1 48031 crontab 1216 Jul 26 15:36 /var/spool/cron/crontabs/joeuser

Whereas his new uid is

# id -u joeuser
48529

This is on bionic with cron 3.0pl1-128.1ubuntu1

--buck

Core was generated by `/usr/sbin/cron -f'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 find_user (name=<optimized out>, db=0x0, db@entry=0x55fc9fe93ea0)
    at database.c:316
316 database.c: No such file or directory.
(gdb) bt
#0 find_user (name=<optimized out>, db=0x0, db@entry=0x55fc9fe93ea0)
    at database.c:316
#1 force_rescan_user (old_db=old_db@entry=0x0,
    new_db=new_db@entry=0x7fffe687cb50,
    fname=fname@entry=0x55fc9fe93ea0 "joeuser", old_mtime=old_mtime@entry=0)
    at database.c:588
#2 0x000055fc9f2b03ab in process_crontab (uname=0x55fc9fe93df0 "joeuser",
    fname=<optimized out>, tabname=0x55fc9fe93ec0 "crontabs/joeuser",
    statbuf=statbuf@entry=0x7fffe687ca80, new_db=new_db@entry=0x7fffe687cb50,
    old_db=old_db@entry=0x0) at database.c:460
#3 0x000055fc9f2b0ba6 in check_orphans (db=0x7fffe687cb50) at database.c:639
#4 0x000055fc9f2af6ce in main (argc=<optimized out>, argv=<optimized out>)
    at cron.c:178

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.