From patchwork Sat Sep 30 05:00:31 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: 146980 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp572911vqb; Sat, 30 Sep 2023 13:52:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFCXzz6Cmdgl9xPPZfC63oz8uHgYhYnQ9UDw1M54Eo6og2cT4wOL+2gypSPnlE64aR69DRK X-Received: by 2002:a17:90a:8903:b0:268:553f:1938 with SMTP id u3-20020a17090a890300b00268553f1938mr6699338pjn.4.1696107163079; Sat, 30 Sep 2023 13:52:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696107163; cv=none; d=google.com; s=arc-20160816; b=vnwfv/7ki+Vc815IWi/kCVIJXaSrQeS3J9RCPH5koD4jjExhXvOzJauOzQg1MwH1nV YKdgQuKRsteOEdSbcVG9xXL9QrBIKh+30viHNWpVI2eL5sgR2ahfSTALQUHkgd05q6V9 QNmVKfLpv8P3ieBwg2f/0WOjiOaBuWsvzTXnu4p279v5Fnlvh0wy2FJZ+sooUxdrIV/V u8/4YkoSXKXfW//ObtXvPOpNrUxQ6FjED0vei+uBxOLJbL9640+PbqKfkY7pXTHDMZ2h OXLxfOYoPANut8PUfjlX1mHC0fZz4SSISf/7RvkSoBh7kVz/uNX6u05djh5heZfyTNDF oSOQ== 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=9UNIhEufzQwgDPjs0KxNTWIPnnrU94TNvqQfHawN6Ek=; fh=Cyy0paYSqXv7Hu83I/CfPA8OsrJkBwQIuusifjue/5U=; b=mdnddWO/g15wZr16qfI9YSMai0OZdb88te6Tgbk3gVRaLdfaEV4qkK3Hwwh7LkFojV 4ZzV+i0oCHOGMeLfJqfy2VB0ENUxIC+OVLygVoHaclMwimlA8Dy43/gRgXwChUfhu1eG lXDhoj/VxlQp688up77hEx9ZvocFQTzt3lXs78oJkEgRVaE/hAH9RkBKRVKnHUbHMGGm 1OhKdiL6/MpUZgJj3JYFylOo54GxoYAAfEHIG+NMpKsKSWqBEt+3beiOo7SC3rEnpjn1 VrKB2Do6/00biJUwsERDGUqrNYpluQ0l9drsM728fgDaKJRYSO0ALjA5KYJKpu3TsiyX U7aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hjvt9rgd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id nv6-20020a17090b1b4600b00277636a9e5csi4566390pjb.96.2023.09.30.13.52.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 13:52:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hjvt9rgd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 0A02F867F1CB; Fri, 29 Sep 2023 22:04:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234103AbjI3FEX (ORCPT + 19 others); Sat, 30 Sep 2023 01:04:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234245AbjI3FDm (ORCPT ); Sat, 30 Sep 2023 01:03:42 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C55401BE; Fri, 29 Sep 2023 22:02:28 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-577e62e2adfso10221548a12.2; Fri, 29 Sep 2023 22:02:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050148; x=1696654948; 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=9UNIhEufzQwgDPjs0KxNTWIPnnrU94TNvqQfHawN6Ek=; b=hjvt9rgdArJTKxAh3KZYRzCVF76mT/jhVvgVRswetn92DMW/ceiIkYAiA920AC3LBS 48wonSkESEV0MClwYBzrAPVRNvFZvBu7lOkQgHTWkF6UT5xuj9MGKLmVxx5NMo53TaJW 5mRxP02XwYgUYf2TAAmhDswS3V0hSmCQuEBOy0OPPAYVEJh6K5dVTC5CVeOtKwT25wvc lLsLs7XhBhNUCaH+WbDgqVxMjPPE5plxHojF9WFj7rsp3BdF1A3YkYhpQ1DTFcojQZ8y xuhd2ACHnzaxKLRpr9/+/RbYq818aDYlOYBtSx0C84m29GhNre64V3o0m7XU8HOA0DLp TCjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050148; x=1696654948; 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=9UNIhEufzQwgDPjs0KxNTWIPnnrU94TNvqQfHawN6Ek=; b=M+smeOnQmx542mX/j7E1W+jpguBI7b2vZ6v6kAllnm14L0Y6IHzlYd0LsdOFlE+VoP znf2Vzl3UWMueJYVmetCMIfvd+yK2bIWT4OblCoiod4n1mwsp/TiHPBULLjcU9C1KxGr IQyq6gAOCaMuim88rpWlwkmRXChN1DPz1U58Y4DBfnrAO3DKTu65c9MEmkjG2BoAJL20 85hJDEGXvzIem542DofSMEGwWXUSLfPR2vrK82CFqEElMMcGfzW7HjSHmn/JygqoqV9j 62IgC+ezB9r1OzbR+OrVN9LnPBCwyDC+Lqf7pAhRJEj8RDxqUU5Y6kY6Ri+UX0dhzc3c jK/g== X-Gm-Message-State: AOJu0YyUdQQH0RTIdVTe0VfkyWTVPaHp+j09t/gKfmVEI8lgw/sXnFBt DaHHgLZ6R6bwJgJtusx8n/k= X-Received: by 2002:a17:902:e881:b0:1c4:4c10:6ae3 with SMTP id w1-20020a170902e88100b001c44c106ae3mr6845902plg.23.1696050148169; Fri, 29 Sep 2023 22:02:28 -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.02.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:02:27 -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 , Miklos Szeredi , Amir Goldstein , linux-unionfs@vger.kernel.org Subject: [PATCH 27/29] overlayfs: move xattr tables to .rodata Date: Sat, 30 Sep 2023 02:00:31 -0300 Message-Id: <20230930050033.41174-28-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 (howler.vger.email [0.0.0.0]); Fri, 29 Sep 2023 22:04:43 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778497264451607165 X-GMAIL-MSGID: 1778497264451607165 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to ovl_trusted_xattr_handlers or ovl_user_xattr_handlers at runtime. Cc: Miklos Szeredi Cc: Amir Goldstein Cc: linux-unionfs@vger.kernel.org Signed-off-by: Wedson Almeida Filho Acked-by: Amir Goldstein --- fs/overlayfs/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index cc8977498c48..fe7af47be621 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -477,13 +477,13 @@ static const struct xattr_handler ovl_other_xattr_handler = { .set = ovl_other_xattr_set, }; -static const struct xattr_handler *ovl_trusted_xattr_handlers[] = { +static const struct xattr_handler * const ovl_trusted_xattr_handlers[] = { &ovl_own_trusted_xattr_handler, &ovl_other_xattr_handler, NULL }; -static const struct xattr_handler *ovl_user_xattr_handlers[] = { +static const struct xattr_handler * const ovl_user_xattr_handlers[] = { &ovl_own_user_xattr_handler, &ovl_other_xattr_handler, NULL