proto: change device permissions to 0600

C Turt reports that the driver is not thread safe and may have
exploitable races.

Note that the proto device is intended for prototyping and development,
and is not for use on production systems.  From the man page:

SECURITY CONSIDERATIONS
     Because programs have direct access to the hardware, the proto
     driver is inherently insecure.  It is not advisable to use this
     driver on a production machine.

The proto device is not included in any of FreeBSD's kernel config files
(although the module is built).

The issues in the proto device still need to be fixed, and the device is
inherently (and intentionally) insecure, but it might as well be limited
to root only.

admbugs:	782
Reported by:	C Turt <ecturt@gmail.com>
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Ed Maste 2018-11-22 16:55:09 +00:00
parent d343a7f403
commit dc9874eaa0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=340771

View File

@ -196,7 +196,7 @@ proto_attach(device_t dev)
case SYS_RES_MEMORY:
case SYS_RES_IOPORT:
r->r_size = rman_get_size(r->r_d.res);
r->r_u.cdev = make_dev(&proto_devsw, res, 0, 0, 0666,
r->r_u.cdev = make_dev(&proto_devsw, res, 0, 0, 0600,
"proto/%s/%02x.%s", device_get_desc(dev), r->r_rid,
(r->r_type == SYS_RES_IOPORT) ? "io" : "mem");
r->r_u.cdev->si_drv1 = sc;
@ -204,7 +204,7 @@ proto_attach(device_t dev)
break;
case PROTO_RES_PCICFG:
r->r_size = 4096;
r->r_u.cdev = make_dev(&proto_devsw, res, 0, 0, 0666,
r->r_u.cdev = make_dev(&proto_devsw, res, 0, 0, 0600,
"proto/%s/pcicfg", device_get_desc(dev));
r->r_u.cdev->si_drv1 = sc;
r->r_u.cdev->si_drv2 = r;
@ -212,7 +212,7 @@ proto_attach(device_t dev)
case PROTO_RES_BUSDMA:
r->r_d.busdma = proto_busdma_attach(sc);
r->r_size = 0; /* no read(2) nor write(2) */
r->r_u.cdev = make_dev(&proto_devsw, res, 0, 0, 0666,
r->r_u.cdev = make_dev(&proto_devsw, res, 0, 0, 0600,
"proto/%s/busdma", device_get_desc(dev));
r->r_u.cdev->si_drv1 = sc;
r->r_u.cdev->si_drv2 = r;