Blackmagic DeckLink, ConsoleKit and TTYsTue 19 February 2013 by Peter Ward
Regular readers may skip this blog post, it’s being posted so people find the solution when the google it, not because it’s interesting.
I had a computer with a Blackmagic capture card, and discovered that it wouldn’t shut down properly. After tracing my way through PolicyKit, I discovered that it thought that my login session wasn’t local, but was a remote session.
Looking at the output of ck-list-sessions, ConsoleKit didn’t have a x11-display-device entry for my session (it’s normally something like /dev/tty7). Confusingly though, it did have an x11-display (which was :0 as expected).
ConsoleKit determines the x11-display-device using a helper program, which on my system is located at /usr/lib/ConsoleKit/ck-get-x11-display-device.
This helper program parses /proc/tty/drivers, into a struct in src/ck-sysdeps-linux.c:92. I discovered the name in /proc/tty/drivers was more than 16 characters, and hence overflowed the name array, causing the program to segfault.
Since ConsoleKit’s project page indicates that there’s no longer any active development on it, I decided on the hacky solution to solve my problem, rather than fixing the actual problem and bumped the size of the name array up by a couple of bytes.
Index: consolekit-0.4.5/src/ck-sysdeps-linux.c =================================================================== --- consolekit-0.4.5.orig/src/ck-sysdeps-linux.c 2012-07-14 14:08:02.298395776 +1000 +++ consolekit-0.4.5/src/ck-sysdeps-linux.c 2012-07-14 14:11:07.282389984 +1000 @@ -93,7 +93,7 @@ guint major_number; guint minor_first; guint minor_last; - char name; + char name; char devfs_type; } tty_map_node;