user jobs cause kernel panic

Bug #807293 reported by ValVe
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
upstart
Fix Released
High
James Hunt

Bug Description

Any job in ~/.init/ started as non-root causes error in initctl and then init crashes.

testjob.conf is in ~/.init/ (and runs just fine as root when placed in /etc/init/)

valve@webcast1:~$ initctl start testjob
initctl: Message did not receive a reply (timeout by message bus)
and then kernel panics ^_^

Revision history for this message
ValVe (valve-via) wrote :

This behavior occurs in both natty upstart package and 1.3 built from source. (DBus access rules taken from 1.3 in both cases)

$ cat $HOME/.init/testjob.conf
#### the test job ####
description "Crashes your system"

task

script
end script
#### end test job

$ initctl --system start testjob
initctl: Message did not receive a reply (timeout by message bus)

Init crashes only if the job executes any command or has "script - end script", even if it's empty.

Jobs starting on signals and with dbus-send like that also crash init.
$ dbus-send --system --print-reply --dest=com.ubuntu.Upstart /com/ubuntu/Upstart/jobs/1000/testjob com.ubuntu.Upstart0_6.Job.Stop array:string: boolean:true

Abstract jobs which do nothing (do not contain exec or script statements) start and stop as they should. Starting on manually emitted signals also work with those jobs.

Revision history for this message
James Hunt (jamesodhunt) wrote :

Crash is caused by assertion failure in job_process.c:849 (job_process_error_read).

Whilst the bug is investigated, we strongly recommend user jobs are disabled by changing /etc/dbus-1/system.d/Upstart.conf to, for example, the version of this file shipped by Ubuntu which disables user jobs:

http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/oneiric/upstart/oneiric/view/head:/dbus/Upstart.conf

Changed in upstart:
assignee: nobody → James Hunt (jamesodhunt)
importance: Undecided → High
status: New → Confirmed
Revision history for this message
ValVe (valve-via) wrote :

The assertion error is raised because of unhandled err->type == 10 in job_process_error_read, with strerror output "Operation not permitted".

Revision history for this message
ValVe (valve-via) wrote :

Seems that setuid is failing somehow in job_process.c:643

Revision history for this message
ValVe (valve-via) wrote :

Uh, looked at a wrong line in job_process.h, assuming enum is still zero-based.
The error is JOB_PROCESS_ERROR_SETGID (job_process.c:648)

Revision history for this message
ValVe (valve-via) wrote :

Seems this was a n00b bug with setting UID before GID, and since root priviliges were already lost, setgid failed.

The attached patch solves this problem.

James Hunt (jamesodhunt)
Changed in upstart:
status: Confirmed → In Progress
James Hunt (jamesodhunt)
Changed in upstart:
status: In Progress → Fix Released
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.