From nobody Fri May 3 01:49:16 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1622001749; cv=none; d=zohomail.com; s=zohoarc; b=fjrIy4f8PElwn07kLxpQ/pIcztfgIGt8hFjXuG7jZDNR8hDD0IigJK+lpwBpD95+cv9LcgaLgOwfTA+8Bb1UeQ7cskKnzh0y6/bPt5vWkJrll8a0WJAQ942fWcFa9F+MkRUIHIvCPp6jelCUuj/WK13HGtZO+DabAiSRzwTCzAg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622001749; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=cyrGGae3KScjf2+1slxM8e19PZON/gYGwK8TqUwl1jE=; b=jDKMl1P37Y3YDixUTVvhTaLo/7WoW0+RPLHAbdD33rHHVJEsau8RAj3l+oOtw5XMeT5vb4MmrBu3encz+vic4dSMmfXcpDRwpx3o7vJ/R8mMEGSeEnhpyHTthNBU2uh7a8YZmlHhv143TiwPe3argtBcnoKdr/f7B1Aa/wLySeQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1622001749633656.5340974298558; Tue, 25 May 2021 21:02:29 -0700 (PDT) Received: from localhost ([::1]:56110 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llkkV-00079Z-LB for importer2@patchew.org; Wed, 26 May 2021 00:02:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59218) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llkeM-0004n6-UD for qemu-devel@nongnu.org; Tue, 25 May 2021 23:56:06 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:33285) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1llkeJ-0003Tw-0z for qemu-devel@nongnu.org; Tue, 25 May 2021 23:56:06 -0400 Received: by mail-pj1-x102c.google.com with SMTP id v13-20020a17090abb8db029015f9f7d7290so2943133pjr.0 for ; Tue, 25 May 2021 20:56:02 -0700 (PDT) Received: from localhost ([2601:647:5180:4570:16dd:a9ff:fee7:6b79]) by smtp.gmail.com with ESMTPSA id b23sm13735607pjo.26.2021.05.25.20.56.00 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 May 2021 20:56:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mforney-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cyrGGae3KScjf2+1slxM8e19PZON/gYGwK8TqUwl1jE=; b=kQmTTI0xH78/kgfS0m9c824zc0VFSBWOWBCNLPnQdsmsCOlBErIM2jPzkkbO7X2IM9 YHrTVgFqbXz89XF86CikstveNJlsz6Tvi8Ji6OF7A7tpaP9thFr1P+8lPA9e/q5GWKcd /6/xC62zHV1kPMdADV56C9CJ6Pi/IJrTJn7/8z/hgnHGZobSuNGPpIxp8wqyTBWObjge N/GROmfkY3rn07Q7hI9Z1vEScO3OxsqFcL4SY75J90ilz7Jt2ou03AuA47QNUMb1qmqX mA+4o+OwYMiOH6BgiZN77wwztR1QaSRdRI28rKHuGZnMhBFzSsHNPcIusiediXFDQFmA HEkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cyrGGae3KScjf2+1slxM8e19PZON/gYGwK8TqUwl1jE=; b=ucCCKkvJNEbtkK/PphGG7jwhSMRoGhuSU2kxD85ia2btE94/IC5Rt74rzcOv/hJUdv CZRJamYioEr4er7fQSb0crXERM1kLAtiTr+/KVzN0clKIC2d427JOnKKz7jaAqKSqUJP 7m3RLzAXrxoxMqsiggFTUkkzO4Rj8mf1lDn5yjmXjID+ry4/gLH3Qf78OTXB98lp9c1A BiO4EvXNm5sQsUoyA7Zw4vXOP1ta6RaK2K2zyogAp7NM3aPC64ov5xJPg0jX6RIv4MGy lViRyXug/FRzKouGdl5Q6rasz+SBbo2gyGrcrlQ8DclD8WpAxBbQjrGO4LrzKXmKRSz4 sZLg== X-Gm-Message-State: AOAM532BqirFzoMob3++lnaio8ukak+89IWO3+Sfdb1hMZB5L4O8mPvF ra9VjRDqnF4e4nCQdzAErcZ/UCGRzDDSbkYcV3U= X-Google-Smtp-Source: ABdhPJxTa93wXu3FtZjuHUeGf/6OOWq9AlSZcMlSVzb/Oe9Pxwxf1yPycWmaNlj5vAuumBNqFVNWqw== X-Received: by 2002:a17:902:e04f:b029:eb:66b0:6d08 with SMTP id x15-20020a170902e04fb02900eb66b06d08mr33954676plx.50.1622001361451; Tue, 25 May 2021 20:56:01 -0700 (PDT) From: Michael Forney To: Laurent Vivier Subject: [PATCH] linux-user: Use public sigev_notify_thread_id member if available Date: Tue, 25 May 2021 20:55:56 -0700 Message-Id: <20210526035556.7931-1-mforney@mforney.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::102c; envelope-from=mforney@mforney.org; helo=mail-pj1-x102c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @mforney-org.20150623.gappssmtp.com) Content-Type: text/plain; charset="utf-8" _sigev_un._tid is an internal glibc field and is not available on musl libc. The sigevent(7) man page and Linux UAPI headers both use sigev_notify_thread_id as a public way to access this field. musl libc supports this field since 1.2.2[0], and glibc plans to add support as well[1][2]. If sigev_notify_thread_id is not available, fall back to _sigev_un._tid as before. [0] http://git.musl-libc.org/cgit/musl/commit/?id=3D7c71792e87691451f2a6b76= 348e83ad1889f1dcb [1] https://www.openwall.com/lists/musl/2019/08/01/5 [2] https://sourceware.org/bugzilla/show_bug.cgi?id=3D27417 Signed-off-by: Michael Forney Reviewed-by: Laurent Vivier --- configure | 16 ++++++++++++++++ linux-user/syscall.c | 6 +++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 676239c697..fa39b0a727 100755 --- a/configure +++ b/configure @@ -4462,6 +4462,19 @@ if compile_prog "" "" ; then st_atim=3Dyes fi =20 +########################################## +# check if we have sigev_notify_thread_id + +sigev_notify_thread_id=3Dno +cat > $TMPC << EOF +#include +#include +int main(void) { return offsetof(struct sigevent, sigev_notify_thread_id);= } +EOF +if compile_prog "" "" ; then + sigev_notify_thread_id=3Dyes +fi + ########################################## # check if trace backend exists =20 @@ -5718,6 +5731,9 @@ fi if test "$st_atim" =3D "yes" ; then echo "HAVE_STRUCT_STAT_ST_ATIM=3Dy" >> $config_host_mak fi +if test "$sigev_notify_thread_id" =3D "yes" ; then + echo "HAVE_SIGEV_NOTIFY_THREAD_ID=3Dy" >> $config_host_mak +fi if test "$byteswap_h" =3D "yes" ; then echo "CONFIG_BYTESWAP_H=3Dy" >> $config_host_mak fi diff --git a/linux-user/syscall.c b/linux-user/syscall.c index c9f812091c..63464f9a96 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7393,6 +7393,10 @@ static inline abi_long host_to_target_timex64(abi_lo= ng target_addr, } #endif =20 +#ifndef HAVE_SIGEV_NOTIFY_THREAD_ID +#define sigev_notify_thread_id _sigev_un._tid +#endif + static inline abi_long target_to_host_sigevent(struct sigevent *host_sevp, abi_ulong target_addr) { @@ -7413,7 +7417,7 @@ static inline abi_long target_to_host_sigevent(struct= sigevent *host_sevp, host_sevp->sigev_signo =3D target_to_host_signal(tswap32(target_sevp->sigev_signo)); host_sevp->sigev_notify =3D tswap32(target_sevp->sigev_notify); - host_sevp->_sigev_un._tid =3D tswap32(target_sevp->_sigev_un._tid); + host_sevp->sigev_notify_thread_id =3D tswap32(target_sevp->_sigev_un._= tid); =20 unlock_user_struct(target_sevp, target_addr, 1); return 0; --=20 2.31.1