mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-29 12:44:53 +01:00
Change procfs_lookup to not allow delete/rename operations
to prevent panics when a user tries to remove/rename the contents of /proc/###/*. Obtained from: 4.4BSD-lite2
This commit is contained in:
parent
2f44cdc7e1
commit
325b318783
@ -36,7 +36,7 @@
|
||||
*
|
||||
* @(#)procfs_vnops.c 8.6 (Berkeley) 2/7/94
|
||||
*
|
||||
* $Id: procfs_vnops.c,v 1.14 1995/05/30 08:07:13 rgrimes Exp $
|
||||
* $Id: procfs_vnops.c,v 1.15 1995/08/11 07:26:26 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -536,6 +536,11 @@ procfs_lookup(ap)
|
||||
pfstype pfs_type;
|
||||
int i;
|
||||
|
||||
*vpp = NULL;
|
||||
|
||||
if (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)
|
||||
return (EROFS);
|
||||
|
||||
if (cnp->cn_namelen == 1 && *pname == '.') {
|
||||
*vpp = dvp;
|
||||
VREF(dvp);
|
||||
@ -543,8 +548,6 @@ procfs_lookup(ap)
|
||||
return (0);
|
||||
}
|
||||
|
||||
*vpp = NULL;
|
||||
|
||||
pfs = VTOPFS(dvp);
|
||||
switch (pfs->pfs_type) {
|
||||
case Proot:
|
||||
|
@ -36,7 +36,7 @@
|
||||
*
|
||||
* @(#)procfs_vnops.c 8.6 (Berkeley) 2/7/94
|
||||
*
|
||||
* $Id: procfs_vnops.c,v 1.14 1995/05/30 08:07:13 rgrimes Exp $
|
||||
* $Id: procfs_vnops.c,v 1.15 1995/08/11 07:26:26 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -536,6 +536,11 @@ procfs_lookup(ap)
|
||||
pfstype pfs_type;
|
||||
int i;
|
||||
|
||||
*vpp = NULL;
|
||||
|
||||
if (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)
|
||||
return (EROFS);
|
||||
|
||||
if (cnp->cn_namelen == 1 && *pname == '.') {
|
||||
*vpp = dvp;
|
||||
VREF(dvp);
|
||||
@ -543,8 +548,6 @@ procfs_lookup(ap)
|
||||
return (0);
|
||||
}
|
||||
|
||||
*vpp = NULL;
|
||||
|
||||
pfs = VTOPFS(dvp);
|
||||
switch (pfs->pfs_type) {
|
||||
case Proot:
|
||||
|
Loading…
Reference in New Issue
Block a user