Workaround for uintptr_t on IBM i? #29320
-
|
We are upgrading from openssl 3.0.18 to 3.5.4 on IBM i 7.5. I have the new version mostly building, however I'm not sure what to do about the usage of uintptr_t and intptr_t in the codebase. These types do not exist on IBM i, because pointers there are 16 bytes and the largest integer type is 8 bytes (and casting between pointers and ints is not encouraged either). I already saw this issue: #22002, but the solution there is specific to nonstop. I guess IBM i is not offically supported or anything, so really I'm just trying to get some advice on my options here. I've seen some places in the code where I can replace the parts that use uintptr with something else, but other places look like I'd have to rewrite substantial portions to not use it. Would replacing it myself be as bad as it sounds? I'm also not an expert on IBM i, I only dabble in it occasionally. If someone knows a workaround for uintptr that would be good too (I didn't find anything online though). I'm also looking into maybe using PASE and gcc to compile it, but I don't know if I could link the resulting libraries to our application it I do that. Any help is appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
According to https://www.ibm.com/docs/en/aix/7.1.0?topic=files-inttypesh-file AIX 7.1 forward should include a definition of uintptr_t. Are you working with an older version of AIX perhaps? Also (bearing in mind I know nothing about i-series space pointers), It seems strange to me that we would be using pointers that fall outside of the usual 8 byte address size. From what I read those pointers need to be declared specially with various #pragmas. In either case, I would do the following:
assuming the pointers are truly 8 bytes wide, not 16 or some such, but I can't guarantee that such pointers are castable, giving the upper 8 bytes holds security and typing information. I'd also note that the use of uintptr_t has been present on ppc builds (which I assume is covered by i-series), and has been in place since openssl 1.1.1 (see commit 8c8fbca), so I would suggest that you look for header definitions of uintptr_t first as it seems you would have encountered this previously, if uintptr_t really didn't exist (it may be that its definition is in a non-standard location, and we just don't have the right includes for that arch). |
Beta Was this translation helpful? Give feedback.
-
|
In ILE environment, this is impossible for a user program to build a 128-bit pointer from an integer alone, because there is a read-only 129th bit somewhere in the system that tells whether a 16-byte paragraph contains a valid pointer or not. Valid 128-bit pointers are opaque structured values that may only be obtained as the result of a computation from another valid pointer or from the system. There is no operation usable from a user mode program to convert an integer alone to a 128-bit pointer, even if some 128-bit integer type existed. Forging the pointer would'nt work either because this clears the valid flag bit. You then can't implement Another solution is using TERASPACE pointers (monotonic 64-bit pointers), but they won't be able to address objects outside of TERASPACE. In addition, not all languages support TERASPACE easily. You can always convert a TERASPACE pointer into a 128-pointer, but a 128-bit pointer can be converted to a 64-bit pointer only if it points to a TERASPACE object. |
Beta Was this translation helpful? Give feedback.
According to https://www.ibm.com/docs/en/aix/7.1.0?topic=files-inttypesh-file
AIX 7.1 forward should include a definition of uintptr_t. Are you working with an older version of AIX perhaps?
Also (bearing in mind I know nothing about i-series space pointers), It seems strange to me that we would be using pointers that fall outside of the usual 8 byte address size. From what I read those pointers need to be declared specially with various #pragmas.
In either case, I would do the following: