sqlite triggers syscall error if run as root in snappy default confinement (fchown not allowed)

Bug #1560899 reported by Alexander Sack
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
sqlite3 (Ubuntu)
Expired
High
Unassigned

Bug Description

Code currently tries to change user to uid if geteuid is root; this call triggers fchown syscall exception in snappy.

Good news is that in snappy this call is a null op in theory as both geteuid as well as uid are 0, so changing wouldnt do anything.

Fix is to not try to chown if geteuid is equal to uid (e.g. if it would be a null op anyway). "Safe" patch should be:

Index: sqlite3-3.11.0/src/os_unix.c
===================================================================
--- sqlite3-3.11.0.orig/src/os_unix.c
+++ sqlite3-3.11.0/src/os_unix.c
@@ -497,7 +497,7 @@ static struct unix_syscall {
 */
 static int robustFchown(int fd, uid_t uid, gid_t gid){
 #if defined(HAVE_FCHOWN)
- return osGeteuid() ? 0 : osFchown(fd,uid,gid);
+ return osGeteuid() || osGeteuid() == uid ? 0 : osFchown(fd,uid,gid);
 #else
   return 0;
 #endif

Tags: patch
Revision history for this message
Alexander Sack (asac) wrote :
Revision history for this message
Alexander Sack (asac) wrote :

subscribing ubuntu release. would like to see this considered for final release still as sqlite is an often used components in snaps and with this patch you can pull in the binary from the archive through the convenient snapcraft stage-packages ...

patch should be safe as it basically just avoids a null op that in case of snappy then gets the process killed for no reason (e.g. chown from 0 to 0 -> seccomp kicks in).

Oliver Grawert (ogra)
Changed in sqlite3 (Ubuntu):
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Iain Lane (laney) wrote :

(cleaning up old ~ubuntu-release bugs)

Is this still relevant? I'm going to assume not and unsubscribe ubuntu-release / set Incomplete, but please undo that if it is.

Changed in sqlite3 (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "quilt dropin patch against latest xenial" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for sqlite3 (Ubuntu) because there has been no activity for 60 days.]

Changed in sqlite3 (Ubuntu):
status: Incomplete → Expired
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.