On Thu, Aug 16, 2007 at 09:05:43PM +0800, David Woodhouse wrote: > On Thu, 2007-08-16 at 05:39 -0400, Alan Cox wrote: > > Sorry ignore the previous email I misunderstood what was going on. > > > > You can open a file O_CREAT with neither read or write, you can open a file > > with O_CREAT|O_WRONLY but not give permissions in the file mode. You must > > provide the third argument so the abort is right. If you don't then the permissions > > are set based on the random values (eg the return address) > > Return address? > > Even on crappy register-starved architectures like i386 we'd have the > three arguments in registers, wouldn't we? The permissions are set based > on the contents of some register, surely? i386 passes arguments on the stack (unless regparm is used, which open doesn't, but even then, regparm doesn't affect varargs). So, on some architectures like i?86 open ("foo", O_CREAT | O_RDWR); passes stack content as mode, while on most architectures it is content of some register. But whether it is stack slot or register doesn't change anything on that if mode passed to open makes sense, it is by pure luck. Jakub -- Fedora-maintainers mailing list Fedora-maintainers@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/fedora-maintainers -- Fedora-maintainers-readonly mailing list Fedora-maintainers-readonly@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/fedora-maintainers-readonly