Re: /run vs /var/run
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
md@Linux.IT (Marco d'Itri) writes:
> On Dec 18, Roger Leigh <rleigh@whinlatter.ukfsn.org> wrote:
>
>> How strongly can I put this? /dev/shm is for *shared memory*, not for
>> random junk. /dev/shm is for POSIX shared memory and semaphores
> /dev/shm is a tmpfs which happens to be used by POSIX SHM. I have not
> seen yet a good reason why it should not be used by other users too.
There could be a naming conflict. The entire namespace is reserved
for SHM, right? That means if someone does a
"int shm = shm_open("/foobar", O_CREAY, 0600)"
and some thoughtless prat already put something by than name there,
they are completely stuffed.
They should use a tmpfs mounted somewhere else.
Here's a sample program to demonstrate:
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int
main (void)
{
int fd = shm_open("/foobar", O_CREAT, 0600);
if (fd < 0)
{
fprintf(stderr, "ERROR: %s\n", strerror(errno));
exit(1);
}
fprintf(stderr, "SUCCESS\n");
exit(0);
}
>> created with sem_open() and shm_open(). We don't want random breakage
>> because people put files in there. /dev/shm is reserved.
> Actually people have been putting files there for a while, even in
> packages in a stable release. Can you point us to some examples of the
> random breakage you suggest has happened?
It hasn't happened, but POSIX shm will inevitably take time to gain
users. That doesn't mean abusing it is a good idea in the meantime.
>> Where was it ever written down that any package could use /dev/shm?
>> They can't.
> Oops. They already do.
Correct, but does that make it OK? I find it disgustingly bad
practice, and now we have /run, they can move to using that. /run is
a good idea for this reason alone, because it will correct this abuse.
I fail to see why anyone can consider abuse of an unrelated subsystem
"because it's there" is good engineering practice. Any package
abusing /dev/shm is deserving of an RC bug.
Regards,
Roger
- --
Roger Leigh
Printing on GNU/Linux? http://gimp-print.sourceforge.net/
Debian GNU/Linux http://www.debian.org/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8+ <http://mailcrypt.sourceforge.net/>
iD8DBQFDpZ2cVcFcaSW/uEgRApREAJ9tyP3j5T8nXJEUyq/2yidKjxIlfgCgkMAr
iOv0KKusOB1opxHOmcGzRUQ=
=8W5l
-----END PGP SIGNATURE-----
Reply to: