mirror of
https://github.com/openbsd/xenocara.git
synced 2025-12-17 22:59:30 +00:00
Release unused filedescriptors in the privileged X server process.
There is no reason to keep /dev/pci* and /dev/ttyC* open in this process. pointed to by deraadt. ok kettenis@ deraadt@
This commit is contained in:
@@ -375,6 +375,13 @@ OsVendorInit(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef X_PRIVSEP
|
||||||
|
void
|
||||||
|
priv_vendor_init(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
KdCardFuncs ephyrFuncs = {
|
KdCardFuncs ephyrFuncs = {
|
||||||
ephyrCardInit, /* cardinit */
|
ephyrCardInit, /* cardinit */
|
||||||
ephyrScreenInitialize, /* scrinit */
|
ephyrScreenInitialize, /* scrinit */
|
||||||
|
|||||||
@@ -219,6 +219,13 @@ OsVendorInit(void)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef X_PRIVSEP
|
||||||
|
void
|
||||||
|
priv_vendor_init(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
OsVendorFatalError(const char *f, va_list args)
|
OsVendorFatalError(const char *f, va_list args)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -820,4 +820,15 @@ xf86DropPriv(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Called in the privileged child
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
priv_vendor_init(void)
|
||||||
|
{
|
||||||
|
/* release resources it won't need */
|
||||||
|
pci_system_cleanup();
|
||||||
|
close(xf86Info.consoleFd);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -156,6 +156,14 @@ OsVendorInit(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef X_PRIVSEP
|
||||||
|
void
|
||||||
|
priv_vendor_init(void)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
OsVendorFatalError(const char *f, va_list args)
|
OsVendorFatalError(const char *f, va_list args)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -314,6 +314,8 @@ extern _X_EXPORT int
|
|||||||
ChownLock(uid_t, gid_t);
|
ChownLock(uid_t, gid_t);
|
||||||
extern _X_EXPORT int
|
extern _X_EXPORT int
|
||||||
priv_open_device(const char *);
|
priv_open_device(const char *);
|
||||||
|
extern _X_EXPORT void
|
||||||
|
priv_vendor_init(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern _X_EXPORT int
|
extern _X_EXPORT int
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: privsep.c,v 1.31 2019/06/11 14:51:34 jcs Exp $ */
|
/* $OpenBSD: privsep.c,v 1.32 2020/04/20 18:17:26 matthieu Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright 2001 Niels Provos <provos@citi.umich.edu>
|
* Copyright 2001 Niels Provos <provos@citi.umich.edu>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@@ -279,6 +279,7 @@ priv_init(uid_t uid, gid_t gid)
|
|||||||
signal(i, SIG_DFL);
|
signal(i, SIG_DFL);
|
||||||
setproctitle("[priv]");
|
setproctitle("[priv]");
|
||||||
close(socks[1]);
|
close(socks[1]);
|
||||||
|
priv_vendor_init();
|
||||||
|
|
||||||
for (dev = allowed_devices; dev->name != NULL; dev++) {
|
for (dev = allowed_devices; dev->name != NULL; dev++) {
|
||||||
if (unveil(dev->name, "rw") == -1)
|
if (unveil(dev->name, "rw") == -1)
|
||||||
|
|||||||
Reference in New Issue
Block a user