Page MenuHomeFreeBSD

rtld-elf: report cause of failure to load the hints file
AbandonedPublic

Authored by se on Feb 25 2024, 5:04 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 14, 10:03 AM
Unknown Object (File)
Thu, Nov 14, 9:11 AM
Unknown Object (File)
Thu, Nov 14, 9:03 AM
Unknown Object (File)
Thu, Nov 14, 8:10 AM
Unknown Object (File)
Wed, Nov 13, 12:53 AM
Unknown Object (File)
Mon, Nov 11, 3:23 PM
Unknown Object (File)
Mon, Nov 11, 10:09 AM
Unknown Object (File)
Mon, Nov 11, 9:48 AM

Details

Reviewers
kib
Summary

A comment to the changes in review D44053 suggested to add specific debug messages for the causes of a failure to load the hints file.
Since these extended debug messages are independent of the the proposed changes in D44053, they have been extracted from that review.
Debug messages are enabled at run time by setting LD_DEBUG to a non-empty string (unless rtld-elf has been compiled with -D NO_LD_DEBUG).

Test Plan

Verify that ld-elf.so.1 can be built with this patch applied and that it is functional.
It is possible to trigger each of the messages by removal, truncation, or modification of the hints file.
Check that the messages correspond to the respective error situations and assess whether each particular message is useful.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

se requested review of this revision.Feb 25 2024, 5:04 PM
kib added inline comments.
libexec/rtld-elf/rtld.c
2102

You could use %#08x, as format specifier, then it is obvious for reader that magic numbers are hex.

This revision is now accepted and ready to land.Feb 25 2024, 8:41 PM

Building in the source directory had worked, but some type casts are required to make some dbg() calls compile during make world.

This revision now requires review to proceed.Feb 25 2024, 9:40 PM

Please upload the full context for the diff (git diff -U99999999 ...)

libexec/rtld-elf/rtld.c
2135

this is usually and better handled with "%jx" and cast to uintmax_t

domagoj.stolfa_gmail.com added inline comments.
libexec/rtld-elf/rtld.c
2111

This should probably say "... list is too long: ..." as opposed to "list to long"

Updated according to review comments.

se marked 3 inline comments as done.Feb 26 2024, 9:57 PM
se added inline comments.
libexec/rtld-elf/rtld.c
2102

I'll change the format as suggested.

2135

I had to change the format to %lld and add a cast to get this statement to compile as part of make world. I did not try a make universe with this change.

This revision is now accepted and ready to land.Feb 26 2024, 10:11 PM
se marked an inline comment as done.

This patch has been accepted as part of review D44053 and has been committed with modified variable names as part of commit 7b77d37a561b4.