From patchwork Sat Sep 30 05:00:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wedson Almeida Filho X-Patchwork-Id: 146894 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp269126vqb; Sat, 30 Sep 2023 01:36:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGFGAw0WyB3+Dbp9YrAPfOIWvhBUsm60B5UCIkpt/wjkpIJhkbSdy3TXsD1+0clKy00ocLq X-Received: by 2002:a05:6a21:4841:b0:161:76a4:4f6e with SMTP id au1-20020a056a21484100b0016176a44f6emr5669005pzc.32.1696063001805; Sat, 30 Sep 2023 01:36:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696063001; cv=none; d=google.com; s=arc-20160816; b=rFYjkvxRN8msroGMvmEOf3o3sSkWByYZ7+uRdbnXhxaG+13uldASySDdvWROytLkNF 8SxtQ31V3oZd7boEiQ6cNkhx6WNYJZIhEwhkd278Na2oFMX/eLQ2k71HtTgN+ebNBB5T uhyndRyRBl09spMK9BrWPNEgxgw/nPLYFcHClA2ZpmwpRZgvQAcuewD01o0nsodd9aoW Tfov8X3Ue1+j8pV8X5LQLJz/H4VUqylO/u+Xg2eI6oGRIuZ66sIXI/WvzqGjcrXhfuTt AR+/6dc3bh7GRrhQro/q83QC0EE+Xx1LFef/+in/nkfC8o+ao3r2OuToWP6wH3xHRvsX AUIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ViPm2eeZWez7GosgS7Ec0gZyjCavTFF5oxKm8MbpuGg=; fh=hwKC6vzNCAbIGbDldwO9jgfg/tFiycdYxLr0CZ8lBz8=; b=MBHuoh6hUpMvuC3VGrJZ+Gt/rkHJJZoqd7OJOaIymFWeyfnGNDpXER6exbAFgjpqub f4RYszQD1OJEUH8yc/8jyG+iOC0IX3ipZ9yDc8xzna5c2WhKTIaKOWlX6JTLGwOfsssR Q3Nl7T3IJ30YHdyq3dQUacieSXEDMXtxTHP0NmJDiG6SvmaIIzHED8/h2QED83hAYa2D c9WZTWZrR3VGV/e5ajtw2wsGw6gpJ3I3IimP37ADyYAeL+hFxnzD9QTonYNZFbX1q/ev BCX6w5TttaEsPsG6TA0wZnnl1DfO1Y6LAMFm2ghvUbq3SiMmcDo2BebG+vVqyI2ncvs4 74nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=SFpLc4tu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id em9-20020a17090b014900b00276bdabe471si3168263pjb.163.2023.09.30.01.36.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 01:36:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=SFpLc4tu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 2407C8311BF2; Fri, 29 Sep 2023 22:02:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234074AbjI3FBf (ORCPT + 19 others); Sat, 30 Sep 2023 01:01:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234037AbjI3FBc (ORCPT ); Sat, 30 Sep 2023 01:01:32 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8E3C1AE; Fri, 29 Sep 2023 22:01:14 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1c328b53aeaso133639595ad.2; Fri, 29 Sep 2023 22:01:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050074; x=1696654874; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ViPm2eeZWez7GosgS7Ec0gZyjCavTFF5oxKm8MbpuGg=; b=SFpLc4tua/KoIENLihOJW6ASf/vqC+aDrOhpgPkrnx7JjTjM/Fd/d/FchnRUM0mjvO lHeP8Qdr0rqgsxiKboNjGoTp5owKliBGUtbbd6UcEyOpmsdpgyEvURiHvkKBdQIZ+Y8U GJzT0W0sThdkbqqhG70jWKxy3zMMhy/Jk6pJuRpeF1hyGttAx2fYlmmVbJ/ogzuyygRd jJCQ2AWPx5m18cCdQKooZOD3MDMDmUCFz8cMlALw15SsRrOg5QwmBUgeeFHQpRgw1f0c 4dj6xdivEvPMlUJUgfIjTyLPsOF+mSauJMa1WD10HmFPZ1kDPDl2Vpsp4+/wjrOL83Tl wccw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050074; x=1696654874; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ViPm2eeZWez7GosgS7Ec0gZyjCavTFF5oxKm8MbpuGg=; b=L/DAsQzv6T/gihmw4t9BevCBzCbhOXEdXa5kUU8u0MbNIQuHClZBgA2MuHd1SSqN6D /cysk1N13FwTiE5cnnRzlpfhOMsLHHigRD6MSPxzybtBm9qibHI1THt8ZqpPlvpyGzXJ qAJS+mVTKa+DdLtiEvvYeCN+C+oSIRoZDkXkgFWoGsXey9riJPupyi4a4sKnjCxp/VRP RR+OSj5H+2IzGDEHfLN1OEGVJo1tvmQrcIHQLUGP7P1Q7l1uqTlWmQdXF7hXvUNfc0w5 7iJpViBbAqovJnMS05Jk9ehRcDK46zAUyy37fxozh/7AJt8T+OsBBZ2EDOyBKTlDPnom ja/w== X-Gm-Message-State: AOJu0Yxum6JAxLGlH4xfEI7zL3u//Wy6zAy1wF7eDRj6HPK3t6swaUuE InX/nq9wJ7YMbuhXvBS6ygk= X-Received: by 2002:a17:903:120b:b0:1c6:d1f:514d with SMTP id l11-20020a170903120b00b001c60d1f514dmr5924330plh.45.1696050073856; Fri, 29 Sep 2023 22:01:13 -0700 (PDT) Received: from wedsonaf-dev.home.lan ([189.124.190.154]) by smtp.googlemail.com with ESMTPSA id y10-20020a17090322ca00b001c322a41188sm392136plg.117.2023.09.29.22.01.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:01:13 -0700 (PDT) From: Wedson Almeida Filho To: Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Wedson Almeida Filho , Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org Subject: [PATCH 05/29] btrfs: move btrfs_xattr_handlers to .rodata Date: Sat, 30 Sep 2023 02:00:09 -0300 Message-Id: <20230930050033.41174-6-wedsonaf@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230930050033.41174-1-wedsonaf@gmail.com> References: <20230930050033.41174-1-wedsonaf@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 29 Sep 2023 22:02:12 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778450958401311612 X-GMAIL-MSGID: 1778450958401311612 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to btrfs_xattr_handlers at runtime. Cc: Chris Mason Cc: Josef Bacik Cc: David Sterba Cc: linux-btrfs@vger.kernel.org Signed-off-by: Wedson Almeida Filho --- fs/btrfs/xattr.c | 2 +- fs/btrfs/xattr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c index fc4b20c2688a..d82d9545386a 100644 --- a/fs/btrfs/xattr.c +++ b/fs/btrfs/xattr.c @@ -442,7 +442,7 @@ static const struct xattr_handler btrfs_btrfs_xattr_handler = { .set = btrfs_xattr_handler_set_prop, }; -const struct xattr_handler *btrfs_xattr_handlers[] = { +const struct xattr_handler * const btrfs_xattr_handlers[] = { &btrfs_security_xattr_handler, &btrfs_trusted_xattr_handler, &btrfs_user_xattr_handler, diff --git a/fs/btrfs/xattr.h b/fs/btrfs/xattr.h index 1cd3fc0a8f17..118118ca3e1d 100644 --- a/fs/btrfs/xattr.h +++ b/fs/btrfs/xattr.h @@ -8,7 +8,7 @@ #include -extern const struct xattr_handler *btrfs_xattr_handlers[]; +extern const struct xattr_handler * const btrfs_xattr_handlers[]; int btrfs_getxattr(struct inode *inode, const char *name, void *buffer, size_t size);