From patchwork Mon Mar 19 21:13:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandeep Patil X-Patchwork-Id: 887886 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=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="Or6H/Rr0"; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 404phf3gMlz9sVr for ; Tue, 20 Mar 2018 08:13:53 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id A5A503E770A for ; Mon, 19 Mar 2018 22:13:49 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) by picard.linux.it (Postfix) with ESMTP id D4BAF3E76E4 for ; Mon, 19 Mar 2018 22:13:47 +0100 (CET) Received: from mail-pg0-x242.google.com (mail-pg0-x242.google.com [IPv6:2607:f8b0:400e:c05::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id BC9B66013C6 for ; Mon, 19 Mar 2018 22:13:46 +0100 (CET) Received: by mail-pg0-x242.google.com with SMTP id g8so4305123pgq.13 for ; Mon, 19 Mar 2018 14:13:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=EXiUQWBHPJED0EMqKlFY9tXJ+/XzwLlWa2qX37g0Wr0=; b=Or6H/Rr0MnyCKWTzClH1fV+PaaqsV64HALrKejDvUgGENm0EcvliO1XOmOBU1UL9qx GImcNI0NQndqMfpaZRy+J3ej4ciyJA2mOaY9PfeSqKtHnORnLSXc+TQ9lcsDldFrzSeM QNXBflIVQt6aTH5wv9YhBSp3u8D60r25NEF19SkyWcarcxGxqErl1lsoYeEiRjGz0j/5 HlIe6TDIPjASmlz6tH6agnSFVjzrHDpqV3w8mJEU9RRzvHZrJqGsUmPiDa10Hd4BqGTT IkEXSmzzBclZ/3j0h7lMOGKJJvC+IfwUF2It7x9ZmIJWLNs1i/j0onhugXX6CieWey5p LydA== 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; bh=EXiUQWBHPJED0EMqKlFY9tXJ+/XzwLlWa2qX37g0Wr0=; b=KziIm0S1m4YG5unPCWev6o3PQ10RE7YuRPPa3vHr+C8uUCRzjOaMgAgksTSDNR0U8L v4LpE64dTmPHsRSYTUVfdAoCaLfjCqx1Znf+tC0B09UWVii2WzOxHqi4oSGfMlLdQlCK l8x5LD3YFRpthrJxCgXQbn1XocgLgtoWBkw8NvoPWJazBid0fNPc+cfZm45MQgEoOj2H tsz5oU2e5e3ry/w+EfNHAVTZv0rf65tcLBg6JrKacuehiPCxqrcCbcosmlTVopCo0O0J vJd5ASpjqYDCmsLmhU4LFAWQqJLU4fws/XEJkEXDbVtZyV0cgi4fYm+OoX/UlbQ0SBJ/ 75MA== X-Gm-Message-State: AElRT7EwEzVhfEFlgO9amIAfhB04n4eSDajPacU3e8OolGedjKJ/U5cI 58g0Zj1XvM7DRh3sgM8+DberU3EXNRI= X-Google-Smtp-Source: AG47ELsuoeNwzdnCM1XD9Uo0Ttc/1RsO/FzkviOxtsgRkKYXnJdETybYpoE/gmVryAUvBxngQrXPtg== X-Received: by 10.98.61.206 with SMTP id x75mr5798292pfj.233.1521494024433; Mon, 19 Mar 2018 14:13:44 -0700 (PDT) Received: from sspatil-desktop.mtv.corp.google.com ([2620:0:1000:1600:6e29:33f4:7c9a:4918]) by smtp.gmail.com with ESMTPSA id u9sm109636pgb.27.2018.03.19.14.13.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Mar 2018 14:13:43 -0700 (PDT) From: Sandeep Patil To: ltp@lists.linux.it Date: Mon, 19 Mar 2018 14:13:40 -0700 Message-Id: <20180319211340.83921-1-sspatil@google.com> X-Mailer: git-send-email 2.16.2.804.g6dcf76e118-goog X-Virus-Scanned: clamav-milter 0.99.2 at in-5.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, SPF_PASS, T_RP_MATCHES_RCVD autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-5.smtp.seeweb.it Cc: chrubis@suze.cz, kernel-team@android.com Subject: [LTP] [PATCH] syscalls/mprotect01: map /dev/zero instead of /etc/passwd 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: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" The test creates a read-only map for /etc/passwd to test against errors returned by mprotect with PROT_WRITE. This doesn't work in Android systems (no /etc/passwd) More portable solution is to replace /etc/passwd with /dev/zero instead. That fixes the problem for Android systems Signed-off-by: Sandeep Patil --- testcases/kernel/syscalls/mprotect/mprotect01.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testcases/kernel/syscalls/mprotect/mprotect01.c b/testcases/kernel/syscalls/mprotect/mprotect01.c index 7c4f10e02..be4d982ea 100644 --- a/testcases/kernel/syscalls/mprotect/mprotect01.c +++ b/testcases/kernel/syscalls/mprotect/mprotect01.c @@ -137,8 +137,8 @@ static void setup2(struct test_case *self) static void setup3(struct test_case *self) { - fd = SAFE_OPEN(cleanup, "/etc/passwd", O_RDONLY); - + fd = SAFE_OPEN(cleanup, "/dev/zero", O_RDONLY); + self->len = getpagesize(); /*