Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2336871imm; Mon, 28 May 2018 06:18:03 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoopKKbv8OfqohsueHfU3XnQ6ybhbtdm7pPErQhB8Yk71CS6vrXpmkDuNp8o1qplltzwKp9 X-Received: by 2002:a17:902:850a:: with SMTP id bj10-v6mr13372081plb.239.1527513483370; Mon, 28 May 2018 06:18:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527513483; cv=none; d=google.com; s=arc-20160816; b=SocHbhEFxUAW5ysIdCYRM2uui9kJHFMeHo9YszF+2MsQ51VXbegJw/tSewul283muG jvMXHQG9yq/pDSlPp7so8V0jjCctSwP0whrDGbdbBfcPNRVpWWt11u/Ik9mmhsswKYnC HumYW0jULY++BJQTaTImBImIlKSL5YnKepLFyn7j6TmbNsQaDBc+Bs6qpYU4juCR+3i/ 7QEIesFjJdglGhn9b2xN1csymZVL8WrbziS8Z73qgng8v5gjtu9TANX9EG7hJlM1LOTT LXab8ssQrSYUuW1CVrcBPlQssj5lU2FSpL51DDVpJyVqIOLXhxypP1/OlCCFeMhek8Xm 1WrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=x6zKT7eQrhvepeoEJYXfyHq8XwsPwDPCYde8ifft9D4=; b=hbal20PRBRpuJtNrW92jAcx4OVheyQbvT5D5w2NCarRhfiLZBAD2EGm+TSjS8qLCIp uVnBTqoAWuiUKJvyEPA0XRPaI4Hk84M1cq4/mSkFVJSgZXWY40s/SWcZ9QeeZK2PaQAu eAIDE6r/vaGFPRcIbP+T3hoemOiRSCYzE0o71PMHWrCU9TWlZkNkNqOaPJZNDNKDKO1C PJGw+8yI42ozQ6Py1TEuKgr+1p3Vepvo3TSnqJScBIW76Bax85x24/GIU/XNLzjXMyPd bnXKhW1snWZje1zCYoG6Nya8M5pG7bZ+U1R0gZJwoALQUc0jkmj2/qRRKlmwraKhh7JU TF1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NcsomSTZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h66-v6si8221179pgc.53.2018.05.28.06.17.48; Mon, 28 May 2018 06:18:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NcsomSTZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1425054AbeE1NRN (ORCPT + 99 others); Mon, 28 May 2018 09:17:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:39612 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163249AbeE1KuE (ORCPT ); Mon, 28 May 2018 06:50:04 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6C8C9204EE; Mon, 28 May 2018 10:50:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527504603; bh=TgOiQZ2iU37TzoOOgTJTw6yoQSueoGYKHZwL6MwS9dk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NcsomSTZ9pgign8G7GRLvvT6baOHD/7og5rl+nclE45SnCkSBmHU8hzTjCOKslva/ KeQ4WwnkTdnYozdZfRUiqOvUmP0jmr5RpUbiVJ5ukByfJEj88KKCCY+tQ7wVFMDBzG XFAR3YFLHe49pyppcX/pUT73KCj/sh5FXcmmmpFM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Ellerman , Sasha Levin Subject: [PATCH 4.14 198/496] selftests/powerpc: Skip the subpage_prot tests if the syscall is unavailable Date: Mon, 28 May 2018 11:59:43 +0200 Message-Id: <20180528100328.266320834@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100319.498712256@linuxfoundation.org> References: <20180528100319.498712256@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Ellerman [ Upstream commit cd4a6f3ab4d80cb919d15897eb3cbc85c2009d4b ] The subpage_prot syscall is only functional when the system is using the Hash MMU. Since commit 5b2b80714796 ("powerpc/mm: Invalidate subpage_prot() system call on radix platforms") it returns ENOENT when the Radix MMU is active. Currently this just makes the test fail. Additionally the syscall is not available if the kernel is built with 4K pages, or if CONFIG_PPC_SUBPAGE_PROT=n, in which case it returns ENOSYS because the syscall is missing entirely. So check explicitly for ENOENT and ENOSYS and skip if we see either of those. Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/powerpc/mm/subpage_prot.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) --- a/tools/testing/selftests/powerpc/mm/subpage_prot.c +++ b/tools/testing/selftests/powerpc/mm/subpage_prot.c @@ -135,6 +135,16 @@ static int run_test(void *addr, unsigned return 0; } +static int syscall_available(void) +{ + int rc; + + errno = 0; + rc = syscall(__NR_subpage_prot, 0, 0, 0); + + return rc == 0 || (errno != ENOENT && errno != ENOSYS); +} + int test_anon(void) { unsigned long align; @@ -145,6 +155,8 @@ int test_anon(void) void *mallocblock; unsigned long mallocsize; + SKIP_IF(!syscall_available()); + if (getpagesize() != 0x10000) { fprintf(stderr, "Kernel page size must be 64K!\n"); return 1; @@ -180,6 +192,8 @@ int test_file(void) off_t filesize; int fd; + SKIP_IF(!syscall_available()); + fd = open(file_name, O_RDWR); if (fd == -1) { perror("failed to open file");