[1504] in linux-security and linux-alert archive
[linux-security] Re: amd 920824upl102 ignores the nodev option
daemon@ATHENA.MIT.EDU (Jeff Uphoff)
Wed Apr 9 02:11:24 1997
Date: Tue, 8 Apr 1997 09:50:59 -0400
From: Jeff Uphoff <juphoff@tarsier.cv.nrao.edu>
To: linux-security@redhat.com
In-Reply-To: Your message of Mon, April 7, 1997 22:59:27 -0400
Reply-To: juphoff@nrao.edu
Resent-From: linux-security@redhat.com
"BMK" == Bradley M Keryan <keryan@andrew.cmu.edu> writes:
BMK> #define M_RDONLY 1 /* mount read-only */
BMK> #define M_NOSUID 2 /* ignore suid and sgid bits */
BMK> -#define M_NONDEV 4 /* disallow access to device special files */
BMK> +#define M_NODEV 4 /* disallow access to device special files */
BMK> #define M_NOEXEC 8 /* disallow program execution */
BMK> #define M_SYNC 16 /* writes are synced at once */
BMK> #define M_REMOUNT 32 /* alter flags of a mounted FS */
BMK> That's it. Evidently M_NODEV was defined to something else elsewhere,
BMK> otherwise amd shouldn't have compiled.
Actually, no. From amd/mount_fs.c:
struct opt_tab mnt_flags[] = {
{ "ro", M_RDONLY },
#ifdef M_CACHE
{ "nocache", M_NOCACHE },
#endif /* M_CACHE */
#ifdef M_GRPID
{ "grpid", M_GRPID },
#endif /* M_GRPID */
#ifdef M_MULTI
{ "multi", M_MULTI },
#endif /* M_MULTI */
#ifdef M_NODEV
{ "nodev", M_NODEV },
#endif /* M_NODEV */
...
If M_NODEV is not defined then amd appears to just assume that the nodev
option isn't honored.
I've not parsed all the logic to this yet; there's also some fun in
config/mount_linux.c:
#define MS_RDONLY 1 /* mount read-only */
#define MS_NOSUID 2 /* ignore suid and sgid bits */
#define MS_NODEV 4 /* disallow access to device special files */
#define MS_NOEXEC 8 /* disallow program execution */
#define MS_SYNC 16 /* writes are synced at once */
#define MS_REMOUNT 32 /* alter flags of a mounted FS */
struct opt_map
{
const char *opt; /* option name */
int inv; /* true if flag value should be inverted
*/
int mask; /* flag mask value */
};
const struct opt_map opt_map[] =
{
{ "defaults", 0, 0 },
{ "ro", 0, MS_RDONLY },
{ "rw", 1, MS_RDONLY },
{ "exec", 1, MS_NOEXEC },
{ "noexec", 0, MS_NOEXEC },
{ "suid", 1, MS_NOSUID },
{ "nosuid", 0, MS_NOSUID },
{ "dev", 1, MS_NODEV },
{ "nodev", 0, MS_NODEV },
{ "sync", 0, MS_SYNC },
{ "async", 1, MS_SYNC },
#ifdef MS_NOSUB
{ "sub", 1, MS_NOSUB },
{ "nosub", 0, MS_NOSUB },
#endif
{ NULL, 0, 0 }
};
The #defines used above can be found in <linux/fs.h> and those are
probably what should be used, vice these local definitions.
--Up.