Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp3647264ooa; Mon, 13 Aug 2018 15:39:11 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwBvGOPr9yDVcGwk33PItFjWfKw1WrPQTq1fIcKgBFFy09d/zwQ0wJWlTMAaIGy1Ay9LfIO X-Received: by 2002:a17:902:a5:: with SMTP id a34-v6mr18329917pla.60.1534199951842; Mon, 13 Aug 2018 15:39:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534199951; cv=none; d=google.com; s=arc-20160816; b=Uj6wCqq9BbsPBmUqDGaWGGsVrGBRZBuVolPuP22yrGv9FM1ee5ylcvqJHC5jiYb+kn 5VTz1Bpyd/p21Id/juXaK5edFnn7RhtsH02r4SNv6Fy7QwMkJEJOECbGT0ifRK/VCaOo hAvdP62e7FubmoSeq76+QWfwljhTEes7OgnaICtvVUsZiKIqAZ9DABSNCJZniEXayns3 U7f9TNcpsPLcnOWNRN3Nxe0RMn65/k5eSrV7lxRGUhmqNhJQFvLMYTuIEIsXU/QLWfiw 9kp/QxBYcYNMCH9cXGEvQCaNBIj7hXN2Je78rKAhRNYqw42AvxjZggzdkxFF7Ppj7E4p wPng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=XAfGOK4B2MMbWewPI4MQYpStA+Plkj+5dy9ZnWeSt44=; b=xSEb6l8gM0iBHC4Ll+qG+ww+vJ57RBdkrVH+vJK/wKgCbBQu43MsL1s33YlSro88wH JT0xfvFMLq6Y+MfgEgv3OboaJ7coOnXZ5pZwG7LCSPZktLkC/kwoyKLZ2c0KV3xj8Niz lVJ5rRCg6iBdBKGzTrVRaUGCqqL5notTgsMd68904EnSgbH+7I2eI//R1Vp/9T7i6NQF 2+PTORREnFCZIRhkvfq1Byrt4Ip/qkjCefZkBOtqMqPP2c+K3LOUxcH+k8imfyDb5kG4 RPvAD1+QHT6nZZJrnJsOJIlLafomtxOaE+cU15XzaaQlCY91GkntdSvbRtFk67MH3dja 220g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=X32hKi3k; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j38-v6si17327615pgj.613.2018.08.13.15.38.56; Mon, 13 Aug 2018 15:39:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=X32hKi3k; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731691AbeHNBVy (ORCPT + 99 others); Mon, 13 Aug 2018 21:21:54 -0400 Received: from mail-yw1-f65.google.com ([209.85.161.65]:38808 "EHLO mail-yw1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730131AbeHNBVy (ORCPT ); Mon, 13 Aug 2018 21:21:54 -0400 Received: by mail-yw1-f65.google.com with SMTP id r3-v6so14828439ywc.5 for ; Mon, 13 Aug 2018 15:37:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=XAfGOK4B2MMbWewPI4MQYpStA+Plkj+5dy9ZnWeSt44=; b=X32hKi3kCmVGFK50uTpkXksdqEwSiF6VPY2eUgBQGyUxIfwZBKoth8wlZmrIEwp1w1 k8JstpwqGGbyd5U2eMoSRPSQ/I0Jz9acNNEoY7fkN+DPy82r0wCUHTf1pqutCXTEh2/V ZnqJehWnlsXcSukrm7fm9QhT9YFIhOXd18XSM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=XAfGOK4B2MMbWewPI4MQYpStA+Plkj+5dy9ZnWeSt44=; b=NV1EWXJoZy6oRYmh7NggCX49r/EAEM2X4hKHBOmQfx3JvqyHz4k/xt2WBH1yRQ+JfP aRxXiQnFUF6di1AzJt+y50ZPGeBhxcYXIKq7qYxaMYvxGoK4e48hVVIcoeYTFzfEGHc/ q3txcgh1GSMb8BTpVhdY4bHycghgY9Bv3V5+prXmQyZmXeN/U3yFI9Rordg+4gvlRj3K CHgAWWh5tgyMwfpTGJrB8dGOnOWGHKCyDpokiGUFGNGSZSqIJpKVcBrREB45Y/wH38mM v6AQmhlPrOjaLTccd3pF7/euanyDokTHfINwCBEJwWq2EMbId6fssjDVacdgi88ccMzo vvSA== X-Gm-Message-State: AOUpUlHSI2SHg8x9Wffa1/wnk9MAtgysaXrq/0S8Z/JwWOMJP7SrrZnk 96c7zlW+dqOD8fPHLBEw0/TLuTRT720= X-Received: by 2002:a25:103:: with SMTP id 3-v6mr9419407ybb.421.1534199859226; Mon, 13 Aug 2018 15:37:39 -0700 (PDT) Received: from mail-yw1-f45.google.com (mail-yw1-f45.google.com. [209.85.161.45]) by smtp.gmail.com with ESMTPSA id t6-v6sm10596409ywe.81.2018.08.13.15.37.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Aug 2018 15:37:37 -0700 (PDT) Received: by mail-yw1-f45.google.com with SMTP id l189-v6so14815912ywb.10 for ; Mon, 13 Aug 2018 15:37:37 -0700 (PDT) X-Received: by 2002:a25:a483:: with SMTP id g3-v6mr10175698ybi.309.1534199856525; Mon, 13 Aug 2018 15:37:36 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:2316:0:0:0:0:0 with HTTP; Mon, 13 Aug 2018 15:37:35 -0700 (PDT) In-Reply-To: <20180810154314.96710-1-zsm@chromium.org> References: <20180810154314.96710-1-zsm@chromium.org> From: Kees Cook Date: Mon, 13 Aug 2018 15:37:35 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] perf/x86: Add __ro_after_init annotations To: Zubin Mithra Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , X86 ML , LKML , Guenter Roeck Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 10, 2018 at 8:43 AM, Zubin Mithra wrote: > x86_pmu_{format,events,attr,caps}_group is written to in > init_hw_perf_events and not modified after. This makes them suitable > candidates for annotating as __ro_after_init. > > Signed-off-by: Zubin Mithra Reviewed-by: Kees Cook -Kees > --- > arch/x86/events/core.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c > index 5f4829f10129..88e5f67f5d4c 100644 > --- a/arch/x86/events/core.c > +++ b/arch/x86/events/core.c > @@ -1584,7 +1584,7 @@ static void __init pmu_check_apic(void) > > } > > -static struct attribute_group x86_pmu_format_group = { > +static struct attribute_group x86_pmu_format_group __ro_after_init = { > .name = "format", > .attrs = NULL, > }; > @@ -1715,7 +1715,7 @@ static struct attribute *events_attr[] = { > NULL, > }; > > -static struct attribute_group x86_pmu_events_group = { > +static struct attribute_group x86_pmu_events_group __ro_after_init = { > .name = "events", > .attrs = events_attr, > }; > @@ -2230,7 +2230,7 @@ static struct attribute *x86_pmu_attrs[] = { > NULL, > }; > > -static struct attribute_group x86_pmu_attr_group = { > +static struct attribute_group x86_pmu_attr_group __ro_after_init = { > .attrs = x86_pmu_attrs, > }; > > @@ -2248,7 +2248,7 @@ static struct attribute *x86_pmu_caps_attrs[] = { > NULL > }; > > -static struct attribute_group x86_pmu_caps_group = { > +static struct attribute_group x86_pmu_caps_group __ro_after_init = { > .name = "caps", > .attrs = x86_pmu_caps_attrs, > }; > -- > 2.18.0.597.ga71716f1ad-goog > -- Kees Cook Pixel Security