lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <36ca99e90906161214u6624014q3f3dc4e234bdf772@mail.gmail.com>
Date:	Tue, 16 Jun 2009 21:14:26 +0200
From:	Bert Wesarg <bert.wesarg@...glemail.com>
To:	Stefani Seibold <stefani@...bold.net>
Cc:	linux-kernel <linux-kernel@...r.kernel.org>,
	linux-mm <linux-mm@...ck.org>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [RFC] set the thread name

Hi,

On Tue, Jun 16, 2009 at 20:39, Stefani Seibold<stefani@...bold.net> wrote:
> Currently it is not easy to identify a thread in linux, because there is
> no thread name like in some other OS.
>
> If there were are thread name then we could extend a kernel segv message
> and the /proc/<pid>/task/<tid>/... entries by a TName value like this:
prctl(PR_SET_NAME, ...) works perfectly here.

Bert

/* -*- c -*- */

#define _GNU_SOURCE
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include <math.h>
#include <pthread.h>
#include <sys/prctl.h>

void *
thread(void *arg)
{
    unsigned long i = (unsigned long)arg;
    char comm[16];
    snprintf(comm, sizeof comm, "task %02lu", i);
    prctl(PR_SET_NAME, comm, 0l, 0l, 0l);

    sleep(10);

    return NULL;
}

int
main(int ac, char *av[])
{
    pthread_t thr;
    unsigned long i, n = 10;
    char comm[16];

    printf("%u\n", getpid());
    sleep(5);
    snprintf(comm, sizeof comm, "master");
    prctl(PR_SET_NAME, comm, 0l, 0l, 0l);
    sleep(5);

    for (i = 0; i < n; i++)
        pthread_create(&thr, NULL, thread, (void *)i);

    pthread_join(thr, NULL);

    return 0;
}

>
> Greetings,
> Stefani
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ