Bug 31122

Summary: linux setre*uid() doesn't handle uid -1 properly
Product: Base System Reporter: SANETO Takanori <sanewo>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 5.0-CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description SANETO Takanori 2001-10-08 04:50:01 UTC
Although manpage of setre*uid() says that "Passing -1 as an argument causes the corresponding value to remain
     unchanged," under linux ABI, they are
treated as if 65535 was specified. (Maybe this is i386 specific)
Because of this, vmware won't start up on CURRENT.

Fix: Following patch should fix the problem. Yes, it's a quick hack.
How-To-Repeat: Compile following program in linux environment and run it as root.
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

void
printid()
{
  printf("ruid=%d, euid=%d\n", getuid(), geteuid());
}

int
main(int ac, char **av)
{
  printid();
  if (setreuid(-1,-1) < 0) { perror("setreuid"); exit(1); }
  printid();
}
Comment 1 Marcel Moolenaar freebsd_committer freebsd_triage 2001-10-14 06:48:05 UTC
State Changed
From-To: open->closed

Fixed. Thanks!