From patchwork Tue Mar 27 17:37:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandeep Patil X-Patchwork-Id: 891743 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=2001:1418:10:5::2; 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="BbHlpwqQ"; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 409dWs2qvRz9ry1 for ; Wed, 28 Mar 2018 04:38:01 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id BFE803E62D8 for ; Tue, 27 Mar 2018 19:37:58 +0200 (CEST) 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 [217.194.8.3]) by picard.linux.it (Postfix) with ESMTP id AC7E13E62C9 for ; Tue, 27 Mar 2018 19:37:56 +0200 (CEST) Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id B5C6C1A011F5 for ; Tue, 27 Mar 2018 19:37:55 +0200 (CEST) Received: by mail-pf0-x241.google.com with SMTP id a11so5777845pff.8 for ; Tue, 27 Mar 2018 10:37:55 -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=SmvXKBZI204GD/UxQn85iUBO36mgnyC3wyCWgyMWvow=; b=BbHlpwqQMCNOmY7mWoO4MnqGgnNIDSbrklmSa6nZyM3b9qCDZ9C4WMXvnQ2NSbbw11 oRuYDablNcA3cgJnoePJbYEVFL7hWOS2yLyXNqW3+lUZiDrvuC/kxQnPp5fd2akkV6Cu TfTCvqtz1jP598qngx5XvAttF6SRhk+ZQkymOGqwA3NKw1FmWzytu0FfLLa0FBDDOBG6 I048XIGpQzUCnB1dYtJ4EVA0ei4E8YYOEgOy3Ugj25pCTmtJ2DBRXNZDoK7vOZjZaWia 1eXyQc8JJ3S/Z5avb5RMVZ5gX+vYmYTs8V5r25LYSayt+tGbQgYjDeFfGrPv6L3jaQxZ 6naQ== 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=SmvXKBZI204GD/UxQn85iUBO36mgnyC3wyCWgyMWvow=; b=mTPC8NzFhQudbptSfv5lAQf+q+owHe+zPMXKQ4AOArHkaELD94zwOlhaIeIZsuXlCV ksR7M6Kd2x7NTDCTpc9mqnvphOSqdsBPBdF3tB6tbd0EsuhPJ6AyakTshQxZnkJis4EA hyCnxS++B3Wykf/RZhNFgAWw6qGprEfAAgQiQ8S/BQI+AkVlLKYo2lykXlG9/SHwlVmP yMgRKjC6RJZ9QpnlSEbRdQQraH5wQcbTa+TxtquJmWKa9RZi2YKQE0PX9v5NPlpBBpxq J9fqK47efxG/T3hXCj5KHHhldw5DnCoDhc3oEvXWhxpSSI4D8tfaB2iFNdRKbyRjNomR DY1A== X-Gm-Message-State: AElRT7EWKwxqLh3ZI5LYMCm83m8kSwFQCgD7ppT/bkDBQMqplVdm8X94 GTGzkGCSeBhWflVWADp2itnafOxRygE= X-Google-Smtp-Source: AIpwx49AohPIu60cc4X27CNIAau7gGYrXpgmcP3boHLCOPOF4yRm9LSTxIlzl1op0i576f5rxdyA8g== X-Received: by 10.99.6.198 with SMTP id 189mr155726pgg.131.1522172273392; Tue, 27 Mar 2018 10:37:53 -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 o90sm5418870pfj.102.2018.03.27.10.37.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Mar 2018 10:37:52 -0700 (PDT) From: Sandeep Patil To: ltp@lists.linux.it Date: Tue, 27 Mar 2018 10:37:49 -0700 Message-Id: <20180327173749.179633-1-sspatil@google.com> X-Mailer: git-send-email 2.17.0.rc0.231.g781580f067-goog X-Virus-Scanned: clamav-milter 0.99.2 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, 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-3.smtp.seeweb.it Cc: pvorel@suze.cz, chrubis@suze.cz, kernel-team@android.com Subject: [LTP] [PATCH] [RESEND] 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(); /*