Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp950042rwl; Thu, 5 Jan 2023 06:51:32 -0800 (PST) X-Google-Smtp-Source: AMrXdXt9LzR95/0TXJFQ4d0gPAszQPlEYdoQ1niqokXW3bFErZBcIvOOt/B/9Ywnj5z2UZBaDe2a X-Received: by 2002:a05:6402:3985:b0:467:9976:2e38 with SMTP id fk5-20020a056402398500b0046799762e38mr48121936edb.18.1672930292006; Thu, 05 Jan 2023 06:51:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672930291; cv=none; d=google.com; s=arc-20160816; b=ChMCpaJwfrj37lT254n6ecTBGzsWw+CRdE1P5jw8v8lvyxsml7jytZEnqjhwarxQcu a6JRKa2KFSQVugRe+Zf03QkT4K2Nw8Agx+IuaoOKAGtOUoXwvmWUcxxYlMygbDhk9CZc xxascLeh2LqX+NdA1tfRt9Ew0h4BcUaN3xTnsKFNvL96G0ePxPC96y6FjZds8ShqSB3n yBcFvYzJ+x/mZdA48iFQVBxoJhb1Zzx0RPzBxMSi4znwX01coVRdzI4SfT4OasJUYGPf MUug+cCLDwEzknAD796Gz5DCVhXduif/tx6mkmh1viWur4cT+vnRzQ/qccMgXqF5OYVh k9QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=KI88ddFjWKkuzUOtDfBNJeuHrq8LZ9xQwEmrI18ahQs=; b=jUJzWk2NG8BU3XxBVAchNtas4m/51gJDqkJqYti3cS3yjRAc8RaH4Ok13J4pQryM/k 9XqZbfk5Qf6kqN851rIVjw1GWcJcCgJEEulM2p2lwFZDxJxzTdJZ2EyUCQw6yJ1H6Gab NW++uuL5HJkMvDtqyM8EP3Ee6SRYE2umqEEXNpziHCf5wQaRKvODOg6HYQTSz13KkccC 9mA6qu+cnII2AL0wR9t7uf/Ed+vUfoZn+lon/Bj8Ahy99vZXles7v7OOnyyDvyqgTvom G1/f0ySnKQjSGCels40aXvkD79mhYkzYGfrYOWP1moFkRrINjh/hQnwUdJDm9vO3lWbG qgHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@scylladb.com header.s=google header.b=BOGgzGnW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=scylladb.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y17-20020a056402359100b00461dc830100si36136777edc.452.2023.01.05.06.51.18; Thu, 05 Jan 2023 06:51:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@scylladb.com header.s=google header.b=BOGgzGnW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=scylladb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234079AbjAEOLq (ORCPT + 55 others); Thu, 5 Jan 2023 09:11:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234322AbjAEOLc (ORCPT ); Thu, 5 Jan 2023 09:11:32 -0500 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F6D654737 for ; Thu, 5 Jan 2023 06:11:32 -0800 (PST) Received: by mail-pj1-x102e.google.com with SMTP id c8-20020a17090a4d0800b00225c3614161so2103986pjg.5 for ; Thu, 05 Jan 2023 06:11:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=scylladb.com; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=KI88ddFjWKkuzUOtDfBNJeuHrq8LZ9xQwEmrI18ahQs=; b=BOGgzGnWyZJLBdQXhLHwWy0IskfokqvbD02y+h83alCNPRx6k5voX92lS9WTcJEGai GF3pQ97xddFkg3pqTNXXsxHTZqwKevz+83E4rB8LCEN87i/fnpVe7yDI2liJNMqLURhP o/k0muKEP+LoTQJIeywSZH0r8v9HdYg0ACI7W/6RvA9SAjgxd1nTJfVryCE43vvWKdZD uUKbqaX2gp/pAAEnR9NWWBGMe6J6tSRgsNk3r1iE2SwnkNLODrd/CHCxYl8u9EArzcjt 2lPoDchqj7UNSUwxgZbQmiu0iDi6eWEo5dT/7OnysYPuScY+y1AFP6Vhb/mhMZ1wenrD HbwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KI88ddFjWKkuzUOtDfBNJeuHrq8LZ9xQwEmrI18ahQs=; b=tsLYlDVz9QIFl8K0roJ3/FTCZKwjE1d591WOSK7pv9JOgCj/hW93o+TctmTlieD/RH 7gNS+/0HcdFAslvCDfx76NFnE3EIlXP6fVoalLroM1MlI8e2f+0gZzE0W94Z6mwv2P1Z zkrje4nYn46Ot7awxIORTfdgR2dPzfgReKp/2GB4QATzT5Uvo7j1k5BtID0gCwcPsq+4 N9h0G9DaceOqMO3BY8HHMZkF9CChZi38x5dxE8HTtux7Og521L98OEuHNY8hj/FezfmH ukj4SNhcnRa1u8M2PM73NC6HhOGOeiROaKiwtZuT9UUo+Yizd8HEohf+KKJ+5V0KzHQ6 60UQ== X-Gm-Message-State: AFqh2koRoJWb1M/3og6pYfV9ZcE3XUhDGQ+tLwoNkZmtEoniw5rI84qq v8Ino0qoLHpNeiCSRk1Pj8LyqI/9E2f9oWzGLbr9xWJss9O0It6x0/Q4f/XVCc+2laHiu9gQZPR sauB8r/67F9l7x2g4xOiAEpENjjPOV2ZEyh4NEXF5Y+ukkBpF/kQnm0OE4eEKsrLOPilfZjJF4J rBSDEhy5Jg7qAqMwol0XIkE6h+abKBVdJrqJUJ6e4qssWSMVIXGNIQTvbrPVb5xMbhOg== X-Received: by 2002:a17:902:c245:b0:192:6195:44cd with SMTP id 5-20020a170902c24500b00192619544cdmr3725829plg.126.1672927891556; Thu, 05 Jan 2023 06:11:31 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: "Raphael S. Carvalho" Date: Thu, 5 Jan 2023 11:11:15 -0300 Message-ID: Subject: Re: [PATCH] selftest/x86/meltdown: Add a selftest for meltdown To: Greg KH Cc: Aaron Lu , Dave Hansen , Pavel Boldin , Pavel Boldin , Moritz Lipp , Daniel Gruss , Michael Schwarz , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-CLOUD-SEC-AV-Sent: true X-CLOUD-SEC-AV-Info: scylladb,google_mail,monitor X-Gm-Spam: 0 X-Gm-Phishy: 0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 5, 2023 at 10:42 AM Greg KH wrote: > > On Thu, Jan 05, 2023 at 08:35:05PM +0800, Aaron Lu wrote: > > To capture potential programming errors like mistakenly setting Global > > bit on kernel page table entries, a selftest for meltdown is added. > > > > This selftest is based on Pavel Boldin's work at: > > https://github.com/linux-test-project/ltp/blob/master/testcases/cve/meltdown.c > > > > In addition to the existing test of reading kernel variable > > saved_command_line from user space, one more test of reading user local > > variable through kernel direct map address is added. For the existing > > test(reading saved_command_line) to report a failure, both the high kernel > > mapping and low kernel mapping have to be in leaked state; For the added > > test(read local var), only low kernel mapping leak is enough to trigger > > a test fail, so both tests are useful. > > > > Test results of 10 runs: > > > > On v6.1-rc8 with nopti kernel cmdline option: > > > > host test_out_rate_1 test_out_rate_2 > > lkp-bdw-de1 50% 100% > > lkp-hsw-d01 70% 100% > > lkp-hsw-d02 0% 80% > > lkp-hsw-d03 60% 100% > > lkp-hsw-d04 20% 100% > > lkp-hsw-d05 60% 100% > > lkp-ivb-d01 0% 70% > > lkp-kbl-d01 100% 100% > > lkp-skl-d02 100% 90% > > lkp-skl-d03 90% 100% > > lkp-skl-d05 60% 100% > > kbl-vm 100% 80% > > 2 other machines have 0% rate for both tests. > > > > bdw=broadwell, hsw=haswell, ivb=ivybridge, etc. > > > > test_out_rate_1: test reports fail rate for the test of reading > > saved_command_line from user space; > > test_out_rate_2: test reports fail rate for the test of reading user > > local variable through kernel direct map address in user space. > > > > On v5.19 without nopti cmdline option: > > host test_out_rate_2 > > lkp-bdw-de1 80% > > lkp-hsw-4ex1 50% > > lkp-hsw-d01 30% > > lkp-hsw-d03 10% > > lkp-hsw-d04 10% > > lkp-kbl-d01 10% > > kbl-vm 80% > > 7 other machines have 0% rate for test2. > > > > Also tested on an i386 VM with 512M memory and the test out rate is 100% > > when adding nopti to kernel cmdline with v6.1-rc8. > > > > Main changes I made from Pavel Boldin's meltdown test are: > > - Replace rdtscll() and clflush() with kernel's implementation; > > - Reimplement find_symbol_in_file() to avoid bringing in LTP's library > > functions; > > - Coding style changes: placing the function return type in the same > > line of the function. > > > > Signed-off-by: Aaron Lu > > --- > > Notable changes from RFC v3: > > - Drop RFC tag; > > - Change the base code from zlib licensed one to GPL licensed one. > > Sorry, but this still gets my NAK for the issues raised in previous > reviews that are not addressed here for some reason :( Greg, the selftest is no longer based on https://github.com/IAIK/meltdown/blob/master/LICENSE, which is originally zlib licensed. In this version, Aaron is basing the test on https://github.com/linux-test-project/ltp/blob/master/testcases/cve/meltdown.c, which is indeed licensed with: GPL-2.0-or-later > > greg k-h