From patchwork Thu Nov 10 20:34:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 1470 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp365055wru; Thu, 10 Nov 2022 12:40:23 -0800 (PST) X-Google-Smtp-Source: AMsMyM5fgXbBm9HIaTlSSKFtnpA391nR8kH8Kd7bjFr7m0LPxZSS0vTSColNRiqYrsNYbVg/AP+E X-Received: by 2002:a17:907:1106:b0:78d:5966:b093 with SMTP id qu6-20020a170907110600b0078d5966b093mr3952913ejb.343.1668112823405; Thu, 10 Nov 2022 12:40:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668112823; cv=none; d=google.com; s=arc-20160816; b=TAE8k2yCyjzvYAqM8EKB8CDl3PiFjeX7n8EVPzrq6DQFo9ghONv2WbZp3z+O0vpcLz DGmCtowT+7IUPdrA9qbstUcPRmU8Xu+KjguGqz7H3/mdNE10K0gK9Y/9q1bnKj93oQae oQN/rHOlmAcrcW4+z/Tu5bQSmFTkGkiEts77Hl2xF+OIqquzvha5OTj79Eae+iL3ZfL/ kNoMz/bHOwaah3MPCujWlxI19z4IhQvrZ+dU9kg9ARpXj3Q2Se8/hAK3m+Ac90oFBRhq mje6CPsFdpWPiVn5YG1y2VqPa6R+3IQgaUFEDfmeoGs02H/BZXaji3TanjX1cIXJz890 /A/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :reply-to:dkim-signature; bh=gTisTjUIrNkCCyr4cBDa7S6OIhSv9dwgO2DzrZiSE80=; b=shJ0UudmKhnbL0rQBAFYkX8C9PrHeb0KZoV/wH4wiAs2mvnf7flqD5/mftSO+qM0nZ iy5kyfB7gzSz7Irq2M4K2++jg3uK121+3YS64x0y5wVlgyG+J2I5ZTtG10VVdHTuaEWf Hib9og96nFYjYyLi2VtpRqamLKqc8HHDzhN7iEoYaACB7Mwl+CfaEMx0RYn4W/EnrQ5M BG5lMuVeUl3mnHBhSQEobN0hCoVzvn29gRMJ3f+1w+gCdU94FCHRlLt7zvVTUEAV6ETe UIwXCmfLJXg9q1qU+3Mob1z76E0bxrLqst8fzlD6FhH/h0KXjvcJlBolAyBQ1cMKccOo RjtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ZdCPwF6l; 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=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa30-20020a170907869e00b00741a16e8562si209653ejc.826.2022.11.10.12.39.59; Thu, 10 Nov 2022 12:40:23 -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=@google.com header.s=20210112 header.b=ZdCPwF6l; 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=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231887AbiKJUfL (ORCPT + 99 others); Thu, 10 Nov 2022 15:35:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231862AbiKJUfJ (ORCPT ); Thu, 10 Nov 2022 15:35:09 -0500 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F54D4FF99 for ; Thu, 10 Nov 2022 12:35:07 -0800 (PST) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-36fc0644f51so26073497b3.17 for ; Thu, 10 Nov 2022 12:35:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:reply-to:from:to:cc :subject:date:message-id:reply-to; bh=gTisTjUIrNkCCyr4cBDa7S6OIhSv9dwgO2DzrZiSE80=; b=ZdCPwF6lspGNSSyrb0tpnZ31ekYKyax6xWK8BW5KDDlXZZE8z1sCV4DsiArEXI2rSa lzjcNcnBDA9tVUoXbC7xjo8ugGIYBqVbdE1On6aHQn+fNnBs+ZFkKoAKjO4+Z+Lo8kJF PvGRuaeOV4K8QyZ/xMAoo6gENYYZEYzzjIB8rExl42ltExZhXmyAHJVywDfCMJ8yHkJd gqwTdKwGdfSRZfBnpMAsZoLmK29HKuDcl1g44LmaLhTxa/P+CfUPiyGwZ7430VZ2OPj6 7+dp3N8YxE6jK56BY/L1epDXCYyS59msTMmZWLhH9ADBag8FRftpWsEm1kExjwmEncLR wpcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:reply-to :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=gTisTjUIrNkCCyr4cBDa7S6OIhSv9dwgO2DzrZiSE80=; b=uYw+BEAJnkStyyJv04QyQEj21Wi3rTIYmpJJ3PQYDfbLcBsHJxFoA8aKOztrUQzqES NKFOoJxGjLfkgD7sP2J+A4IthjxNJxZ+SpMR8URfypDEuUcY/N2dEFdjN+5jt0Gft5oh 9ZP7golGq32+qAk+ebe78mw5LUrBzOequhh80/7DuIdq5bOhT/NXbDBELQrjVP4/MLTB fIRtqhObyYK52x0DFHGWPMj+Gio55AUPbTdRyOjod4b2LT2qxbh4XWbgp5tpdg8WZBhf PvqWytQUV2i0RMcvRG10r1ROS4Z0gGvQAOu8f+duxJMUxtDkbjbay3G0llObxWXrmSQO 4RCA== X-Gm-Message-State: ACrzQf149+LN0LS5QEFrC8PNtnUgnRd9dpU+5JzoXyQa6uusPZtRH+XC c+8qOmaKFuOYwixEoLurlRqR4sLFp24= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a25:1181:0:b0:6bf:bd96:2b01 with SMTP id 123-20020a251181000000b006bfbd962b01mr62705133ybr.17.1668112506706; Thu, 10 Nov 2022 12:35:06 -0800 (PST) Reply-To: Sean Christopherson Date: Thu, 10 Nov 2022 20:34:59 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog Message-ID: <20221110203504.1985010-1-seanjc@google.com> Subject: [PATCH v2 0/5] x86/kasan: Bug fixes for recent CEA changes From: Sean Christopherson To: Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, Andrey Ryabinin Cc: "H. Peter Anvin" , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, Sean Christopherson , syzbot+ffb4f000dc2872c93f62@syzkaller.appspotmail.com, syzbot+8cdd16fd5a6c0565e227@syzkaller.appspotmail.com X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749143072267102377?= X-GMAIL-MSGID: =?utf-8?q?1749143072267102377?= Three fixes for the recent changes to how KASAN populates shadows for the per-CPU portion of the CPU entry areas. The v1 versions were posted independently as I kept root causing issues after posting individual fixes. v2: - Map the entire per-CPU area in one shot. [Andrey] - Use the "early", i.e. read-only, variant to populate the shadow for the shared portion (read-only IDT mapping) of the CEA. [Andrey] v1: - https://lore.kernel.org/all/20221104212433.1339826-1-seanjc@google.com - https://lore.kernel.org/all/20221104220053.1702977-1-seanjc@google.com - https://lore.kernel.org/all/20221104183247.834988-1-seanjc@google.com Sean Christopherson (5): x86/mm: Recompute physical address for every page of per-CPU CEA mapping x86/mm: Populate KASAN shadow for entire per-CPU range of CPU entry area x86/kasan: Rename local CPU_ENTRY_AREA variables to shorten names x86/kasan: Add helpers to align shadow addresses up and down x86/kasan: Populate shadow for shared chunk of the CPU entry area arch/x86/mm/cpu_entry_area.c | 10 +++----- arch/x86/mm/kasan_init_64.c | 50 +++++++++++++++++++++++------------- 2 files changed, 36 insertions(+), 24 deletions(-) base-commit: 0008712a508f72242d185142cfdbd0646a661a18