From patchwork Mon Jan 31 11:06:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Stancek X-Patchwork-Id: 1586610 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=aNZLFUWn; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JnQHd0BcGz9s07 for ; Mon, 31 Jan 2022 22:06:51 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 168973C97A2 for ; Mon, 31 Jan 2022 12:06:47 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [IPv6:2001:4b78:1:20::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id B00B63C94C1 for ; Mon, 31 Jan 2022 12:06:44 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id 3DF151A00819 for ; Mon, 31 Jan 2022 12:06:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643627201; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3FdJTbgW1vdF7MMCR60b3rfOwJYQfqMLRZ0K7J8cWrw=; b=aNZLFUWn06nXTZvEaG8PYeinhCnm44y2dItdcLoiQs1p6QWU2QtsEkDb2hF8fIXKNuAj9e rA5bEh+gMAN9+ewHaUq8TN40/gx5FoBGCpetmA5Ob6GLhv4F+NzfWXpcOhwJhgLOMei0/b GSXKlGNfmHPeMZX6z4dEyNsP/WJS9aQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-330-UU13LTumPASpL10SB_IRSw-1; Mon, 31 Jan 2022 06:06:40 -0500 X-MC-Unique: UU13LTumPASpL10SB_IRSw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7489E1923B82 for ; Mon, 31 Jan 2022 11:06:39 +0000 (UTC) Received: from janakin.usersys.redhat.com (unknown [10.40.192.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id E8AC87AB74 for ; Mon, 31 Jan 2022 11:06:38 +0000 (UTC) From: Jan Stancek To: ltp@lists.linux.it Date: Mon, 31 Jan 2022 12:06:33 +0100 Message-Id: <0e15e1df7251384368ae363cc4f19528d0e77a39.1643627166.git.jstancek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jstancek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Virus-Scanned: clamav-milter 0.102.4 at in-3.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-3.smtp.seeweb.it Subject: [LTP] [PATCH] syscalls/pread02: extend buffer to avoid glibc overflow detection X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Test started failing with recent glibc (glibc-2.34.9000-38.fc36), which detects that buffer in pread is potentially too small: tst_test.c:1431: TINFO: Timeout per run is 0h 05m 00s *** buffer overflow detected ***: terminated tst_test.c:1484: TBROK: Test killed by SIGIOT/SIGABRT! (gdb) bt #0 __pthread_kill_implementation at pthread_kill.c:44 #1 0x00007ffff7e46f73 in __pthread_kill_internal at pthread_kill.c:78 #2 0x00007ffff7df6a36 in __GI_raise at ../sysdeps/posix/raise.c:26 #3 0x00007ffff7de082f in __GI_abort () at abort.c:79 #4 0x00007ffff7e3b01e in __libc_message at ../sysdeps/posix/libc_fatal.c:155 #5 0x00007ffff7ed945a in __GI___fortify_fail at fortify_fail.c:26 #6 0x00007ffff7ed7dc6 in __GI___chk_fail () at chk_fail.c:28 #7 0x00007ffff7ed8214 in __pread_chk at pread_chk.c:26 #8 0x0000000000404d1a in pread at /usr/include/bits/unistd.h:74 #9 verify_pread (n=) at pread02.c:44 #10 0x000000000040dc19 in run_tests () at tst_test.c:1246 #11 testrun () at tst_test.c:1331 #12 fork_testrun () at tst_test.c:1462 #13 0x000000000040e9a1 in tst_run_tcases #14 0x0000000000404bde in main Extend it to number of bytes we are trying to read from fd. Signed-off-by: Jan Stancek Acked-by: Petr Vorel Reviewed-by: Cyril Hrubis --- testcases/kernel/syscalls/pread/pread02.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcases/kernel/syscalls/pread/pread02.c b/testcases/kernel/syscalls/pread/pread02.c index de2a81fffc37..fda5fd19037c 100644 --- a/testcases/kernel/syscalls/pread/pread02.c +++ b/testcases/kernel/syscalls/pread/pread02.c @@ -39,7 +39,7 @@ struct test_case_t { static void verify_pread(unsigned int n) { struct test_case_t *tc = &tcases[n]; - char buf; + char buf[K1]; TST_EXP_FAIL2(pread(*tc->fd, &buf, tc->nb, tc->offst), tc->exp_errno, "pread(%d, %zu, %ld) %s", *tc->fd, tc->nb, tc->offst, tc->desc);