Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 35163

Summary: konsole_grantpty error message when opening any KDE konsoles
Product: Gentoo Security Reporter: Surakshan Mendis <bug.tracker>
Component: VulnerabilitiesAssignee: Gentoo KDE team <kde>
Status: VERIFIED LATER    
Severity: normal CC: greg_g
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Surakshan Mendis 2003-12-05 17:06:49 UTC
KDE version: 3.1.4
Gentoo: Stage 2 install
Kernel: 2.6.0test11
KDE started by typing "startx"

if I open a Konsole (or a console from a console) I get the following error
printed on the "virtual terminal" startx was called from or the konsole from
which the new konsole was called from.

EG: opening a konsole from a konsole

sura@tux sura $ konsole
konsole: cannot chown /dev/pts/1.
Reason: Operation not permitted
konsole_grantpty: determined a strange device name `/dev/ptmx'.
konsole: chownpty failed for device /dev/pts/1::/dev/pts/1.
       : This means the session can be eavesdroped.
       : Make sure konsole_grantpty is installed in
       : /usr/kde/3.1/bin/ and setuid root.

the new konsole does open... but apparently it can me eavesdroped.

sura@tux sura $ ls -l /usr/kde/3.1/bin/konsole_grantpty
-rwsr-sr-x    1 root     root         6088 Dec  6 16:33
/usr/kde/3.1/bin/konsole_grantpty

suid appears to be set as well!

EVERYTIME I exit the console, the following is printed...

konsole_grantpty: determined a strange device name `/dev/ptmx'.

If it matters when compiling the 2.6.0kernel I have enabled Unix98 PTY support
and a 256 is set as the max PTYs in use --- not sure if this is important here.


Reproducible: Always
Steps to Reproduce:
1. Open Konsole
2. Error printed (in calling console ie virtual console or another Konsole)
3.

Actual Results:  
sura@tux sura $ konsole
konsole: cannot chown /dev/pts/1.
Reason: Operation not permitted
konsole_grantpty: determined a strange device name `/dev/ptmx'.
konsole: chownpty failed for device /dev/pts/1::/dev/pts/1.
       : This means the session can be eavesdroped.
       : Make sure konsole_grantpty is installed in
       : /usr/kde/3.1/bin/ and setuid root.

konsole still opens.. but appears to be a security hazard

Expected Results:  
konsole to open with out errors
Comment 1 Caleb Tennis (RETIRED) gentoo-dev 2003-12-06 05:23:53 UTC
Presumably you don't have devfs installed with the 2.6 kernel?

Konsole is trying to open /dev/pts/1

Did you recompile kde after upgrading to 2.6?
Comment 2 bartron 2003-12-06 15:16:11 UTC
  Without a working devpts `/dev/ptmx' would not be there, but that 
still seems odd...if `openpty()' is used to open the pty pair (default 
on linux/vanilla kde until 3.1.2...don't know about 3.1.4 though), 
glibc should have taken care of calling `grantpt()' on the slave fd 
and `konsole_grantpty' isn't needed (and should not be called).

What are the exact permissions on the pty `konsole_grantpty' is
complaining about?

Do you have a tty group?

What is the output of this test:

===CUT===
/* openpty-test.c
 *
 * gcc -lutil -o openpty-test openpty-test.c
 */
#include <stdio.h>
#include <pty.h>
int main()
{
    int masterfd, slavefd;
    char name[256], buf[256];
    if(openpty(&masterfd, &slavefd, name, NULL, NULL) < 0) {
        perror(NULL); return 1;
    }
    sprintf(buf, "ls -l %s", name); system(buf);
    close(masterfd); close(slavefd);
    return 0;
}
===CUT===
Comment 3 Surakshan Mendis 2003-12-06 18:13:25 UTC
I've just had a hard disk failure, need a new drive :(
Thus I am not able to give you the output of the test script.

devfs is installed in the kernel,
I never upgraded to 2.6, rather I started with 2.6 with the install. then I compiled KDE.

Googling around shows this problem on FreeBSD not really on linux.
Will inform you of results when I reinstall Gentoo
Comment 4 Carsten Lohrke (RETIRED) gentoo-dev 2005-12-25 13:43:32 UTC
Dead old bug left to close...