lkml.org 
[lkml]   [2016]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: Does anyone care about a race free ptsname?
    "H. Peter Anvin" <hpa@zytor.com> writes:

    > We could add another ioctl for that purpose of we need to. Perhaps an
    > ioctl which returns a file descriptor to the slave device?
    >
    > However, since we are now defining ptmx to explicitly look up pts/ by
    > name it seems like /dev/ptmx -> /dev/pts/# is true by definition. If
    > what you worry about is namespace reshuffling then ptsname() is the
    > wrong interface in the first place since it returns a pathname.

    Good point. Yes if we are not using devpts_mnt (hooray!) there should
    be no complications, and the largest check we would need is to verify
    that /dev/ptmx is in the current namespace.

    > Fwiw, in klibc ptsname() is basically just an sprintf().

    The challenge came in operations such as granpt. Where you are passed
    in a ptmx file descriptor from who knows where, and you pass it on
    to applications such as pt_chown which run with elevatated privileged.

    As the information is available of where devpts is mounted in
    relationship to /dev/ptmx I have no more concerns about implementing
    ptsname. Path pased is also sufficiently backwards compatible it would
    not usually be wrong even on existing kernels.

    Good enough.

    Eric

    \
     
     \ /
      Last update: 2016-04-19 23:01    [W:4.112 / U:0.020 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site