From owner-freebsd-hackers@freebsd.org Tue Apr 3 17:07:23 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 083DBF6F03F for ; Tue, 3 Apr 2018 17:07:23 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A5610877FC for ; Tue, 3 Apr 2018 17:07:22 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id EC37B5A9F16; Tue, 3 Apr 2018 17:07:21 +0000 (UTC) Date: Tue, 3 Apr 2018 17:07:21 +0000 From: Brooks Davis To: freebsd-hackers@freebsd.org Cc: Ali Mashtizadeh Subject: getlogin caching and setlogin issues Message-ID: <20180403170721.GC8598@spindle.one-eyed-alien.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0lnxQi9hkpPO77W3" Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 17:07:23 -0000 --0lnxQi9hkpPO77W3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline [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 --0lnxQi9hkpPO77W3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJaw7TJAAoJEKzQXbSebgfA15QIAJnsY3P/nd+neY81bWVkAgO1 qUe02VlNXzYughKlT+nqFZ0JsztXN/BprvemrPiJ+lYZNlw3tHzNIZTFxAEDWtMK malwWwY52AphcWt/wRbJVkqSXd8VStEHc9ozql7TIIKLmQzPvfUbDiKxDmeniQMC VaVGF6NtVMsHL7j2x+aU209gbYMP8mDnh3cEn9d5tzo9ZmeGrJj5R3m5DhP6+5nw s94vorII3naIceP4//thQV9B5mZlI5ro9OX8/lPu5nfoWym5aMFHlKgswaXnjbVY UvbxUzwmXnuJKb+hEZupwvKoBi8kIDPoQal1yjmvBFKuMgRvbOz/uKErc5hOTDY= =crVp -----END PGP SIGNATURE----- --0lnxQi9hkpPO77W3--