Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

procstat auxv improvements #1890

Merged
merged 7 commits into from
Oct 16, 2023
Merged

procstat auxv improvements #1890

merged 7 commits into from
Oct 16, 2023

Conversation

brooksdavis
Copy link
Member

Add support for printing auxv arguments as capabilities. Along the way make some fixes to the 32-bit compat code, fix support for hybrid ABIs, and improve the readability of output with wide commands.

usr.bin/procstat/procstat_auxv.c Show resolved Hide resolved
usr.bin/procstat/procstat_auxv.c Show resolved Hide resolved
usr.bin/procstat/procstat_auxv.c Outdated Show resolved Hide resolved
usr.bin/procstat/procstat_auxv.c Outdated Show resolved Hide resolved
usr.bin/procstat/procstat_auxv.c Show resolved Hide resolved
lib/libprocstat/libprocstat.c Outdated Show resolved Hide resolved
lib/libprocstat/libprocstat.c Outdated Show resolved Hide resolved
usr.bin/procstat/procstat_auxv.c Show resolved Hide resolved
usr.bin/procstat/procstat_auxv.c Outdated Show resolved Hide resolved
usr.bin/procstat/procstat_auxv.c Outdated Show resolved Hide resolved
@brooksdavis brooksdavis force-pushed the procstat-auxv-improvements branch 2 times, most recently from f3447cc to d287148 Compare October 9, 2023 21:19
Copy link
Contributor

@markjdb markjdb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we update the procstat.1 man page as well?

lib/libprocstat/libprocstat.c Outdated Show resolved Hide resolved
auxv[i].a_un.a_val = *((uint32_t *)ptr);
/*
* Don't sign extend values. Existing entries are positive
* intergers or pointers. Under freebsd32, programs typically
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/intergers/integers/

brooksdavis and others added 7 commits October 16, 2023 18:06
Avoid a weird dance through the union and treat all 32-bit values as
unsigned integers.  This avoids sign extension of flags and userspace
pointers.

Reviewed by:	markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42198

(cherry picked from commit 9735cc0)
Making this variable static makes is_elf32_sysctl() and callers thread
unsafe.

Use a less absurd length for sv_name.  The longest name in the system is
"FreeBSD ELF64 V2" which tips the scales at 16+1 bytes.  We'll almost
certainly have other problems if we exceed 32 characters.

Reviewed by:	markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42199

(cherry picked from commit 72a4ee2)
Use source struct size not the destination struct size so we copy all
the auxv entries, not just the first half of them.

Fix a style issue on an adjacent line.

Reviewed by:	markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42200

(cherry picked from commit 8f06fab)
Include support for translating 32-bit auxv vectors on non-64-bit
platforms that aren't riscv (which has no 32-bit ABI support and
probably never will).

Reviewed by:	markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42201

(cherry picked from commit 248fe3d)
For reasons unknown, procstat subcommands typically display the command
in a 16+overflow column format.  However, the command may be up to
MAXCOMLEN (19) characters long causing the column to spill into the next
one. Since there's plenty of room in the auxv case, bump the column
width up to 19 to avoid this issue.  While this is a format change 1)
users who want to parse the data should use libxo output and 2) this
makes it possible to parse reliably with cut.

Reviewed by:	markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42202

(cherry picked from commit 8f9f7b4)
As with 32-bit compat, support hybrid auxv vectors in CheriABI procstat.
For ELF auxargs that are pointers, print more capability information
in verbose mode.
@brooksdavis brooksdavis merged commit c501b20 into dev Oct 16, 2023
27 checks passed
@brooksdavis brooksdavis deleted the procstat-auxv-improvements branch October 16, 2023 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants