From c2da36fecdd1dcc8a598592a3f606b72376e5d68 Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Tue, 30 Jun 2020 16:24:28 +0000 Subject: [PATCH] Make linprocfs(5) create the /proc//task/ directores. This is to silence down some Chromium assertions. PR: kern/240991 Analyzed by: Alex S MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25256 --- sys/compat/linprocfs/linprocfs.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index c441193a4991..3d6ebf9e5179 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -1619,6 +1619,28 @@ linprocfs_doproclimits(PFS_FILL_ARGS) return (error); } +/* + * The point of the following two functions is to work around + * an assertion in Chromium; see kern/240991 for details. + */ +static int +linprocfs_dotaskattr(PFS_ATTR_ARGS) +{ + + vap->va_nlink = 3; + return (0); +} + +/* + * Filler function for proc//task/.dummy + */ +static int +linprocfs_dotaskdummy(PFS_FILL_ARGS) +{ + + return (0); +} + /* * Filler function for proc/sys/kernel/random/uuid */ @@ -1760,6 +1782,11 @@ linprocfs_init(PFS_INIT_ARGS) pfs_create_file(dir, "limits", &linprocfs_doproclimits, NULL, NULL, NULL, PFS_RD); + /* /proc//task/... */ + dir = pfs_create_dir(dir, "task", linprocfs_dotaskattr, NULL, NULL, 0); + pfs_create_file(dir, ".dummy", &linprocfs_dotaskdummy, + NULL, NULL, NULL, PFS_RD); + /* /proc/scsi/... */ dir = pfs_create_dir(root, "scsi", NULL, NULL, NULL, 0); pfs_create_file(dir, "device_info", &linprocfs_doscsidevinfo,