RFR: 8277489: Rewrite JAAS UnixLoginModule with FFM [v5]

Weijun Wang weijun at openjdk.org
Sat Jan 3 02:30:55 UTC 2026


On Fri, 2 Jan 2026 23:31:49 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:

>> Weijun Wang has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   fail early on Windows, and more comments
>
> src/jdk.security.auth/share/classes/com/sun/security/auth/module/UnixLoginModule.java line 154:
> 
>> 152:         if (ss.getUsername() != null) {
>> 153:             // When getpwuid_r fails, username will not be available.
>> 154:             userPrincipal = new UnixPrincipal(ss.getUsername());
> 
> With this change, the test passes on AIX (though the `getpwuid_r` call does not work as expected).
> @JoKern65, @varada1110: The `getpwuid_r` FFM call doesn't set the `result`. The strange thing is that it works when I call it through a C wrapper (same FFM call):
> 
> #include <pwd.h>
> 
> __attribute__((visibility("default"))) int call_getpwuid_r(int uid, struct passwd *pwd,
>                                              char *buf, size_t buflen, struct passwd **result)
> {
>   return getpwuid_r(uid, pwd, buf, buflen, result);
> }
> 
> Any idea?

I somehow think the `size_t buflen` in-between might be the reason. Are they put on the stack or into registers? Is there an alignment issue here?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/28931#discussion_r2658656686


More information about the build-dev mailing list