From patchwork Sat Aug 5 00:00:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam James X-Patchwork-Id: 73645 Return-Path: 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 24E6D3858CDB for ; Sat, 5 Aug 2023 00:01:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 24E6D3858CDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1691193694; bh=1P4sWicWRlOY7ruP5mtUwfVNuULtxCczog2rEJx6Sjc=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=gMdKjMv4MXfF3xSdvxL9KIxyU61o7+tvxbac7+cq0HsOTRQEBUb3UPJDiODVytAVg Jy+cgubrrC3creb10O+SutLbwc1m40k1wlBbJFI7+Y5hb2AT1P5Za1TDfVygN8aNi6 xZaYo/c80Z0ruNFXf0jBsYJexYgURmIksrEZZKR8= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 667103858D32 for ; Sat, 5 Aug 2023 00:00:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 667103858D32 To: libc-alpha@sourceware.org Cc: arsen@gentoo.org, Sam James Subject: [PATCH 2/2] sysdeps: tst-bz21269: handle ENOSYS & skip appropriately Date: Sat, 5 Aug 2023 01:00:04 +0100 Message-ID: <20230805000005.2427213-2-sam@gentoo.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230805000005.2427213-1-sam@gentoo.org> References: <20230805000005.2427213-1-sam@gentoo.org> MIME-Version: 1.0 X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Sam James via Libc-alpha From: Sam James Reply-To: Sam James Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" SYS_modify_ldt requires CONFIG_MODIFY_LDT_SYSCALL to be set in the kernel, which some distributions may disable for hardening. Check if that's the case (unset) and mark the test as UNSUPPORTED if so. Signed-off-by: Sam James --- sysdeps/unix/sysv/linux/i386/tst-bz21269.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sysdeps/unix/sysv/linux/i386/tst-bz21269.c b/sysdeps/unix/sysv/linux/i386/tst-bz21269.c index f508ef8f16..345b4ebc45 100644 --- a/sysdeps/unix/sysv/linux/i386/tst-bz21269.c +++ b/sysdeps/unix/sysv/linux/i386/tst-bz21269.c @@ -52,7 +52,16 @@ xset_thread_area (struct user_desc *u_info) static void xmodify_ldt (int func, const void *ptr, unsigned long bytecount) { - TEST_VERIFY_EXIT (syscall (SYS_modify_ldt, func, ptr, bytecount) == 0); + long ret = syscall (SYS_modify_ldt, func, ptr, bytecount); + + if (ret == -1) + { + if (errno == ENOSYS) + FAIL_UNSUPPORTED ("modify_ldt not supported"); + FAIL_EXIT1 ("semget failed (errno=%d)", errno); + } + + return 0; } static int