Handle returnValue and add rc/rsn to socket trace - #548
Open
1000TurquoisePogs wants to merge 3 commits into
Open
Handle returnValue and add rc/rsn to socket trace#5481000TurquoisePogs wants to merge 3 commits into
1000TurquoisePogs wants to merge 3 commits into
Conversation
Signed-off-by: 1000TurquoisePogs <sgrady@rocketsoftware.com>
|
The socket trace claimed to print the hostent address but printed *((int*)hostEntPtr) -- the first four bytes of the struct, which is half of its name pointer, under a label saying otherwise. On z/OS that is the high half, so for storage below the bar it printed zero whether the lookup succeeded or failed. Anyone who switched socketTrace on to diagnose a resolution problem was reading a number that meant nothing. %p prints what the label promises and does not follow the pointer, which also removes a dereference that ran before anything established the pointer was usable. hostEntPtr is now initialised. BPXGHN leaves Hostent_ptr alone when the lookup fails, so it held whatever the stack contained; getV4HostEntByName returns it directly, so callers were handed that. Verified with MemorySanitizer against the real function: staging reports use-of-uninitialized-value on a failed lookup with tracing off and on, and neither reports it after this change. Signed-off-by: JoeNemo <joe.devlin@gmail.com>
hostent->length is the width of one address -- 4 for IPv4 -- not how many addresses came back, so using it as a loop bound reads up to four entries regardless of how many exist. AddressSanitizer reports a stack-buffer-overflow on a host that resolves to an empty list: the array holds only its terminator and the loop reads three entries past it. addrList is null-terminated, so the terminator is the bound. Selecting the first address is unchanged: verified identical for one address, several addresses, an empty list, and a list whose first non-null entry is late. The trace now prints the address that was found, dotted-quad and hex, rather than the pointer holding it -- which is what someone turning socketTrace on to diagnose a lookup wants to see. It walks the whole list, since knowing a name resolved to more than one address is part of the diagnosis. Dropped an unused local. Signed-off-by: JoeNemo <joe.devlin@gmail.com>
JoeNemo
force-pushed
the
feature/ipv4-get-host-by-name
branch
from
August 8, 2026 06:26
c7eb6d3 to
ec65753
Compare
|
JoeNemo
reviewed
Aug 8, 2026
JoeNemo
left a comment
Contributor
There was a problem hiding this comment.
I don't think this code is called. But your intent for this PR was valid and I can't remove a public API mid-release. But I needed to do some fixes for things that were latent memory errors, not introduced by your change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




To trace zowe/zss#794, I need to see rc/rsn that aren't handled thus far.
This PR prints them in socketTrace
But also, I saw the TBD message about that none of them are even inspected. I added handling of returnValue.