Date: Mon, 17 May 2021 13:48:19 GMT From: Kristof Provost <kp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: d69cc0401472 - main - pf: Set the pfik_group for userspace Message-ID: <202105171348.14HDmJwE051824@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d69cc040147284c414dfd1c9f498dcc7c8291a8b commit d69cc040147284c414dfd1c9f498dcc7c8291a8b Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2021-05-16 06:50:17 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2021-05-17 11:48:06 +0000 pf: Set the pfik_group for userspace Userspace relies on this pointer to work out if the kif is a group or not. It can't use it for anything else, because it's a pointer to a kernel address. Substitute 0xfeedc0de for 'true', so that we don't leak kernel memory addresses to userspace. PR: 255852 Reviewed by: donner MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30284 --- sys/netpfil/pf/pf_if.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c index 4630098221c8..3c9b53daa28c 100644 --- a/sys/netpfil/pf/pf_if.c +++ b/sys/netpfil/pf/pf_if.c @@ -831,6 +831,14 @@ pf_kkif_to_kif(const struct pfi_kkif *kkif, struct pfi_kif *kif) kif->pfik_flags = kkif->pfik_flags; kif->pfik_tzero = kkif->pfik_tzero; kif->pfik_rulerefs = kkif->pfik_rulerefs; + /* + * Userspace relies on this pointer to decide if this is a group or + * not. We don't want to share the actual pointer, because it's + * useless to userspace and leaks kernel memory layout information. + * So instead we provide 0xfeedcode as 'true' and NULL as 'false'. + */ + kif->pfik_group = + kkif->pfik_group ? (struct ifg_group *)0xfeedc0de : NULL; } void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105171348.14HDmJwE051824>