public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* fanotify bug on gdb -- hard crash
@ 2014-12-26 14:45 ivo welch
  2014-12-26 18:40 ` Heinrich Schuchardt
  2014-12-26 22:14 ` Pavel Machek
  0 siblings, 2 replies; 8+ messages in thread
From: ivo welch @ 2014-12-26 14:45 UTC (permalink / raw)
  To: linux-kernel

I am not a kernel developer, so forgive the intrusion.

I suspect I have found either a bug in gdb (less likely) or a bug in
fanotify (more likely).  it is replicable, and the code is almost
unchanged from the example in the fanotify man page.  to trigger it,
all an su needs to do is to step through the program below with gdb
7.8.1 'n' command, and linux locks up the system pretty hard (reboot
required).  I have confirmed the replicability of this issue on a
clean arch 2014.12.01 3.17.6-1 system and on a clean ubuntu 14.10
system, both VMs created just to check it.  /iaw


#define _GNU_SOURCE     /* Needed to get O_LARGEFILE definition */
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <poll.h>
#include <sys/fanotify.h>

int main(int argc, char *argv[]) {
  int fd;
  fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,
O_RDONLY | O_LARGEFILE);
  if (fd == -1) exit(1);
  fprintf(stderr, "calling fanotify_mark: fd=%d\n", fd);
  if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT, FAN_OPEN_PERM |
FAN_CLOSE_WRITE, -1, "/") == -1) exit(2);
  fprintf(stderr, "in gdb step through with 'n' for repeat.\n");
  fprintf(stderr, "  (and sometimes otherwise), a ^C works, but a ^Z
and then ^C does not.\n");
}

I don't know who else to tell this.  I hope this report is useful, if
someone competent can confirm it.  /iaw


PS: Is there an alternative to fanotify to avoid this?  I want to
learn of all file-open requests on a ro device.
----
Ivo Welch (ivo.welch@gmail.com)

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-12-31  0:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-26 14:45 fanotify bug on gdb -- hard crash ivo welch
2014-12-26 18:40 ` Heinrich Schuchardt
2014-12-28 23:13   ` Eric Paris
     [not found]     ` <CAPr7RtWQ6bt4M8f-2-w0nbLvgpupb0kckE=VQDYbC8EXwiPDJg@mail.gmail.com>
2014-12-29  4:29       ` Eric Paris
2014-12-29  5:06         ` ivo welch
2014-12-31  0:21           ` Eric Paris
2014-12-26 22:14 ` Pavel Machek
2014-12-26 23:48   ` ivo welch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox