NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/60830: Linux emulation: prctl(PR_SET_NAME) fails



>Number:         60830
>Category:       kern
>Synopsis:       Linux emulation: prctl(PR_SET_NAME) fails
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 30 17:15:00 +0000 2026
>Originator:     Thomas Klausner
>Release:        NetBSD 11.99.8
>Organization:
	
>Environment:
	
	
Architecture: x86_64
Machine: amd64
>Description:
prctl(PR_SET_NAME) reliably fails.
>How-To-Repeat:
Compile this program on a Linux system, or using pkgsrc/emulators/suse15_gcc12:

--- begin prctl.c ---
#include <linux/prctl.h>
#include <sys/prctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

#define NAME "name"
int main() {
  char buf[16];
  if (prctl(PR_SET_NAME, NAME) != 0) {
    fprintf(stderr, "prctl PR_SET_NAME error: %s\n", strerror(errno));
    exit(1);
  }
  buf[0] = 0;
  if (prctl(PR_GET_NAME, buf) != 0) {
    fprintf(stderr, "prctl PR_GET_NAME error: %s\n", strerror(errno));
    exit(1);
  }
  if (strcmp(NAME, buf) == 0) {
    printf("OK\n");
    exit(0);
  } else {
    printf("name comparison error: '%s' != '%s'\n", NAME, buf);
    exit(1);
  }
}
--- end prctl.c ---

and run it. It should print:

OK

(tested on Debian 12.15) but instead prints

prctl PR_SET_NAME error: No such process


>Fix:
Please.

>Unformatted:
 	
 	



Home | Main Index | Thread Index | Old Index