From patchwork Thu Apr 4 10:19:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyril Hrubis X-Patchwork-Id: 1077069 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44Zf8P045Jz9sPS for ; Thu, 4 Apr 2019 21:20:04 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id B08B43EAE3C for ; Thu, 4 Apr 2019 12:19:59 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) by picard.linux.it (Postfix) with ESMTP id 2B9CD3EA2BA for ; Thu, 4 Apr 2019 12:19:57 +0200 (CEST) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id A27F810007CA for ; Thu, 4 Apr 2019 12:19:54 +0200 (CEST) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id A1483AEC2; Thu, 4 Apr 2019 10:19:55 +0000 (UTC) From: Cyril Hrubis To: ltp@lists.linux.it Date: Thu, 4 Apr 2019 12:19:51 +0200 Message-Id: <20190404101951.4032-1-chrubis@suse.cz> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=7.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-4.smtp.seeweb.it Subject: [LTP] [PATCH] [COMMITTED] syscalls/fstat05: Fix failures X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 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" Quoting Wei Li: " On my machine running linux-4.19.23, the fstat05 test case went failed: [root@localhost ltp_20180926_src]# ./testcases/kernel/syscalls/fstat/fstat05 fstat05 1 TFAIL : fstat05.c:168: fstat() returned 0 but we wanted -1 Finally i found that, the end of head was expanded after invoking setup(), more than 4 * getpagesize(), then ptr_str is not a point outside user's accessible address space any more. " This fixes the test by using the tst_get_bad_addr() instead of sbrk() + delta. Reported-by: Wei Li CC: Wei Li Signed-off-by: Cyril Hrubis --- testcases/kernel/syscalls/fstat/fstat05.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/testcases/kernel/syscalls/fstat/fstat05.c b/testcases/kernel/syscalls/fstat/fstat05.c index 8de5d070a..200de4130 100644 --- a/testcases/kernel/syscalls/fstat/fstat05.c +++ b/testcases/kernel/syscalls/fstat/fstat05.c @@ -129,16 +129,11 @@ int SIG_SEEN = sizeof(siglist) / sizeof(int); int main(int ac, char **av) { - struct stat stat_buf; /* stat structure buffer */ - struct stat *ptr_str; + struct stat *ptr_str = tst_get_bad_addr(NULL); int lc; tst_parse_opts(ac, av, NULL, NULL); - /* Buffer points outside user's accessible address space. */ - ptr_str = &stat_buf; /* if it was for conformance testing */ - ptr_str = (void *)sbrk(0) + (4 * getpagesize()); - /* * Invoke setup function */