Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1075300imm; Wed, 25 Jul 2018 11:03:01 -0700 (PDT) X-Google-Smtp-Source: AAOMgpchsUmdHqN2KskJh3poDXYWxH5Sm349ft8a1co7qhl9CCuhxYztzoaY2cly+aXYkEr72EbD X-Received: by 2002:a63:ee4e:: with SMTP id n14-v6mr21985278pgk.159.1532541781569; Wed, 25 Jul 2018 11:03:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532541781; cv=none; d=google.com; s=arc-20160816; b=lrzeczuzCGBsBhJIW3/wNJEoD8Cees707UpZwGODk9rF1PEur396Rk46JdJxn77eHm k/NiWfeQzIJPRJbA3l4sElFpT4/HQjfFDlbAvG4SJ/dSkwcQRJem7ipE7k5autpIKkGW ucyf9eayHGzUk+jarJ21o3fyY1mDeAEFYY9GROXAzo347h5Zh5SUiJFsb78ZahjHnL5S cPG9f0kXRbTsSr2MLF3Vd8MOibU5H3HwDzF5syKsJ05CGDEFdO2aXk6KrFn326IDOMfF HwVUPxh/IXI3AyF4bizV7Hbvsh9hdNc/0wuTEjM+AivaPi7asH0uiRbNc3lW+oS/qeEX M2wg== 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:dkim-signature :arc-authentication-results; bh=uuhDyEcstHBQ8PS0szoXCUUz/3BpR1x30Grc7yDaEtg=; b=P6gYtdOP7KEqfXkQLMESmiNSkH2EUhcSeuC+N+3KydUwQU25WBjw0ZyWQK6qr616hc OGsRqSFdVF0DMfWxrD+o7x/1ZzGyKtxJYkvNR1cqyM2PFpf51nzFU4JKVammv0Ey6Czo S5z7uSkTINqxv6kKBy921Nl4T33KAAxw+YYBLUwrCPeNNfaszOBTp2K8Ouvm9wO79jJJ FTGhX8Dkq6MaM+kfNwsUevLkvlPj16aJhbmGZ5HpnPviG5QaBxhgv0xQnIoHCntf+6b+ nR6StgVnB0yuSuY+QsPfvls2nTlD4LAM/7j9AWxFbhLxO9LXIUhfCCFnIjdlcknfKRqV 7JKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@google.com header.s=20161025 header.b=juJLRXvm; dkim=fail header.i=@chromium.org header.s=google header.b=AIAyLxRl; 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=fail (p=NONE sp=NONE 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 33-v6si13805773plu.283.2018.07.25.11.02.45; Wed, 25 Jul 2018 11:03:01 -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=fail header.i=@google.com header.s=20161025 header.b=juJLRXvm; dkim=fail header.i=@chromium.org header.s=google header.b=AIAyLxRl; 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=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731185AbeGYTNl (ORCPT + 99 others); Wed, 25 Jul 2018 15:13:41 -0400 Received: from mail-yw0-f194.google.com ([209.85.161.194]:36117 "EHLO mail-yw0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729885AbeGYTNk (ORCPT ); Wed, 25 Jul 2018 15:13:40 -0400 Received: by mail-yw0-f194.google.com with SMTP id v197-v6so3181179ywg.3 for ; Wed, 25 Jul 2018 11:00:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=uuhDyEcstHBQ8PS0szoXCUUz/3BpR1x30Grc7yDaEtg=; b=juJLRXvm+Q4cUCLMYEm8zdmYx0QBoN+BVZBOwc0oMx/SCQ6VGL+G78iA2/wHxCYVXz wRSIoOUifvrBJCDVA6oSodF6ytIJnc66QgjXv3wyYK6rgYsfzcAyF06gUhGPeAcuyU6g UrcpSGDT3gdeDskz5gmpuXONeUNo0F6WBEmXyrk4o8HB2gvsDUa+CUrOYJVJOq3ulp0i xXNf9DqXRuYwEGUriTiUI1DcPFozAMhtH5l+/lr21Zcgi5V6cKzCejdddQzHJp4DtbGn 4Fn2Sy55kxQ0TJpREfHJw4eUaNoHPN7NTrn7HYN8X9vJH2yQkrkkB4+k8aMBKsFtcI3H k9pA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=uuhDyEcstHBQ8PS0szoXCUUz/3BpR1x30Grc7yDaEtg=; b=AIAyLxRlBQP0XrdMP1+DuyyCk29OWhBndKK7e7jUAwmVaDzAmEIRAjyAvb2ckzRQcs EYpFR3n4gQ57rLjDrhZ6hlMqD6Qu4Stlk69l9jLB90G2tE9QjYEQA15BjiFIW6Nefi1P AgDvaLvf4qeYISaMnF9RYWOUksWpHwQ+Xwc/A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=uuhDyEcstHBQ8PS0szoXCUUz/3BpR1x30Grc7yDaEtg=; b=Ywu16LgH2Y48UPE/R9bi2eua/R6q/h7T1SS3ispgEUjzA5xDq18ahFqyHjnyZxgbqU 7pnq3sObHmqXAMD2WiuhAzvqYnjKR3bS6xxLtALZ8mkbySFBphEressLpd8FL7UrhkhT sW8A1wsBysUobx0wAP+j9Ml9kiDr67OA17sTHWogrRAEX9khU5Xa+dQhit78Y7mI6+x2 o3w6DbGpXbOkAOZvXd+btXulOdAk4OEAKW/QpphrZKw+gIyn69Loo8+7Nu2d3sYwcwFx MMk//SS3xJf1XNYZ4rWN048BHMAA63OtRjf87RQp7ILKprKVRpZRG5QeeN5/psndTZ5D cK0w== X-Gm-Message-State: AOUpUlET5QU9liSs9Lu7l917Q/f1ItevF5krt0d+Q0ERde5OyPWlqqY4 f1N7TPVT4R6uRfQCpMPoS1ULCdy4wg6uTk6U/dlbxQ== X-Received: by 2002:a0d:d287:: with SMTP id u129-v6mr11863210ywd.95.1532541654329; Wed, 25 Jul 2018 11:00:54 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:6602:0:0:0:0:0 with HTTP; Wed, 25 Jul 2018 11:00:53 -0700 (PDT) In-Reply-To: <20180725171901.4468-1-zsm@chromium.org> References: <20180725171901.4468-1-zsm@chromium.org> From: Kees Cook Date: Wed, 25 Jul 2018 11:00:53 -0700 X-Google-Sender-Auth: sPU5IcjAZs85ev7hAtgin7IOOh8 Message-ID: Subject: Re: [PATCH v2] tracefs: Annotate tracefs_ops with __ro_after_init To: Zubin Mithra Cc: Steven Rostedt , 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 Wed, Jul 25, 2018 at 10:19 AM, Zubin Mithra wrote: > tracefs_ops is initialized inside tracefs_create_instance_dir and not > modified after. tracefs_create_instance_dir allows for initialization > only once, and is called from create_trace_instances(marked __init), > which is called from tracer_init_tracefs(marked __init). Also, mark > tracefs_create_instance_dir as __init. > > Signed-off-by: Zubin Mithra Reviewed-by: Kees Cook -Kees > --- > fs/tracefs/inode.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c > index bea8ad876bf9..7098c49f3693 100644 > --- a/fs/tracefs/inode.c > +++ b/fs/tracefs/inode.c > @@ -53,7 +53,7 @@ static const struct file_operations tracefs_file_operations = { > static struct tracefs_dir_ops { > int (*mkdir)(const char *name); > int (*rmdir)(const char *name); > -} tracefs_ops; > +} tracefs_ops __ro_after_init; > > static char *get_dname(struct dentry *dentry) > { > @@ -478,7 +478,8 @@ struct dentry *tracefs_create_dir(const char *name, struct dentry *parent) > * > * Returns the dentry of the instances directory. > */ > -struct dentry *tracefs_create_instance_dir(const char *name, struct dentry *parent, > +__init struct dentry *tracefs_create_instance_dir(const char *name, > + struct dentry *parent, > int (*mkdir)(const char *name), > int (*rmdir)(const char *name)) > { > -- > 2.18.0.233.g985f88cf7e-goog > -- Kees Cook Pixel Security