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
| ||
|
Date: Thu, 9 Apr 2009 09:26:15 +0900 (JST) From: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com> To: Neil Brown <neilb@...e.de> Cc: kosaki.motohiro@...fujitsu.com, Greg Kroah-Hartman <gregkh@...e.de>, LKML <linux-kernel@...r.kernel.org>, Al Viro <viro@...IV.linux.org.uk> Subject: Re: [PATCH] sysfs poll should keep the poll rule of normal regular file. > On Wednesday April 8, kosaki.motohiro@...fujitsu.com wrote: > > > > Currently, following test programs don't finished. > > > > % ruby -e ' > > Thread.new { sleep } > > File.read("/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies") > > ' > > > > strace expose the reason. > > > > ... > > open("/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies", O_RDONLY|O_LARGEFILE) = 3 > > ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbf9fa6b8) = -1 ENOTTY (Inappropriate ioctl for device) > > fstat64(3, {st_mode=S_IFREG|0444, st_size=4096, ...}) = 0 > > _llseek(3, 0, [0], SEEK_CUR) = 0 > > select(4, [3], NULL, NULL, NULL) = 1 (in [3]) > > read(3, "1400000 1300000 1200000 1100000 1"..., 4096) = 62 > > select(4, [3], NULL, NULL, NULL > > > > > > Because Ruby (the scripting language) VM assume select system-call against regular file don't block. > > (POSIX gurantee it.) > > But sysfs_poll() don't keep this rule although sysfs file can read and write always. > > It would be nice to include a reference to where POSIX (or SUS) > guarantees it - though I suspect you are right. Oh, very good opinion. following explanation is better? poll is requireed "Regular files shall always poll TRUE for reading and writing." by SUSv3. see http://www.opengroup.org/onlinepubs/009695399/functions/poll.html > I have one piece of code that this would break, but it isn't released > yet and it is never too late to fix things.. > > However it should be pointed out that /proc/mounts has exactly the > same problems (/proc/mdstat doesn't - I guess I was lucky enough to > get that one right). So we should "fix" /proc/mounts > (fs/proc/base.c:mounts_poll) at the same time. Assuming that won't > break anything. > > Al: do you have an opinion about changing mounts_poll to always > report 'readable' to poll?? What would break? > > NeilBrown -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists