Message ID | 20200912024533.3957431-1-hjl.tools@gmail.com |
---|---|
State | Committed |
Headers |
Return-Path: <libc-alpha-bounces@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 78345386F448; Sat, 12 Sep 2020 02:45:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 78345386F448 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1599878737; bh=8uoismJouTM6JloYtcN1izsCzIiNHPIoxEDQXAuClWw=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=YQTcof3hyzhnWvQDOEm1Qmp/PvF5BsH6hlqekFx0qz7QXaKj2dIeVLJQLmQLJEd2H pjRGjtDX6nY9RB2eZYjvFMGQ8o+as7/3FzoB67TtIJbQ5wflozJcSEr+T8T8pbBoH2 fHXb/4bm2oXqIprsEuYwWkNlruO8vZBNTxxYkDAw= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by sourceware.org (Postfix) with ESMTPS id C5B9E385782F for <libc-alpha@sourceware.org>; Sat, 12 Sep 2020 02:45:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C5B9E385782F Received: by mail-pf1-x444.google.com with SMTP id l126so8626550pfd.5 for <libc-alpha@sourceware.org>; Fri, 11 Sep 2020 19:45:35 -0700 (PDT) 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=8uoismJouTM6JloYtcN1izsCzIiNHPIoxEDQXAuClWw=; b=lUCAfQb1wxCWTCQuMDyE7mE7FKO5TjEtCD1ikHW8MOvjmcSqbJeSimaPRg/z5NziUQ b7R6iWWo+iDsQHDP9COoP5ShzStfzDEnTn6kC3fqDltVZvJpoFyOPzM5lWXnf5oDticj uGJAiWqIskMnjXwVR42MZn/CXYuVt40gykVLMOLPW3myowHn4B9MB+sLLPfTjDEl4YMf 3NEHuwFCZOVHRCWsgPAlLIEwUZTo1TcMxR0EFyvCRqzMVrPnG29CELQUxkGu6Qzi6qXu VTA9mivlkM9TLA0C3uK5P94BOhlgNSUhI8Lp3wTQDzPmM6MlI74ndbWyBKG62SPTYk6f kAOQ== X-Gm-Message-State: AOAM5316J+JmmWogayVitqut9AgkbusfHloYzp+ttp8pZgpRJ65U0lrW Ns3aSaDkzcOj8mN0o8L1FIM= X-Google-Smtp-Source: ABdhPJwdS68QPieQPpt/aTEnnoV9cAPhIDM2or9Wh0eozaRvsJ062DHZO8mrgvKISAyty5gllwYfxg== X-Received: by 2002:a63:1b65:: with SMTP id b37mr3835635pgm.453.1599878734736; Fri, 11 Sep 2020 19:45:34 -0700 (PDT) Received: from gnu-cfl-2.localdomain (c-69-181-90-243.hsd1.ca.comcast.net. [69.181.90.243]) by smtp.gmail.com with ESMTPSA id f207sm3789588pfa.54.2020.09.11.19.45.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Sep 2020 19:45:34 -0700 (PDT) Received: from gnu-cfl-2.localdomain (localhost [IPv6:::1]) by gnu-cfl-2.localdomain (Postfix) with ESMTP id 4E3501A00E3; Fri, 11 Sep 2020 19:45:33 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH] pselect.c: Pass a pointer to SYSCALL_CANCEL [BZ #26606] Date: Fri, 11 Sep 2020 19:45:33 -0700 Message-Id: <20200912024533.3957431-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> From: "H.J. Lu via Libc-alpha" <libc-alpha@sourceware.org> Reply-To: "H.J. Lu" <hjl.tools@gmail.com> Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces@sourceware.org> |
Series |
pselect.c: Pass a pointer to SYSCALL_CANCEL [BZ #26606]
|
|
Commit Message
H.J. Lu
Sept. 12, 2020, 2:45 a.m. UTC
commit a92f4e6299fe0e3cb6f77e79de00817aece501ce Author: Adhemerval Zanella <adhemerval.zanella@linaro.org> Date: Mon Jul 6 13:27:12 2020 -0300 linux: Add time64 pselect support changed pselect.c to r = SYSCALL_CANCEL (pselect6_time64, nfds, readfds, writefds, exceptfds, timeout, ((__syscall_ulong_t[]){ (uintptr_t) sigmask, __NSIG_BYTES })); which doesn't work with x32's ARGIFY and data passed to syscall isn't initialized with sigmask and __NSIG_BYTES. Change to __syscall_ulong_t data[2] = { (uintptr_t) sigmask, __NSIG_BYTES }; r = SYSCALL_CANCEL (pselect6_time64, nfds, readfds, writefds, exceptfds, timeout, data); fixes the issue. --- sysdeps/unix/sysv/linux/pselect.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
Comments
On Fri, Sep 11, 2020 at 7:45 PM H.J. Lu <hjl.tools@gmail.com> wrote: > > commit a92f4e6299fe0e3cb6f77e79de00817aece501ce > Author: Adhemerval Zanella <adhemerval.zanella@linaro.org> > Date: Mon Jul 6 13:27:12 2020 -0300 > > linux: Add time64 pselect support > > changed pselect.c to > > r = SYSCALL_CANCEL (pselect6_time64, nfds, readfds, writefds, exceptfds, > timeout, > ((__syscall_ulong_t[]){ (uintptr_t) sigmask, > __NSIG_BYTES })); > > which doesn't work with x32's ARGIFY and data passed to syscall isn't > initialized with sigmask and __NSIG_BYTES. Change to > > __syscall_ulong_t data[2] = > { > (uintptr_t) sigmask, __NSIG_BYTES > }; > r = SYSCALL_CANCEL (pselect6_time64, nfds, readfds, writefds, exceptfds, > timeout, data); > > fixes the issue. > --- > sysdeps/unix/sysv/linux/pselect.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/sysdeps/unix/sysv/linux/pselect.c b/sysdeps/unix/sysv/linux/pselect.c > index ed36121023..aa5835ed0f 100644 > --- a/sysdeps/unix/sysv/linux/pselect.c > +++ b/sysdeps/unix/sysv/linux/pselect.c > @@ -44,10 +44,12 @@ __pselect64 (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, > int r; > if (supports_time64 ()) > { > + __syscall_ulong_t data[2] = > + { > + (uintptr_t) sigmask, __NSIG_BYTES > + }; > r = SYSCALL_CANCEL (pselect6_time64, nfds, readfds, writefds, exceptfds, > - timeout, > - ((__syscall_ulong_t[]){ (uintptr_t) sigmask, > - __NSIG_BYTES })); > + timeout, data); > if (r == 0 || errno != ENOSYS) > return r; > x86-64 is also missing sigmask and __NSIG_BYTES. I suspect that many targets are broken.
On Fri, Sep 11, 2020 at 7:45 PM H.J. Lu <hjl.tools@gmail.com> wrote: > > commit a92f4e6299fe0e3cb6f77e79de00817aece501ce > Author: Adhemerval Zanella <adhemerval.zanella@linaro.org> > Date: Mon Jul 6 13:27:12 2020 -0300 > > linux: Add time64 pselect support > > changed pselect.c to > > r = SYSCALL_CANCEL (pselect6_time64, nfds, readfds, writefds, exceptfds, > timeout, > ((__syscall_ulong_t[]){ (uintptr_t) sigmask, > __NSIG_BYTES })); > > which doesn't work with x32's ARGIFY and data passed to syscall isn't > initialized with sigmask and __NSIG_BYTES. Change to > > __syscall_ulong_t data[2] = > { > (uintptr_t) sigmask, __NSIG_BYTES > }; > r = SYSCALL_CANCEL (pselect6_time64, nfds, readfds, writefds, exceptfds, > timeout, data); > > fixes the issue. Here is a patch to add x86-64 pselect.c. If there are no objections, I will check it in tomorrow.
> Il giorno 14 set 2020, alle ore 09:48, H.J. Lu <HJl.tools@gmail.com> ha scritto: > > On Fri, Sep 11, 2020 at 7:45 PM H.J. Lu <hjl.tools@gmail.com> wrote: >> >> commit a92f4e6299fe0e3cb6f77e79de00817aece501ce >> Author: Adhemerval Zanella <adhemerval.zanella@linaro.org> >> Date: Mon Jul 6 13:27:12 2020 -0300 >> >> linux: Add time64 pselect support >> >> changed pselect.c to >> >> r = SYSCALL_CANCEL (pselect6_time64, nfds, readfds, writefds, exceptfds, >> timeout, >> ((__syscall_ulong_t[]){ (uintptr_t) sigmask, >> __NSIG_BYTES })); >> >> which doesn't work with x32's ARGIFY and data passed to syscall isn't >> initialized with sigmask and __NSIG_BYTES. Change to >> >> __syscall_ulong_t data[2] = >> { >> (uintptr_t) sigmask, __NSIG_BYTES >> }; >> r = SYSCALL_CANCEL (pselect6_time64, nfds, readfds, writefds, exceptfds, >> timeout, data); >> >> fixes the issue. > > Here is a patch to add x86-64 pselect.c. If there are no objections, > I will check it in tomorrow. > Sign, I forgot the x32 pointer kABI requirement where the INLINE_* macro might not produce the correct code. Instead of pushing a x86_64 version, could you patch the generic version instead to use the same strategy (and maybe add a comment why this construct is required)? In long term I have some patches to revamp the syscall macros to use proper inline functions, it should avoid this kind of regressions. > -- > H.J. > <0001-x86-64-Pass-a-pointer-to-SYSCALL_CANCEL-in-pselect.c.patch>
On Mon, Sep 14, 2020 at 12:25 PM Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote: > > > > > Il giorno 14 set 2020, alle ore 09:48, H.J. Lu <HJl.tools@gmail.com> ha scritto: > > > > On Fri, Sep 11, 2020 at 7:45 PM H.J. Lu <hjl.tools@gmail.com> wrote: > >> > >> commit a92f4e6299fe0e3cb6f77e79de00817aece501ce > >> Author: Adhemerval Zanella <adhemerval.zanella@linaro.org> > >> Date: Mon Jul 6 13:27:12 2020 -0300 > >> > >> linux: Add time64 pselect support > >> > >> changed pselect.c to > >> > >> r = SYSCALL_CANCEL (pselect6_time64, nfds, readfds, writefds, exceptfds, > >> timeout, > >> ((__syscall_ulong_t[]){ (uintptr_t) sigmask, > >> __NSIG_BYTES })); > >> > >> which doesn't work with x32's ARGIFY and data passed to syscall isn't > >> initialized with sigmask and __NSIG_BYTES. Change to > >> > >> __syscall_ulong_t data[2] = > >> { > >> (uintptr_t) sigmask, __NSIG_BYTES > >> }; > >> r = SYSCALL_CANCEL (pselect6_time64, nfds, readfds, writefds, exceptfds, > >> timeout, data); > >> > >> fixes the issue. > > > > Here is a patch to add x86-64 pselect.c. If there are no objections, > > I will check it in tomorrow. > > > > Sign, I forgot the x32 pointer kABI requirement where the INLINE_* macro might not produce the correct code. > > Instead of pushing a x86_64 version, could you patch the generic version instead to use the same strategy (and maybe add a comment why this construct is required)? Here is the updated generic patch. > In long term I have some patches to revamp the syscall macros to use proper inline functions, it should avoid this kind of regressions. >
On Sep 11 2020, H.J. Lu via Libc-alpha wrote: > commit a92f4e6299fe0e3cb6f77e79de00817aece501ce > Author: Adhemerval Zanella <adhemerval.zanella@linaro.org> > Date: Mon Jul 6 13:27:12 2020 -0300 > > linux: Add time64 pselect support > > changed pselect.c to > > r = SYSCALL_CANCEL (pselect6_time64, nfds, readfds, writefds, exceptfds, > timeout, > ((__syscall_ulong_t[]){ (uintptr_t) sigmask, > __NSIG_BYTES })); Does it work to take the address of the compound literal? Andreas.
diff --git a/sysdeps/unix/sysv/linux/pselect.c b/sysdeps/unix/sysv/linux/pselect.c index ed36121023..aa5835ed0f 100644 --- a/sysdeps/unix/sysv/linux/pselect.c +++ b/sysdeps/unix/sysv/linux/pselect.c @@ -44,10 +44,12 @@ __pselect64 (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, int r; if (supports_time64 ()) { + __syscall_ulong_t data[2] = + { + (uintptr_t) sigmask, __NSIG_BYTES + }; r = SYSCALL_CANCEL (pselect6_time64, nfds, readfds, writefds, exceptfds, - timeout, - ((__syscall_ulong_t[]){ (uintptr_t) sigmask, - __NSIG_BYTES })); + timeout, data); if (r == 0 || errno != ENOSYS) return r;