From patchwork Fri Oct 27 14:21:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Dobriyan X-Patchwork-Id: 158950 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp640629vqb; Fri, 27 Oct 2023 07:21:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHcDzD6bW/CGsoBQLLKnW5jD+N+Z/4Zr7M64hOFR2Izru/Z4PAGeHSyRTjM9p2BJImFWm2o X-Received: by 2002:a05:6830:4d6:b0:6cd:896:e363 with SMTP id s22-20020a05683004d600b006cd0896e363mr2459487otd.37.1698416508403; Fri, 27 Oct 2023 07:21:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698416508; cv=none; d=google.com; s=arc-20160816; b=LyCUCLYIw8wJKr773IJdFlDuHn7c69ivL6cE6NcOchoWJ4nXHHEbRm1sqn363JAdXt IktNQMttH97HRzKUs8goqLGXWHwaDL+tk6cyzmtahhAVQfOZ8KMEFOMrga7BDlKWb0TY P+gigEBkvVGO8iuVlXBe4W7o4DozF71MPFFZtrlbFp83rmcCqYC54RZteylSxAN6L/4R Z0hyiGHnM5Epct/ONkKDAln49pgqIxb0Yyk5Ejy9aW7UhlZ5w3d6SI0unl0dtXWAPX76 IEKFF/a+FpSZV5vuz2P6P/NA8VAqC+DICNa4Yrr43+VP6PbsCrRuokDNmxQHG/T9Cc0V c+VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=Y6i8VATS6nFhEbYaXyntF8SokXtip/zVE7KgzAiMv+E=; fh=OsxpHFVO0TTWpkd9nz9iIoXNJG/cbfzAlmsmMnvz/wI=; b=IuaLFVxge6QYO0kFih6tXJRFlrU8omTl+KQDwBab6Jl05Rt0TvLJ3wz5IqYJpk6AGL PBRo261mktjVMBCOZjmIQ+PwBygGr6phis/0SPK5xbfDe1v7XJmFeBazTsYSWDl/CnFU Wlj8dfudAvCiDXRxftUPmDILWMXYJNz0dJYXVHi5vLmqPQN5A7ACS8heRu476GDLLy+s FIDfLQ4aGh5+EhC5r7l7OnWPEJsiqQ49nmSvhWtVkhHdI9285wF27Re3lL5N6qWqjvCU o0aZ8xcJ7dPX7we2bZtuT23rwtxVtr3PRixNPS3kFy171EHEOY6bwAg1ZfH3k0e9sBwR +vgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=O8LpcAaS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id s64-20020a818243000000b0058696be138dsi2687532ywf.238.2023.10.27.07.21.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 07:21:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=O8LpcAaS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id C1DEC82990DB; Fri, 27 Oct 2023 07:21:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230451AbjJ0OVe (ORCPT + 25 others); Fri, 27 Oct 2023 10:21:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346216AbjJ0OVW (ORCPT ); Fri, 27 Oct 2023 10:21:22 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E833D1AA for ; Fri, 27 Oct 2023 07:21:07 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-9becde9ea7bso688792566b.0 for ; Fri, 27 Oct 2023 07:21:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698416466; x=1699021266; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=Y6i8VATS6nFhEbYaXyntF8SokXtip/zVE7KgzAiMv+E=; b=O8LpcAaSefsQry5b0QTcPDp2H5xq+tcuw86GTFdXi+EuKJ2k5s/+h16yuGlKOhKTbF gPYPFFO2+3onCMmTa+u2iCcXB/KTcjb9cv/ksZXuV29gL290hV8PXGKywFo3dlPG9URh RmVAAO/2ihAsS3KkiMxoGF6+fNyiPSbpaQ+Me3GtLUazdLlQdZUkKaQ6+qv+z2BY5uov LG7HBSkAt0005LtEHjNs63PiGpxm3GbX2ISRexfqWd9FSa5FrQSt5ymxP3C0ba/BCP4o 53wXUXxqacRuP/7po5NqD8lb8c2tFSqG6A4sHTbX1fWbSsq3dK5gYaJZYnBU3i9tLLmY NETQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698416466; x=1699021266; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Y6i8VATS6nFhEbYaXyntF8SokXtip/zVE7KgzAiMv+E=; b=gyLDbZS+XQzcDjVJIxG1SXvzYBarzTjR+iZH1ALEZO0X+1kbcDsilSec/UxvU/iIn4 idi8pAOQVus9PSgUqos0ESuDA8/BWYI3NRmIA2fyNBl2MfywahAvH1ZvtCj9F9BlvZpc J/EE6lo0RXuqnpRKEpQNtnt5e5Tq+Ln8ik9ukDdbCSjsREOIIFUETbyIC68yVy6cNE+u rkpG01tUwzmNkoicpwYTwBT9f4qQjce1XXDuwf0NPNy+qNzJYJCbHINtftwHT2qTMlWS gCKQaOJ/Id7JtVMjv+mPCiSYl5lkdPLC+fG0zjzgqJOSg3NYZjhZP+BSOpO+4WfL2vG8 qgHg== X-Gm-Message-State: AOJu0YzBUM++LA0LQiCI8OHUHcq1+nPabBh+UqyoSBdeq0Dj49ghELau 9+BgLonWCzwl5ZVDMZwzpZnKJgFBJQ== X-Received: by 2002:a17:907:3f9f:b0:9b2:be5e:3674 with SMTP id hr31-20020a1709073f9f00b009b2be5e3674mr2926543ejc.36.1698416466036; Fri, 27 Oct 2023 07:21:06 -0700 (PDT) Received: from p183 ([46.53.253.206]) by smtp.gmail.com with ESMTPSA id ov6-20020a170906fc0600b00992e14af9c3sm1276747ejb.143.2023.10.27.07.21.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 07:21:05 -0700 (PDT) Date: Fri, 27 Oct 2023 17:21:03 +0300 From: Alexey Dobriyan To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 1/2] proc: fix proc-empty-vm test with vsyscall Message-ID: <76f42cce-b1ab-45ec-b6b2-4c64f0dccb90@p183> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 27 Oct 2023 07:21:45 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780918788643422141 X-GMAIL-MSGID: 1780918788643422141 * fix embarassing /proc/*/smaps test bug due to a typo in variable name it tested only the first line of the output if vsyscall is enabled: ffffffffff600000-ffffffffff601000 r-xp ... so test passed but tested only VMA location and permissions. * add "KSM" entry, unnoticed because (1) * swap "r-xp" and "--xp" vsyscall test strings, also unnoticed because (1) Signed-off-by: Alexey Dobriyan --- tools/testing/selftests/proc/proc-empty-vm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/tools/testing/selftests/proc/proc-empty-vm.c +++ b/tools/testing/selftests/proc/proc-empty-vm.c @@ -60,7 +60,7 @@ static const char proc_pid_maps_vsyscall_2[] = static const char proc_pid_smaps_vsyscall_0[] = ""; static const char proc_pid_smaps_vsyscall_1[] = -"ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]\n" +"ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0 [vsyscall]\n" "Size: 4 kB\n" "KernelPageSize: 4 kB\n" "MMUPageSize: 4 kB\n" @@ -73,6 +73,7 @@ static const char proc_pid_smaps_vsyscall_1[] = "Private_Dirty: 0 kB\n" "Referenced: 0 kB\n" "Anonymous: 0 kB\n" +"KSM: 0 kB\n" "LazyFree: 0 kB\n" "AnonHugePages: 0 kB\n" "ShmemPmdMapped: 0 kB\n" @@ -90,7 +91,7 @@ static const char proc_pid_smaps_vsyscall_1[] = ; static const char proc_pid_smaps_vsyscall_2[] = -"ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0 [vsyscall]\n" +"ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]\n" "Size: 4 kB\n" "KernelPageSize: 4 kB\n" "MMUPageSize: 4 kB\n" @@ -103,6 +104,7 @@ static const char proc_pid_smaps_vsyscall_2[] = "Private_Dirty: 0 kB\n" "Referenced: 0 kB\n" "Anonymous: 0 kB\n" +"KSM: 0 kB\n" "LazyFree: 0 kB\n" "AnonHugePages: 0 kB\n" "ShmemPmdMapped: 0 kB\n" @@ -244,10 +246,10 @@ static int test_proc_pid_smaps(pid_t pid) if (g_vsyscall == 0) { assert(rv == 0); } else { - size_t len = strlen(g_proc_pid_maps_vsyscall); + size_t len = strlen(g_proc_pid_smaps_vsyscall); /* TODO "ProtectionKey:" */ assert(rv > len); - assert(memcmp(buf, g_proc_pid_maps_vsyscall, len) == 0); + assert(memcmp(buf, g_proc_pid_smaps_vsyscall, len) == 0); } return EXIT_SUCCESS; }