Bug 10166 - grantpt() does can not be used for devpts
Summary: grantpt() does can not be used for devpts
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.10
: P2 normal
Target Milestone: ---
Assignee: Ulrich Drepper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-18 04:01 UTC by Wei Yongjun
Modified: 2014-07-01 20:29 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments
patch for glibc (316 bytes, patch)
2009-05-18 04:03 UTC, Wei Yongjun
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wei Yongjun 2009-05-18 04:01:37 UTC
On my Fedora11Beta box, the grantpt() does can not be used for devpts.
In RHEL system, the /etc/fstab has this configure, it has no problem.
  devpts /dev/pts devpts gid=5,mode=620 0 0
But in Fedora11Beta this line changed to:
  devpts /dev/pts devpts defaults 0 0

I looked into the kernel source, the mode of devpts has the default value of 
600, not 620. So, does not change the mode of devpts is not correct.

This is found by LTP - testcases/kernel/pty/pty01.c
Comment 1 Wei Yongjun 2009-05-18 04:03:33 UTC
Created attachment 3942 [details]
patch for glibc
Comment 2 Wei Yongjun 2009-06-05 08:16:48 UTC
I had look the manpage of grantpt():

#man 3 grantpt

DESCRIPTION
       The grantpt() function changes the mode and owner of the slave
pseudo-terminal device (pty) corresponding to the master pty referred
to by fd.  The user ID of the slave is set to the real UID of the
calling process.  The group ID is set to an unspecified value (e.g.
tty).  The mode of the slave is set to 0620 (crw--w----).

So there is no reason for glibc does not change the mode of devpts,
since the default mode of devpts is 600. Isn't it?
Comment 3 Ulrich Drepper 2009-06-16 05:59:32 UTC
The patch is hurting correctly configured systems.  I've checked in a different
patch.