getlogin caching and setlogin issues

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

getlogin caching and setlogin issues

Brooks Davis-2
[Ali found this issue while looking at pulling syscalls out of libc.]

getlogin() is a wrapper around _getlogin() which caches the value
returned and sets a and internal _logname_valid flag.  Some
implementations of setlogin() clear that flag on return, the arm, mips,
and riscv ones use the default assembly and do not.  This leaves me two
questions:

1) Does this cache make sense?  Sure login rarely changes, but is
getlogin called frequently in real software?

2) If the cache makes sense, does clearing the cache belong in
__sys_setlogin() or should it be done in a C wrapper in setlogin() or
_setlogin()?  I think it should likely be pulled up to _setlogin().

3) If yes to 1 and no to 2, do we need to fix arm, mips, and riscv?

-- Brooks

signature.asc (465 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: getlogin caching and setlogin issues

Ali Mashtizadeh
In addition, I couldn't find a reason for sigreturn() to be custom assembly
in i386/amd64/arm/aarch64.

Best,
Ali

On Tue, Apr 3, 2018 at 1:07 PM, Brooks Davis <[hidden email]> wrote:

> [Ali found this issue while looking at pulling syscalls out of libc.]
>
> getlogin() is a wrapper around _getlogin() which caches the value
> returned and sets a and internal _logname_valid flag.  Some
> implementations of setlogin() clear that flag on return, the arm, mips,
> and riscv ones use the default assembly and do not.  This leaves me two
> questions:
>
> 1) Does this cache make sense?  Sure login rarely changes, but is
> getlogin called frequently in real software?
>
> 2) If the cache makes sense, does clearing the cache belong in
> __sys_setlogin() or should it be done in a C wrapper in setlogin() or
> _setlogin()?  I think it should likely be pulled up to _setlogin().
>
> 3) If yes to 1 and no to 2, do we need to fix arm, mips, and riscv?
>
> -- Brooks
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: getlogin caching and setlogin issues

Brooks Davis-2
On Tue, Apr 03, 2018 at 05:17:42PM -0400, Ali Mashtizadeh wrote:
> In addition, I couldn't find a reason for sigreturn() to be custom assembly
> in i386/amd64/arm/aarch64.

See https://reviews.freebsd.org/D14953

-- Brooks

signature.asc (465 bytes) Download Attachment