HomeFreeBSD

modules: fix freebsd32_modstat on big endian platforms

Description

modules: fix freebsd32_modstat on big endian platforms

The layout of modspecific_t on both little endian and big endian are as
follows:

01234567

+-------+-------+

uintval

+-------+-------+

ulongval

+-------+-------+

For the following code snippet:

CP(mod->data, data32, longval);
CP(mod->data, data32, ulongval);

It only takes care of little endian platforms that it truncates the
highest 32bit automatically. However on big endian platforms it takes
the highest 32bit instead. This eventually returns a garbage syscall
number to the 32bit userland.

Since modspecific_t's usage currently is for the use of syscall modules,
we only initialize modspecific32_t with uintval. Now on both BE and LE
64-bit platforms it always pick up the first 4 bytes.

Sponsored by: Juniper Networks, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D40814
MFC after: 1 week

(cherry picked from commit 034c0856018ccf73c0f2d6140825f3edf43f47b2)

Details

Provenance
khngAuthored on Jul 7 2023, 4:21 AM
Reviewer
markj
Differential Revision
D40814: modules: fix freebsd32_modstat on big endian platforms
Parents
rG254cdd5b2214: Apply build fix for powerpc64-specific llvm-ar and llvm-nm link error
Branches
Unknown
Tags
Unknown