lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <201306140926455537935@gmail.com>
Date:	Fri, 14 Jun 2013 09:26:49 +0800
From:	majianpeng <majianpeng@...il.com>
To:	john <john@...nmccutchan.com>, rlove <rlove@...ve.org>,
	eparis <eparis@...isplace.org>
Cc:	linux-kernel <linux-kernel@...r.kernel.org>
Subject: [BUG] Using inotify on /proc/partitoins

Hi all,
     I wanted to monitor /proc/partitions using inotify.Although now i know it can't catch the event of write.
But for read,it can't catch. The code is:
int main()
{
	int fd = inotify_init();
	int wd;
	char buff[4096];
	int ret;
	if (fd < 0)
		perror("inotify_init error\n");

	wd = inotify_add_watch(fd, "/proc/partitions", IN_ACCESS);
	if (wd < 0)
		perror("inotify_add_watch error\n");

	
	ret = read(fd, buff, 4096);
	if (ret < 0)
		perror("read error\n");
	else
		printf("buff %s\n", buff);
	return 0;
}

But when i call 'cat /proc/partitions',the program can't return.
So i added some message in kernel in order to find the reason.
In procfs for some files, the inode used this method to alloc.
proc_lookup-->proc_lookup_de--->proc_get_inode-->new_inode_pseudo
In new_inode_pseudo, it will alloc new inode so every open-operation procfs will alloc new inode.
So inotify can't work.

I think it should add a flag which indicate file can't support inotify.Although  there are a few files in procfs.


Thanks!
Jianpeng

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ