For a DN_SCH object copy_obj() writes the whole struct dn_schk (192
bytes on amd64) into the listing buffer, but checks and advances by
o.len, which is sizeof(struct dn_sch) (92 bytes). The extra bytes,
kernel pointers included, overrun the buffer when the scheduler is
near its end. "ipfw pipe show" or "dnctl pipe show" is enough, from
the host or from a VNET jail; KASAN reports a 192-byte write in
copy_obj().
Copy only the struct dn_sch, as the code did before 0ac43d9728a7.
Add a test that lists pipes and schedulers from a VNET jail.
PR: 224485
Reported by: david@catwhisker.org
Fixes: 0ac43d9728a7 ("In dummynet(4), random chunks of memory are casted to struct dn_*,")
Sponsored by: Advanced Micro Devices, Inc.
Signed-off-by: Osvaldo Janeri Filho <ojanerif@amd.com>