From patchwork Fri Jun 30 18:34:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Dobriyan X-Patchwork-Id: 13298676 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 097D3EB64DA for ; Fri, 30 Jun 2023 18:36:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233224AbjF3SgG (ORCPT ); Fri, 30 Jun 2023 14:36:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233369AbjF3SfV (ORCPT ); Fri, 30 Jun 2023 14:35:21 -0400 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0C9F49F9 for ; Fri, 30 Jun 2023 11:34:54 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-992acf67388so236807866b.1 for ; Fri, 30 Jun 2023 11:34:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688150093; x=1690742093; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=qg1w3CBffWio5WR/vw/6assSDA081651kK3qApcQZKM=; b=nt/LvfQtKL58p6ZqTKA2wRGxWgTRkYxiIr1H4orWSv0hObf/iC/0d0himU40z3qFKm R9y40TGEKLi7aipEjZDFG23BPiACgXSGjj8ltdCPhLt7ArRcaujAadI2LKyHl3U5NvbS AUUVe/+nzO8wfmP5zmBRME07QGbft+6bTNrzhJv7FuNvBBW7rjdd+5oabKVJANkspweA 4CaUr98GiquaS7oMlvH2Cnl40w+vnuzd4HxJ35Krb5inqIeJftcjNjQwzertpjTDi0zi mzkSBEolvZkqhDqhTCjVaoDTlUsgHRl7VPtQgRqsTLHv0teWfztEES+pzkrBIPOxWwWJ AdSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688150093; x=1690742093; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qg1w3CBffWio5WR/vw/6assSDA081651kK3qApcQZKM=; b=XUOTux9THeMOQLViLDaUbmMNpnSp6XDlKUWCfOEF/lmP8mpZwhdjbpEFQp/Q09lZFP RBkkE8yGIQp2WZZ84X13szaVDgjawpzuzVLVaxjlWXpkhs7BV+nNfy0GgUArVNaQlLTo GSUx0SQGNwsaFwU6VbLXxImBmIOQmE9dAwCMu6CXHGqsaYKMRnFcDRL48VNhRtp9967j tXorC4RudTy47AsJI9lY4yBjuMeU6gp3DQq8yrwbrtLAQiRFE3cQm0OolwOpTnIMfj28 mNPuDlrWcMZ04XgTWeX736lSQQVYL0YEe8cnrTgyFzVsFlBPdVL6udHIKWfsV7jEK0JK AChQ== X-Gm-Message-State: ABy/qLb7Vh3wjwkWgyI011yBppC2lCw4Nkaiu2jqw2DJaw4BTQ7MrRoa 0WCXIwK2CScahJfE9Iy61g== X-Google-Smtp-Source: APBJJlEDMU35rSKZgdBu3w0lrumbOYGPkw8d6Tr+EiWoZQqN0+ffiPei2e0qkzLJqmErMaJOuJjpsA== X-Received: by 2002:a17:906:d14a:b0:991:f427:2fe7 with SMTP id br10-20020a170906d14a00b00991f4272fe7mr2426901ejb.62.1688150092854; Fri, 30 Jun 2023 11:34:52 -0700 (PDT) Received: from localhost.localdomain ([46.53.251.113]) by smtp.gmail.com with ESMTPSA id lr3-20020a170906fb8300b00973f1cd586fsm8361827ejb.1.2023.06.30.11.34.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 11:34:52 -0700 (PDT) From: Alexey Dobriyan To: akpm@linux-foundation.org Cc: adobriyan@gmail.com, bjorn@kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 1/2] proc: support proc-empty-vm test on i386 Date: Fri, 30 Jun 2023 21:34:33 +0300 Message-Id: <20230630183434.17434-1-adobriyan@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Unmap everything starting from 4GB length until it unmaps, otherwise test has to detect which virtual memory split kernel is using. Signed-off-by: Alexey Dobriyan --- tools/testing/selftests/proc/proc-empty-vm.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/testing/selftests/proc/proc-empty-vm.c b/tools/testing/selftests/proc/proc-empty-vm.c index 7588428b8fcd..3aea36c57800 100644 --- a/tools/testing/selftests/proc/proc-empty-vm.c +++ b/tools/testing/selftests/proc/proc-empty-vm.c @@ -37,6 +37,10 @@ #include #include +#ifdef __amd64__ +#define TEST_VSYSCALL +#endif + /* * 0: vsyscall VMA doesn't exist vsyscall=none * 1: vsyscall VMA is --xp vsyscall=xonly @@ -119,6 +123,7 @@ static void sigaction_SIGSEGV(int _, siginfo_t *__, void *___) _exit(EXIT_FAILURE); } +#ifdef TEST_VSYSCALL static void sigaction_SIGSEGV_vsyscall(int _, siginfo_t *__, void *___) { _exit(g_vsyscall); @@ -170,6 +175,7 @@ static void vsyscall(void) exit(1); } } +#endif static int test_proc_pid_maps(pid_t pid) { @@ -299,7 +305,9 @@ int main(void) { int rv = EXIT_SUCCESS; +#ifdef TEST_VSYSCALL vsyscall(); +#endif switch (g_vsyscall) { case 0: @@ -346,6 +354,14 @@ int main(void) #ifdef __amd64__ munmap(NULL, ((size_t)1 << 47) - 4096); +#elif defined __i386__ + { + size_t len; + + for (len = -4096;; len -= 4096) { + munmap(NULL, len); + } + } #else #error "implement 'unmap everything'" #endif From patchwork Fri Jun 30 18:34:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Dobriyan X-Patchwork-Id: 13298677 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E8FFEB64D7 for ; Fri, 30 Jun 2023 18:36:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233242AbjF3SgI (ORCPT ); Fri, 30 Jun 2023 14:36:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233381AbjF3SfW (ORCPT ); Fri, 30 Jun 2023 14:35:22 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA9E349FE for ; Fri, 30 Jun 2023 11:34:55 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-9922d6f003cso265859966b.0 for ; Fri, 30 Jun 2023 11:34:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688150094; x=1690742094; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OVVeDwD7caIzp61kw2BMuZNs7lYHzfuzLdBj/mmv2Ok=; b=k5TL6aojVvFuJPOtkITW+dKkpAxlFWvt00ELUMy5b1i0q55juTkWLlOIvTF8hH1cRc APPYM6Ps2g9U5wLIG2dgGEJoYyClGjZTP/Z+QJjIkamRVV+2NKpQKhV/P8PawXUXLfBW crGiFx6tv/LflatlEEB8q9PbrioNXgCnrX/2tjJBowB6DZAFJ9xBF+hGB3bcXKQEaOCg J7K2BLbFBfaNl1IVyPOMvmNzQiJa646BGoHYBt5sUTs7UC4rx+N5PGwUOF5VZjix/65N xC7aHNwQcYqAcJtKSxP2byxXsqNErFyt7Fx7APk0u2mFXILiBV1iMQlKmheU1AV4MZDW r5UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688150094; x=1690742094; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OVVeDwD7caIzp61kw2BMuZNs7lYHzfuzLdBj/mmv2Ok=; b=djTtcDByovPFx88Lx0+m8J0Wiv4+gvGiS4Rp7MI3blAbhVNvn+qB7r3xQa2MVbOTGQ kESxcZGlWur2JvjAmIKpCz2wWFvc3LQWvbpFhYqSthQWeUCZX0PutZAbbrjibhNG9M9s L/7EysVT+5E33dNzhIiWnXs2ELZ63aVsLNFcFajS8s58ZJthsDYqI3TJdrkk5PgP4fnT H4+AULCz0Al5fx7W0KlRFkPeqGGFNf2FhhMo3KZ0pN9v+9YWgDtbdxkkIo1ha2IhAQr3 cSSkdRm47ez1UG8/Xph2gKZQGGFBshFqylLCEmBjKcNHKCUF9g8EFAol6JsayflJlY1Y 8iCA== X-Gm-Message-State: ABy/qLZrTtpfqWEKYcsaAQEKdgxRuLjFpskc0tg0y1hNbOZ0Qy5wsJwN F3Ty9mghKapmCNP5LzA3+g== X-Google-Smtp-Source: APBJJlFOdv0xmO+EJX1ZCeIS1VlMiknbb0vo/MAjcnBIuQ0xFvKuXgUanNFf6+uJgym93/F0LC4/Aw== X-Received: by 2002:a17:906:8148:b0:98d:7818:e51b with SMTP id z8-20020a170906814800b0098d7818e51bmr2567496ejw.27.1688150093977; Fri, 30 Jun 2023 11:34:53 -0700 (PDT) Received: from localhost.localdomain ([46.53.251.113]) by smtp.gmail.com with ESMTPSA id lr3-20020a170906fb8300b00973f1cd586fsm8361827ejb.1.2023.06.30.11.34.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 11:34:53 -0700 (PDT) From: Alexey Dobriyan To: akpm@linux-foundation.org Cc: adobriyan@gmail.com, bjorn@kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 2/2] proc: skip proc-empty-vm on anything but amd64 and i386 Date: Fri, 30 Jun 2023 21:34:34 +0300 Message-Id: <20230630183434.17434-2-adobriyan@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230630183434.17434-1-adobriyan@gmail.com> References: <20230630183434.17434-1-adobriyan@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org This test is arch specific, requires "munmap everything" primitive. Signed-off-by: Alexey Dobriyan --- tools/testing/selftests/proc/proc-empty-vm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/testing/selftests/proc/proc-empty-vm.c b/tools/testing/selftests/proc/proc-empty-vm.c index 3aea36c57800..dfbcb3ce2194 100644 --- a/tools/testing/selftests/proc/proc-empty-vm.c +++ b/tools/testing/selftests/proc/proc-empty-vm.c @@ -1,3 +1,4 @@ +#if defined __amd64__ || defined __i386__ /* * Copyright (c) 2022 Alexey Dobriyan * @@ -402,3 +403,9 @@ int main(void) return rv; } +#else +int main(void) +{ + return 4; +} +#endif