Message ID | 20220811074746.2882351-1-stli@linux.ibm.com |
---|---|
State | Committed |
Headers |
Return-Path: <libc-alpha-bounces+patchwork=sourceware.org@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 77BEE385734C for <patchwork@sourceware.org>; Thu, 11 Aug 2022 07:48:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 77BEE385734C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1660204105; bh=7fWniMAHZEIKXvpTS0YGzEhJOh3wOyacydQbcPafdn0=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=LImBTQhRFFd6i5l1e7qN0eEAooFqtO8QQ15RtbgZ0bFNvTfkisOUzoVF5ZXcEkQD7 b/3gO9FmHcWWSUPkGdyP842q7kQTKi3SoM4eKNmW+fqilwcl+/EAwG/Xgi+vJUFFzU GEQboTrCwcGQy9YUh769ZR+mj2dcq18XQ13bwZCg= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 622A33857BAB for <libc-alpha@sourceware.org>; Thu, 11 Aug 2022 07:47:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 622A33857BAB Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27B7E8JF002368 for <libc-alpha@sourceware.org>; Thu, 11 Aug 2022 07:47:58 GMT Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3hvw6p0vpr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for <libc-alpha@sourceware.org>; Thu, 11 Aug 2022 07:47:57 +0000 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 27B7aOli003017 for <libc-alpha@sourceware.org>; Thu, 11 Aug 2022 07:47:55 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma04fra.de.ibm.com with ESMTP id 3huww199fv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for <libc-alpha@sourceware.org>; Thu, 11 Aug 2022 07:47:55 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 27B7lqO532047384 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Aug 2022 07:47:52 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3AC5EA405C; Thu, 11 Aug 2022 07:47:52 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0FA5DA405B; Thu, 11 Aug 2022 07:47:52 +0000 (GMT) Received: from t3560005.lnxne.boe (unknown [9.152.108.100]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 11 Aug 2022 07:47:51 +0000 (GMT) To: libc-alpha@sourceware.org Subject: [PATCH] tst-process_madvise: Check process_madvise-syscall support. Date: Thu, 11 Aug 2022 09:47:46 +0200 Message-Id: <20220811074746.2882351-1-stli@linux.ibm.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: xra6rt63-MIgWTLxLlleuvi5B17JofMo X-Proofpoint-GUID: xra6rt63-MIgWTLxLlleuvi5B17JofMo X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-11_03,2022-08-10_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 bulkscore=0 malwarescore=0 spamscore=0 adultscore=0 mlxscore=0 phishscore=0 mlxlogscore=616 lowpriorityscore=0 priorityscore=1501 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208110020 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Stefan Liebler via Libc-alpha <libc-alpha@sourceware.org> Reply-To: Stefan Liebler <stli@linux.ibm.com> Cc: Stefan Liebler <stli@linux.ibm.com> Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
tst-process_madvise: Check process_madvise-syscall support.
|
|
Checks
Context | Check | Description |
---|---|---|
dj/TryBot-apply_patch | success | Patch applied to master at the time it was sent |
dj/TryBot-32bit | success | Build for i686 |
Commit Message
Stefan Liebler
Aug. 11, 2022, 7:47 a.m. UTC
So far this test checks if pidfd_open-syscall is supported, which was introduced with linux 5.3. The process_madvise-syscall was introduced with linux 5.10. Thus you'll get FAILs if you are running a kernel in between. This patch adds a check if the first process_madvise-syscall returns ENOSYS and in this case will fail with UNSUPPORTED. --- sysdeps/unix/sysv/linux/tst-process_madvise.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Comments
* Stefan Liebler via Libc-alpha: > So far this test checks if pidfd_open-syscall is supported, > which was introduced with linux 5.3. > > The process_madvise-syscall was introduced with linux 5.10. > Thus you'll get FAILs if you are running a kernel in between. > > This patch adds a check if the first process_madvise-syscall > returns ENOSYS and in this case will fail with UNSUPPORTED. > --- > sysdeps/unix/sysv/linux/tst-process_madvise.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/sysdeps/unix/sysv/linux/tst-process_madvise.c b/sysdeps/unix/sysv/linux/tst-process_madvise.c > index a674e80b76..6fe5a79b1d 100644 > --- a/sysdeps/unix/sysv/linux/tst-process_madvise.c > +++ b/sysdeps/unix/sysv/linux/tst-process_madvise.c > @@ -101,8 +101,12 @@ do_test (void) > > /* We expect this to succeed in the target process because the mapping > is valid. */ > - TEST_COMPARE (process_madvise (pidfd, &iv, 1, MADV_COLD, 0), > - 2 * page_size); > + errno = 0; > + ssize_t ret = process_madvise (pidfd, &iv, 1, MADV_COLD, 0); > + if (ret == -1 && errno == ENOSYS) > + FAIL_UNSUPPORTED ("kernel does not support process_madvise, skipping" > + "test"); > + TEST_COMPARE (ret, 2 * page_size); > } > > { Assigning 0 to errno should not be necessary here. But the patch looks good otherwise. Reviewed-by: Florian Weimer <fweimer@redhat.com> Thanks, Florian
On 11/08/2022 10:37, Florian Weimer wrote: > * Stefan Liebler via Libc-alpha: > >> So far this test checks if pidfd_open-syscall is supported, >> which was introduced with linux 5.3. >> >> The process_madvise-syscall was introduced with linux 5.10. >> Thus you'll get FAILs if you are running a kernel in between. >> >> This patch adds a check if the first process_madvise-syscall >> returns ENOSYS and in this case will fail with UNSUPPORTED. >> --- >> sysdeps/unix/sysv/linux/tst-process_madvise.c | 8 ++++++-- >> 1 file changed, 6 insertions(+), 2 deletions(-) >> >> diff --git a/sysdeps/unix/sysv/linux/tst-process_madvise.c b/sysdeps/unix/sysv/linux/tst-process_madvise.c >> index a674e80b76..6fe5a79b1d 100644 >> --- a/sysdeps/unix/sysv/linux/tst-process_madvise.c >> +++ b/sysdeps/unix/sysv/linux/tst-process_madvise.c >> @@ -101,8 +101,12 @@ do_test (void) >> >> /* We expect this to succeed in the target process because the mapping >> is valid. */ >> - TEST_COMPARE (process_madvise (pidfd, &iv, 1, MADV_COLD, 0), >> - 2 * page_size); >> + errno = 0; >> + ssize_t ret = process_madvise (pidfd, &iv, 1, MADV_COLD, 0); >> + if (ret == -1 && errno == ENOSYS) >> + FAIL_UNSUPPORTED ("kernel does not support process_madvise, skipping" >> + "test"); >> + TEST_COMPARE (ret, 2 * page_size); >> } >> >> { > > Assigning 0 to errno should not be necessary here. But the patch looks > good otherwise. > > Reviewed-by: Florian Weimer <fweimer@redhat.com> > > Thanks, > Florian > Hi Florian, yes you are right. I've just committed it without the assignment. Thanks, Stefan
diff --git a/sysdeps/unix/sysv/linux/tst-process_madvise.c b/sysdeps/unix/sysv/linux/tst-process_madvise.c index a674e80b76..6fe5a79b1d 100644 --- a/sysdeps/unix/sysv/linux/tst-process_madvise.c +++ b/sysdeps/unix/sysv/linux/tst-process_madvise.c @@ -101,8 +101,12 @@ do_test (void) /* We expect this to succeed in the target process because the mapping is valid. */ - TEST_COMPARE (process_madvise (pidfd, &iv, 1, MADV_COLD, 0), - 2 * page_size); + errno = 0; + ssize_t ret = process_madvise (pidfd, &iv, 1, MADV_COLD, 0); + if (ret == -1 && errno == ENOSYS) + FAIL_UNSUPPORTED ("kernel does not support process_madvise, skipping" + "test"); + TEST_COMPARE (ret, 2 * page_size); } {