From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FE5CC433E3 for ; Sun, 26 Jul 2020 23:54:40 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8354D206E3 for ; Sun, 26 Jul 2020 23:54:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b="UN2ye0Jf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8354D206E3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BFKY73r3BzF0jr for ; Mon, 27 Jul 2020 09:54:35 +1000 (AEST) Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4BFKW51ql1zDrfL for ; Mon, 27 Jul 2020 09:52:49 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=UN2ye0Jf; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4BFKW26sjVz9sPf; Mon, 27 Jul 2020 09:52:46 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1595807567; bh=L3FrdqrfMnrXhYTMcd7BexhcWG0EvYoKRz9hDNG6rVI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=UN2ye0Jf0n18emMA7+kSp+LWqVW79yByxgkKGqAMuFwmnV7XoRx1emjnW765QaqSl YmZJY+Lrf5jtBJRYP7TULXQR+Be6DiBiXe154BNearwT+uZZOtKMLyS81ZXkJEgtjD tr9GBocaWR4HPor1tLm5EUFnhOC3yy2csH3BAki5kg2zRI6UgIiXN99fs7ZUNXeW2j URB0DEGSjFYn+WY+XGvKTgDJEBVz1xCj/iWZzY6hKtMRMsjNawnNG7gI558V3EDXA5 PHBoXVCRzN2nT2IL2x97AkmrOIgmRUv1AssBWylsmJprfbgV1+7iz1ob7lIBOiYqJO W81yfgga8Wdcg== From: Michael Ellerman To: Christophe Leroy Subject: Re: [PATCH 5/5] selftests/powerpc: Add test for pkey siginfo verification In-Reply-To: <20200726164009.Horde.J2bKDAPkYDkRMsx2Qnk8OQ8@messagerie.si.c-s.fr> References: <87365egymc.fsf@mpe.ellerman.id.au> <20200726164009.Horde.J2bKDAPkYDkRMsx2Qnk8OQ8@messagerie.si.c-s.fr> Date: Mon, 27 Jul 2020 09:52:42 +1000 Message-ID: <87zh7lg7g5.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fweimer@redhat.com, aneesh.kumar@linux.ibm.com, linuxram@us.ibm.com, Sandipan Das , linuxppc-dev@lists.ozlabs.org, bauerman@linux.ibm.com Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Christophe Leroy writes: > Michael Ellerman a =C3=A9crit=C2=A0: >> Sandipan Das writes: >>> diff --git a/tools/testing/selftests/powerpc/mm/pkey_siginfo.c=20=20 >>> b/tools/testing/selftests/powerpc/mm/pkey_siginfo.c >>> new file mode 100644 >>> index 0000000000000..58605c53d495d >>> --- /dev/null >>> +++ b/tools/testing/selftests/powerpc/mm/pkey_siginfo.c >>> @@ -0,0 +1,332 @@ >> ... >>> + >>> +static void *protect(void *p) >>> +{ >>> + unsigned long rights; >>> + unsigned int *base; >>> + size_t size; >>> + int tid, i; >>> + >>> + tid =3D gettid(); >> >> pkey_siginfo.c: In function 'protect': >> pkey_siginfo.c:103:8: error: implicit declaration of function=20=20 >> 'gettid' [-Werror=3Dimplicit-function-declaration] >> tid =3D gettid(); >> ^ >> >> >> On Ubuntu 18.04 at least. > > See https://man7.org/linux/man-pages/man2/gettid.2.html > > Added in glibc 2.30 Thanks, this seems to work: diff --git a/tools/testing/selftests/powerpc/include/utils.h b/tools/testin= g/selftests/powerpc/include/utils.h index 69d16875802d..71d2924f5b8b 100644 --- a/tools/testing/selftests/powerpc/include/utils.h +++ b/tools/testing/selftests/powerpc/include/utils.h @@ -42,6 +42,16 @@ int perf_event_enable(int fd); int perf_event_disable(int fd); int perf_event_reset(int fd); =20 +#if !defined(__GLIBC_PREREQ) || !__GLIBC_PREREQ(2, 30) +#include +#include + +static inline pid_t gettid(void) +{ + return syscall(SYS_gettid); +} +#endif + static inline bool have_hwcap(unsigned long ftr) { return ((unsigned long)get_auxv_entry(AT_HWCAP) & ftr) =3D=3D ftr; cheers