Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp267113pxm; Tue, 22 Feb 2022 23:04:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJzhZysifgaJwQJtR3DkbOo7nMnMcU1aZDytpLDlaZtg61T/lQi9ZsXCeMEBHmAp5Oe650Ya X-Received: by 2002:aa7:cc82:0:b0:410:d2b0:1a07 with SMTP id p2-20020aa7cc82000000b00410d2b01a07mr29268927edt.359.1645599847179; Tue, 22 Feb 2022 23:04:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645599847; cv=none; d=google.com; s=arc-20160816; b=KGRFZBJ+WRJ9P9pVa/wOzQtW9Vj9wRXi7kcSvTVgtmwOJ5PU5QLiX9QdOtDsmVt4pe U2+9JmmQHMAbsGMhsJR38xlhdESTLUSvqmF53o0K9KVK+3N87/Ia3YF2TmznmifamCbS cEQtz8fdR8M/+OINjgqb2D9EDUJxDTBii9BxNXmrRWWiGPiqoWUev0zkpBwY1ZKn7WPp wOnaFNr5TfmVR36kAXGaUKc2+puE9YvTSzBElh27bBSt3pYt7HBYLgGPAlEiPheh/ig7 i5xOGics2/4mqd0ZTBFN9PpS9mt/i3epqpePgYinVgnsa5D9pEB2/k4/1X6Uq3jE6gIu vJ3A== 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:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=MBcUE/GjgKAOqkE7k3I16nNGFc2xdrG3rcZqdKaqU1M=; b=B7d7+mKISwn3uVqRSeR1hoUUu8cq8uQS5UbORROqBOPxFNRSafLenFjIkAUOZ8nnUH FYp+eWGX6kTgzFcR/KaxqvrcXYzRs/Duvbwp3MCa8p4C9eZnFriYyAY1Tg/YNJjB7G0D uLHGnt0j+FPh/ke0nG+uL0k2XAsQwdeNv7tzvAhDLMV9UJdG7vjiMQEGDx+4Rb9s3UoC ZAvCl57aon2BGfcIW+PAlqoeN9p+UPhoM2X2vuLgH8epX0tvQxKdc3LOTlNecSzfd9Be kw9efqOWizsrc08qKh2HSEjOgQIYPnO+GGmZcdSTYA+WbRGqVvga6cVvOz3P7ijnVxoU 8Tcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=huyqkiXg; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f15si12560551ejj.553.2022.02.22.23.03.41; Tue, 22 Feb 2022 23:04:07 -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=huyqkiXg; 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 S238590AbiBWF2B (ORCPT + 99 others); Wed, 23 Feb 2022 00:28:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238402AbiBWF0w (ORCPT ); Wed, 23 Feb 2022 00:26:52 -0500 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E16006A06E for ; Tue, 22 Feb 2022 21:25:17 -0800 (PST) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-2d306e372e5so163264787b3.5 for ; Tue, 22 Feb 2022 21:25:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=MBcUE/GjgKAOqkE7k3I16nNGFc2xdrG3rcZqdKaqU1M=; b=huyqkiXgbsdUUaeO2YcSpDguTaIsD2ZiHBttX5Znp2Wu7SotB1quckmXNNZhq3hhVZ CvfghBA5TRiyV7nNwREBXze4Ut4RZl9/dXE69gre6OrHccOhGsM1R39ve/3Fg95dFOoY BvDeP6788/BG9zG4uemrkiHvTMwkxVsftUJqZuGB4ivr+/aWtu4qk7dIqmSXEwo1GhxB UQrfqBGsjla2ZXhbWoUWiWOKjoE4zvV4OfIuCxJHeuNkl1zKwODoNYWYiaOMSwj9wOKz BS0K9yywZ4zV80Is1LL2lLof7xLiZKUcwJTWCzQDyX5SOghoozr2KNat8Mt1uT82lph4 NHIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=MBcUE/GjgKAOqkE7k3I16nNGFc2xdrG3rcZqdKaqU1M=; b=fadY7nuPGCjs2m8c4anZz0ZNASynst2NWM9WoKFAF/r7bGQFanBdCtVezGRTI8CEPY 34kHJBWq5HrUHPp7jsBSxkBsoEv/PKqZS2gLO7k0h43gHRZqeC/5te7rMJgIVRvrY9g3 gBQtPURAyXr6dyYpU67isYyWlObJUvQKCj2CgIEsGhjk67xn3vgUae5ka2hWbdimimVS 2da3NWWv9m759gbG2kFo9UN0qbH2+8cocjE5V7bWuFVbIII9tZGsOWff0LoxvPqIJGr2 AJqT5IHXMw8aoQWEjXzbwrL/zYhuPnYcp8qLL7IgnsYxwDrGvxyYGTenJPiU4iPKIY9x j+vw== X-Gm-Message-State: AOAM531v3k0x79rP3cGruSJV4dXneT/qNfNlbQpUMEv4J1aIe6eobO87 r9wbpU4PFKviCkvtcJ3TMGa3GrvdKF0G6jFhw6vI3lsKilnwpzlfBvYcwFjHgwCZeYJ2iNlR+q7 uUcYFbWDmcsFi/IwkqDLOlbRYnWgjUq//DnYceEofJG8HxVQJlVIljlIkGv9hX+x2fyyhNTwV X-Received: from js-desktop.svl.corp.google.com ([2620:15c:2cd:202:ccbe:5d15:e2e6:322]) (user=junaids job=sendgmr) by 2002:a81:7d56:0:b0:2d6:90d9:770c with SMTP id y83-20020a817d56000000b002d690d9770cmr26589608ywc.277.1645593908116; Tue, 22 Feb 2022 21:25:08 -0800 (PST) Date: Tue, 22 Feb 2022 21:22:13 -0800 In-Reply-To: <20220223052223.1202152-1-junaids@google.com> Message-Id: <20220223052223.1202152-38-junaids@google.com> Mime-Version: 1.0 References: <20220223052223.1202152-1-junaids@google.com> X-Mailer: git-send-email 2.35.1.473.g83b2b277ed-goog Subject: [RFC PATCH 37/47] mm: asi: ASI annotation support for static variables. From: Junaid Shahid To: linux-kernel@vger.kernel.org Cc: Ofir Weisse , kvm@vger.kernel.org, pbonzini@redhat.com, jmattson@google.com, pjt@google.com, alexandre.chartre@oracle.com, rppt@linux.ibm.com, dave.hansen@linux.intel.com, peterz@infradead.org, tglx@linutronix.de, luto@kernel.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" 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,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL 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 From: Ofir Weisse Added the following annotations: __asi_not_sensitive: for static variables which are considered not sensitive. __asi_not_sensitive_readmostly: similar to __read_mostly, for non-sensitive static variables. Signed-off-by: Ofir Weisse --- arch/x86/include/asm/asi.h | 12 ++++++++++++ include/asm-generic/asi.h | 6 ++++++ include/asm-generic/vmlinux.lds.h | 18 +++++++++++++++++- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/asi.h b/arch/x86/include/asm/asi.h index bdb2f70d4f85..6dd9c7c8a2b8 100644 --- a/arch/x86/include/asm/asi.h +++ b/arch/x86/include/asm/asi.h @@ -177,6 +177,18 @@ static inline pgd_t *asi_pgd(struct asi *asi) return asi->pgd; } +/* IMPORTANT: Any modification to the name here should also be applied to + * include/asm-generic/vmlinux.lds.h */ +#define ASI_NON_SENSITIVE_SECTION_NAME ".data..asi_non_sensitive" +#define ASI_NON_SENSITIVE_READ_MOSTLY_SECTION_NAME \ + ".data..asi_non_sensitive_readmostly" + +#define __asi_not_sensitive \ + __section(ASI_NON_SENSITIVE_SECTION_NAME) + +#define __asi_not_sensitive_readmostly \ + __section(ASI_NON_SENSITIVE_READ_MOSTLY_SECTION_NAME) + #else /* CONFIG_ADDRESS_SPACE_ISOLATION */ static inline void asi_intr_enter(void) { } diff --git a/include/asm-generic/asi.h b/include/asm-generic/asi.h index fffb323d2a00..d9082267a5dd 100644 --- a/include/asm-generic/asi.h +++ b/include/asm-generic/asi.h @@ -121,6 +121,12 @@ void asi_flush_tlb_range(struct asi *asi, void *addr, size_t len) { } #define static_asi_enabled() false +/* IMPORTANT: Any modification to the name here should also be applied to + * include/asm-generic/vmlinux.lds.h */ + +#define __asi_not_sensitive +#define __asi_not_sensitive_readmostly + #endif /* !_ASSEMBLY_ */ #endif /* !CONFIG_ADDRESS_SPACE_ISOLATION */ diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 42f3866bca69..c769d939c15f 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -374,10 +374,26 @@ . = ALIGN(PAGE_SIZE); \ __nosave_end = .; +#ifdef CONFIG_ADDRESS_SPACE_ISOLATION +#define ASI_NOT_SENSITIVE_DATA(page_align) \ + . = ALIGN(page_align); \ + __start_asi_nonsensitive = .; \ + *(.data..asi_non_sensitive) \ + . = ALIGN(page_align); \ + __end_asi_nonsensitive = .; \ + __start_asi_nonsensitive_readmostly = .; \ + *(.data..asi_non_sensitive_readmostly) \ + . = ALIGN(page_align); \ + __end_asi_nonsensitive_readmostly = .; +#else +#define ASI_NOT_SENSITIVE_DATA +#endif + #define PAGE_ALIGNED_DATA(page_align) \ . = ALIGN(page_align); \ *(.data..page_aligned) \ - . = ALIGN(page_align); + . = ALIGN(page_align); \ + ASI_NOT_SENSITIVE_DATA(page_align) #define READ_MOSTLY_DATA(align) \ . = ALIGN(align); \ -- 2.35.1.473.g83b2b277ed-goog