Fix linprocfs(4) /proc/self/mem semantics to more closely match Linux.

Steam's Anti-Cheat might depend on it.

PR:		248223
Analyzed by:	Alex S <iwtcex@gmail.com>
Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D26816
This commit is contained in:
Edward Tomasz Napierala 2020-10-20 17:24:29 +00:00
parent 1a34e9fad6
commit 91bc73618d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=366900

View File

@ -1275,6 +1275,27 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
return (error);
}
/*
* Filler function for proc/pid/mem
*/
static int
linprocfs_doprocmem(PFS_FILL_ARGS)
{
ssize_t resid;
int error;
resid = uio->uio_resid;
error = procfs_doprocmem(PFS_FILL_ARGNAMES);
if (uio->uio_rw == UIO_READ && resid != uio->uio_resid)
return (0);
if (error == EFAULT)
error = EIO;
return (error);
}
/*
* Criteria for interface name translation
*/
@ -1853,7 +1874,7 @@ linprocfs_init(PFS_INIT_ARGS)
NULL, &procfs_notsystem, NULL, 0);
pfs_create_file(dir, "maps", &linprocfs_doprocmaps,
NULL, NULL, NULL, PFS_RD);
pfs_create_file(dir, "mem", &procfs_doprocmem,
pfs_create_file(dir, "mem", &linprocfs_doprocmem,
procfs_attr_rw, &procfs_candebug, NULL, PFS_RDWR | PFS_RAW);
pfs_create_file(dir, "mounts", &linprocfs_domtab,
NULL, NULL, NULL, PFS_RD);