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: <CAHVum0fEVEtC-pLrKO3VJkPy0uqPa5WfeYQrTB=9Hk2Z8jV3fw@mail.gmail.com>
Date:   Fri, 21 Oct 2022 15:34:02 -0700
From:   Vipin Sharma <vipinsh@...gle.com>
To:     Wei Wang <wei.w.wang@...el.com>
Cc:     seanjc@...gle.com, pbonzini@...hat.com, dmatlack@...gle.com,
        kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] KVM: selftests: name the threads

On Mon, Oct 17, 2022 at 9:25 AM Wei Wang <wei.w.wang@...el.com> wrote:
> diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
> index f1cb1627161f..c252c912f1ba 100644
> --- a/tools/testing/selftests/kvm/lib/kvm_util.c
> +++ b/tools/testing/selftests/kvm/lib/kvm_util.c
> @@ -2021,3 +2021,50 @@ void __vm_get_stat(struct kvm_vm *vm, const char *stat_name, uint64_t *data,
>                 break;
>         }
>  }
> +
> +/*
> + * Create a named thread
> + *
> + * Input Args:
> + *   attr - the attributes for the new thread
> + *   start_routine - the routine to run in the thread context
> + *   arg - the argument passed to start_routine
> + *   name - the name of the thread
> + *
> + * Output Args:
> + *   thread - the thread to be created
> + *
> + * Create a thread with user specified name.
> + */
> +void pthread_create_with_name(pthread_t *thread, const pthread_attr_t *attr,
> +                       void *(*start_routine)(void *), void *arg, char *name)
> +{
> +       int r;
> +
> +       r = pthread_create(thread, attr, start_routine, arg);
> +       TEST_ASSERT(!r, "thread(%s) creation failed, r = %d", name, r);
> +       pthread_setname_np(*thread, name);

Since pthread_setname_np() expects "name" to be 16 chars including \0,
maybe a strnlen(name, 16) check before it will be useful.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ