From owner-freebsd-hackers@freebsd.org Tue Apr 3 21:17:44 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 3974CF814ED for ; Tue, 3 Apr 2018 21:17:44 +0000 (UTC) (envelope-from mashtizadeh@gmail.com) Received: from mail-oi0-x244.google.com (mail-oi0-x244.google.com [IPv6:2607:f8b0:4003:c06::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C051A753E4; Tue, 3 Apr 2018 21:17:43 +0000 (UTC) (envelope-from mashtizadeh@gmail.com) Received: by mail-oi0-x244.google.com with SMTP id u84-v6so17322950oie.10; Tue, 03 Apr 2018 14:17:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=cCnqh2/CexMKar2BVFOXYEQ9wQxVhfrtsFpMsgJKpxI=; b=Wp9XDyoeBWc3gZ1nPfnrIGlSQMiU6YEhtwEIzDPynYikv07PpJLab/58e5/SMQtN7C AGoO0QBpTKHwUKv+ZMEuKk5hNq2M7RC6fbTlW0lRmChzeSRkIhDqb77zKuupBilYMjhX 1h1BieD32F4rdJ0vhYqs9XWiBty5X9n5QL/PWhcPcGJzLS399dEZwJjYXK5tC4XwDvE8 USWYH+9yCmmGbFGjpzaPHWSSdZJDd7I+pj+ecwdlXO28tvlQwMuqeH7T/7eJ7fpBsfF6 Y4RlebCKYD0OHevXd2hOxJogOhVB+YhSeYErlccK8BvzM54+dHZaVnZEsaOww4ybKaGV U89A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=cCnqh2/CexMKar2BVFOXYEQ9wQxVhfrtsFpMsgJKpxI=; b=dUweIzjamI4aH8pokQ02LaeBS4PYcH4h/93Fwu2xdSz3TBqVwoz3kCGPk6XDXzYfoT GnDb2r6mCdzK50QfRLpYYqwxy7EG+QGcB8pLqH5pZz2cFKwi0HTs6N7Mo4363sdWIHRj SZGO1bqitPmQQ7gS07g+lyLKG554+NZAbYtk8CtCLjMOFvJZJHlU12DLi5MSVwNKBsx3 qA7hjB5aK3sAfLjo3Z9wHJ4d2+zuPMXP5dcAHvWZ7vTJO6ryEeGMdougY/KO5GQmlQvA VtytG59pd+3Cbi8ChWNacDbhtaqx1o4yagaslWtFLBDKBpo9wCWlpAoUDvXka3k4pyHe czmw== X-Gm-Message-State: ALQs6tB5idojqg8ysHZNG8BI2GFnEY03oxRSFcyEPKBZuKsj946l8Jq/ 3VZvtG9vOhgglE5MsBP4Pau8SELovE4pBjuXnoo= X-Google-Smtp-Source: AIpwx4+nvz2fJuwwKOPmX+ILbD5B/36ykT0dy3fccn5U/cytjXBsRSMGydPiIE9+whubvGDV5erAmKWKpBdnEXT0wfg= X-Received: by 2002:aca:e043:: with SMTP id x64-v6mr8076191oig.164.1522790263081; Tue, 03 Apr 2018 14:17:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.208.19 with HTTP; Tue, 3 Apr 2018 14:17:42 -0700 (PDT) In-Reply-To: <20180403170721.GC8598@spindle.one-eyed-alien.net> References: <20180403170721.GC8598@spindle.one-eyed-alien.net> From: Ali Mashtizadeh Date: Tue, 3 Apr 2018 17:17:42 -0400 Message-ID: Subject: Re: getlogin caching and setlogin issues To: Brooks Davis Cc: FreeBSD Hackers , Ali Mashtizadeh Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 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 21:17:44 -0000 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 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