Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1607742rdb; Thu, 7 Dec 2023 04:15:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IERLP1Yhjtvaa1uGpccFqabnc2/KjlSaEA3IU1Z63gcf2aZsLDK/kUBzmg+ePY6w0tCHlyY X-Received: by 2002:a05:6a20:cea7:b0:187:5a4d:7061 with SMTP id if39-20020a056a20cea700b001875a4d7061mr2377604pzb.44.1701951309275; Thu, 07 Dec 2023 04:15:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701951309; cv=none; d=google.com; s=arc-20160816; b=KpDcxWS4yGyrRJMi+c7EHjd3foGv9RdtTGOUU/dMwCKFiCVr8Q0l7BQP6GQTRcP8GX ULF8+/R7hlRhZXVlXo+MG51KH80a1393xFd2A7X8opw99WwDGuixsic/8iqdggrsJLvG WZXUtdZMGyu+u/9hk1s/Bv1sPJpq/tgxcW+43QyiEJbyp3PJe3Rz7HsBpefe+R+GVhzf UGTxWYyKnEnnCRVnO9wY/Z1cA8miAo3+teMLjro17obM0wHyJ0TxPXireUbteCKvnrLm oVICXKkGcQZarlEXD9Uu2DMSUxdsJiFpI5L2Qu5P8e50nnHxbxzsoOqdK6XVKHsgbrZ6 JlqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:in-reply-to :content-disposition:mime-version:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=bNgqifOrvCzR6BLjlz9t55dRqKEhpGVlmA9ZxZqLw5k=; fh=VMiU9mcTfNctAjuTqNEfh9rYBGNzsqL/vcswcPFvNfw=; b=VU6NDpUtkUq96NC8fHE7KPb31Tr5MRquAaMXgBcpln14wTp2rdmm+fcZ5wq1uqGL36 Uw6S6Lq4iZvIQhU3BVF2jOXhlzGAUw5d0mvz71pS0R7geEhOf6ZblDa+dxlyd+z0VWE9 4Mne9LxV0x0xOC8iMbbOfOslLEhI8w9twcIbk0sWvb7Y4u9MwYxz0o2l+/YqW3bCvRG0 I5scuAlwn05A5GKYSJW1jrKHQzZ+3+v748HYiBGmF7YdfsrGpZy7XjJkTh+OXRvGhNd1 WiTmjnOaxY/5zO6XTNt3e3SShCOKIFrdCKk2Mrj3JpiQPwOa1mDPcQSCeRTILFSM5E8J 8Qmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=X8gBS4kF; 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=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id q2-20020a056a00150200b006cea4f04eefsi1163845pfu.280.2023.12.07.04.15.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 04:15:09 -0800 (PST) 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=@samsung.com header.s=mail20170921 header.b=X8gBS4kF; 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=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id E93CF8032E63; Thu, 7 Dec 2023 04:15:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232488AbjLGMOi (ORCPT + 99 others); Thu, 7 Dec 2023 07:14:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232186AbjLGMOh (ORCPT ); Thu, 7 Dec 2023 07:14:37 -0500 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AE4FAC; Thu, 7 Dec 2023 04:14:41 -0800 (PST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20231207121440euoutp018ce731566aabaa789a4c1cd36f316ea0~ei6wR0eL91319513195euoutp01h; Thu, 7 Dec 2023 12:14:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20231207121440euoutp018ce731566aabaa789a4c1cd36f316ea0~ei6wR0eL91319513195euoutp01h DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1701951280; bh=bNgqifOrvCzR6BLjlz9t55dRqKEhpGVlmA9ZxZqLw5k=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=X8gBS4kFNkv0TKGfrRhgt/AMKnhAuDTml0Zl+UV080nSX/0a6ngqr3B4cCI9CerAT oCY/SaCIODIsTlxl1j2+/dq7nf/ilAgzh6X5dW22J8NrvBuaZRM86toecd01lZrI4y 00J7GzxaZ98gGwBUmATuWGvXnL72IVqGoUO5YG+g= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20231207121440eucas1p2d5cdc81f31b5545f71203cb626c86c29~ei6wBaD5F0314903149eucas1p2E; Thu, 7 Dec 2023 12:14:40 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 06.77.09539.F27B1756; Thu, 7 Dec 2023 12:14:39 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20231207121439eucas1p1c8f9aa8c107df1896dc6557569af7dca~ei6vebeqs0274702747eucas1p1u; Thu, 7 Dec 2023 12:14:39 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231207121439eusmtrp1c96348adb57f2e361b3d2020f9509b61~ei6vdxuS52085720857eusmtrp1I; Thu, 7 Dec 2023 12:14:39 +0000 (GMT) X-AuditID: cbfec7f2-515ff70000002543-dd-6571b72f5adc Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 4A.5D.09146.F27B1756; Thu, 7 Dec 2023 12:14:39 +0000 (GMT) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231207121439eusmtip2ed5aeb9528040a552e9139757fbf76dd~ei6vQ8doe0753107531eusmtip2O; Thu, 7 Dec 2023 12:14:39 +0000 (GMT) Received: from localhost (106.210.248.38) by CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 7 Dec 2023 12:14:38 +0000 Date: Thu, 7 Dec 2023 13:14:37 +0100 From: Joel Granados To: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= CC: Luis Chamberlain , Kees Cook , "Gustavo A. R. Silva" , Iurii Zaikin , Greg Kroah-Hartman , , , Subject: Re: [PATCH v2 13/18] sysctl: move sysctl type to ctl_table_header Message-ID: <20231207121437.mfu3gegorsyqvihf@localhost> MIME-Version: 1.0 Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="d4nggmrrrvv2zcqu" Content-Disposition: inline In-Reply-To: <0450d705-3739-4b6d-a1f2-b22d54617de1@t-8ch.de> X-Originating-IP: [106.210.248.38] X-ClientProxiedBy: CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) To CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) X-Bright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yr9ZOaPeR4jnGO92O7d4yi2HehJRcZuenAnHCq57V7v0pb7OO c+4rbl2hbnGhECP+oqsTZj83vf7zmOkCZ8HE1tbJ9kHLNR09jwkm+H4svXU0rC44/49b4GTt NeaqjwtjrM8sW3VXvVmJpTgj0VCLuag4EQDYefhuigMAAA== X-CMS-MailID: 20231207121439eucas1p1c8f9aa8c107df1896dc6557569af7dca X-Msg-Generator: CA X-RootMTR: 20231206055317eucas1p204b75bda8cb2fc068dea0fc5bcfcf0b2 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231206055317eucas1p204b75bda8cb2fc068dea0fc5bcfcf0b2 References: <20231204-const-sysctl-v2-0-7a5060b11447@weissschuh.net> <20231204-const-sysctl-v2-13-7a5060b11447@weissschuh.net> <4a93cdb4-031c-4f77-8697-ce7fb42afa4a@t-8ch.de> <0450d705-3739-4b6d-a1f2-b22d54617de1@t-8ch.de> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email 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]); Thu, 07 Dec 2023 04:15:05 -0800 (PST) --d4nggmrrrvv2zcqu Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Dec 06, 2023 at 06:53:10AM +0100, Thomas Wei=C3=9Fschuh wrote: > On 2023-12-05 14:50:01-0800, Luis Chamberlain wrote: > > On Tue, Dec 5, 2023 at 2:41=E2=80=AFPM Thomas Wei=C3=9Fschuh wrote: > > > > > > On 2023-12-05 14:33:38-0800, Luis Chamberlain wrote: > > > > On Mon, Dec 04, 2023 at 08:52:26AM +0100, Thomas Wei=C3=9Fschuh wro= te: > > > > > @@ -231,7 +231,8 @@ static int insert_header(struct ctl_dir *dir,= struct ctl_table_header *header) > > > > > return -EROFS; > > > > > > > > > > /* Am I creating a permanently empty directory? */ > > > > > - if (sysctl_is_perm_empty_ctl_header(header)) { > > > > > + if (header->ctl_table =3D=3D sysctl_mount_point || > > > > > + sysctl_is_perm_empty_ctl_header(header)) { > > > > > if (!RB_EMPTY_ROOT(&dir->root)) > > > > > return -EINVAL; > > > > > sysctl_set_perm_empty_ctl_header(dir_h); > > > > > > > > While you're at it. > > > > > > This hunk is completely gone in v3/the code that you merged. > >=20 > > It is worse in that it is not obvious: > >=20 > > + if (table =3D=3D sysctl_mount_point) > > + sysctl_set_perm_empty_ctl_header(head); > >=20 > > > Which kind of unsafety do you envision here? > >=20 > > Making the code obvious during patch review hy this is needed / > > special, and if we special case this, why not remove enum, and make it > > specific to only that one table. The catch is that it is not > > immediately obvious that we actually call > > sysctl_set_perm_empty_ctl_header() in other places, and it begs the > > question if this can be cleaned up somehow. >=20 > Making it specific won't work because the flag needs to be transferred > from the leaf table to the table representing the directory. >=20 > What do you think of the aproach taken in the attached patch? > (On top of current sysctl-next, including my series) What would this new patch be fixing again? I could not follow ? Additionally, this might be another reason to set this patch aside :) >=20 > Note: Current sysctl-next ist still based on v6.6. > From 2fb9887fb2a5024c2620f2d694bc6dcc32afde67 Mon Sep 17 00:00:00 2001 > From: =3D?UTF-8?q?Thomas=3D20Wei=3DC3=3D9Fschuh?=3D > Date: Wed, 6 Dec 2023 06:17:22 +0100 > Subject: [PATCH] sysctl: simplify handling of permanently empty directori= es >=20 > --- > fs/proc/proc_sysctl.c | 76 +++++++++++++++++++----------------------- > include/linux/sysctl.h | 13 ++------ > 2 files changed, 36 insertions(+), 53 deletions(-) >=20 > diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c > index c92e9b972ada..c4d6d09b0e68 100644 > --- a/fs/proc/proc_sysctl.c > +++ b/fs/proc/proc_sysctl.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > #include "internal.h" > =20 > #define list_for_each_table_entry(entry, header) \ > @@ -29,32 +30,6 @@ static const struct inode_operations proc_sys_inode_op= erations; > static const struct file_operations proc_sys_dir_file_operations; > static const struct inode_operations proc_sys_dir_operations; > =20 > -/* Support for permanently empty directories */ > -static const struct ctl_table sysctl_mount_point[] =3D { > - { } > -}; > - > -/** > - * register_sysctl_mount_point() - registers a sysctl mount point > - * @path: path for the mount point > - * > - * Used to create a permanently empty directory to serve as mount point. > - * There are some subtle but important permission checks this allows in = the > - * case of unprivileged mounts. > - */ > -struct ctl_table_header *register_sysctl_mount_point(const char *path) > -{ > - return register_sysctl(path, sysctl_mount_point); > -} > -EXPORT_SYMBOL(register_sysctl_mount_point); > - > -#define sysctl_is_perm_empty_ctl_header(hptr) \ > - (hptr->type =3D=3D SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY) > -#define sysctl_set_perm_empty_ctl_header(hptr) \ > - (hptr->type =3D SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY) > -#define sysctl_clear_perm_empty_ctl_header(hptr) \ > - (hptr->type =3D SYSCTL_TABLE_TYPE_DEFAULT) > - > void proc_sys_poll_notify(struct ctl_table_poll *poll) > { > if (!poll) > @@ -199,8 +174,6 @@ static void init_header(struct ctl_table_header *head, > head->set =3D set; > head->parent =3D NULL; > head->node =3D node; > - if (table =3D=3D sysctl_mount_point) > - sysctl_set_perm_empty_ctl_header(head); > INIT_HLIST_HEAD(&head->inodes); > if (node) { > const struct ctl_table *entry; > @@ -228,17 +201,9 @@ static int insert_header(struct ctl_dir *dir, struct= ctl_table_header *header) > =20 > =20 > /* Is this a permanently empty directory? */ > - if (sysctl_is_perm_empty_ctl_header(dir_h)) > + if (dir->permanently_empty) > return -EROFS; > =20 > - /* Am I creating a permanently empty directory? */ > - if (header->ctl_table_size > 0 && > - sysctl_is_perm_empty_ctl_header(header)) { > - if (!RB_EMPTY_ROOT(&dir->root)) > - return -EINVAL; > - sysctl_set_perm_empty_ctl_header(dir_h); > - } > - > dir_h->nreg++; > header->parent =3D dir; > err =3D insert_links(header); > @@ -254,8 +219,6 @@ static int insert_header(struct ctl_dir *dir, struct = ctl_table_header *header) > erase_header(header); > put_links(header); > fail_links: > - if (header->ctl_table =3D=3D sysctl_mount_point) > - sysctl_clear_perm_empty_ctl_header(dir_h); > header->parent =3D NULL; > drop_sysctl_table(dir_h); > return err; > @@ -442,6 +405,7 @@ static struct inode *proc_sys_make_inode(struct super= _block *sb, > struct ctl_table_header *head, const struct ctl_table *table) > { > struct ctl_table_root *root =3D head->root; > + struct ctl_dir *ctl_dir; > struct inode *inode; > struct proc_inode *ei; > =20 > @@ -475,7 +439,9 @@ static struct inode *proc_sys_make_inode(struct super= _block *sb, > inode->i_mode |=3D S_IFDIR; > inode->i_op =3D &proc_sys_dir_operations; > inode->i_fop =3D &proc_sys_dir_file_operations; > - if (sysctl_is_perm_empty_ctl_header(head)) > + > + ctl_dir =3D container_of(head, struct ctl_dir, header); > + if (ctl_dir->permanently_empty) > make_empty_dir_inode(inode); > } > =20 > @@ -1214,8 +1180,7 @@ static bool get_links(struct ctl_dir *dir, > struct ctl_table_header *tmp_head; > const struct ctl_table *entry, *link; > =20 > - if (header->ctl_table_size =3D=3D 0 || > - sysctl_is_perm_empty_ctl_header(header)) > + if (header->ctl_table_size =3D=3D 0 || dir->permanently_empty) > return true; > =20 > /* Are there links available for every entry in table? */ > @@ -1536,6 +1501,33 @@ void unregister_sysctl_table(struct ctl_table_head= er * header) > } > EXPORT_SYMBOL(unregister_sysctl_table); > =20 > +/** > + * register_sysctl_mount_point() - registers a sysctl mount point > + * @path: path for the mount point > + * > + * Used to create a permanently empty directory to serve as mount point. > + * There are some subtle but important permission checks this allows in = the > + * case of unprivileged mounts. > + */ > +struct ctl_table_header *register_sysctl_mount_point(const char *path) > +{ > + struct ctl_dir *dir =3D sysctl_mkdir_p(&sysctl_table_root.default_set.d= ir, path); > + > + if (IS_ERR(dir)) > + return NULL; > + > + guard(spinlock)(&sysctl_lock); > + > + if (!RB_EMPTY_ROOT(&dir->root)) { > + drop_sysctl_table(&dir->header); > + return NULL; > + } > + > + dir->permanently_empty =3D true; > + return &dir->header; > +} > +EXPORT_SYMBOL(register_sysctl_mount_point); > + > void setup_sysctl_set(struct ctl_table_set *set, > struct ctl_table_root *root, > int (*is_seen)(struct ctl_table_set *)) > diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h > index 7c96d5abafc7..329e68d484ed 100644 > --- a/include/linux/sysctl.h > +++ b/include/linux/sysctl.h > @@ -177,23 +177,14 @@ struct ctl_table_header { > struct ctl_dir *parent; > struct ctl_node *node; > struct hlist_head inodes; /* head for proc_inode->sysctl_inodes */ > - /** > - * enum type - Enumeration to differentiate between ctl target types > - * @SYSCTL_TABLE_TYPE_DEFAULT: ctl target with no special considerations > - * @SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY: Used to identify a permanently > - * empty directory target to serve > - * as mount point. > - */ > - enum { > - SYSCTL_TABLE_TYPE_DEFAULT, > - SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY > - } type; > }; > =20 > struct ctl_dir { > /* Header must be at the start of ctl_dir */ > struct ctl_table_header header; > struct rb_root root; > + /* Permanently empty directory target to serve as mount point. */ > + bool permanently_empty; > }; > =20 > struct ctl_table_set { >=20 > base-commit: a6fd07f80ab7bd94edb4d56c35e61117ffb9957e > prerequisite-patch-id: 0000000000000000000000000000000000000000 > prerequisite-patch-id: 13932e9add940cb65c71e04b5efdfcd3622fd27e > prerequisite-patch-id: 2e4d88f7b8aaa805598f0e87a3ea726825bb4264 > prerequisite-patch-id: 674a680d9cb138cd34cfd0e1a4ec3a5d1c220078 > prerequisite-patch-id: e27c92582aa20b1dfb122c172b336dbaf9d6508a > prerequisite-patch-id: 9b409a34ab6a4d8d8c5225ba9a72db3116e3c8b3 > prerequisite-patch-id: 86ff15a81d850ebda16bb707491251f4b705e4fd > prerequisite-patch-id: b7ab65512ac9acfb2dd482b0271b399467afc56d > prerequisite-patch-id: 0354922fbf2508a89f3e9d9a4e274fc98deb2e93 > prerequisite-patch-id: b71389e82026ffc19cbb717bba1a014ad6cab6da > prerequisite-patch-id: fbb0201f89bf6c41d0585af867bdeec8d51649b2 > prerequisite-patch-id: e3b4b5b69b4eadf87ed97beb8c03a471e7628cb9 > prerequisite-patch-id: 3fbc9745cf3f28872b3e63f6d1f6e2fd7598be8a > prerequisite-patch-id: ba2b190c2e54cfb505a282e688c2222712f0acd7 > prerequisite-patch-id: 47e5ca730748bb7bf9248a9e711045d8c1028199 > prerequisite-patch-id: dcd9f87f00290d2f9be83e404f8883eb90c5fb1c > prerequisite-patch-id: d4629be1a61585ab821da2d2850f246761f72f25 > prerequisite-patch-id: f740190f4b94e57cbf3659f220d94483713341a1 > prerequisite-patch-id: 301c2e530e2af4568267e19247d4a49ac2a9871d > --=20 > 2.43.0 >=20 --=20 Joel Granados --d4nggmrrrvv2zcqu Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEErkcJVyXmMSXOyyeQupfNUreWQU8FAmVxty0ACgkQupfNUreW QU8yGwwAk7ywHUwwRfGWs21cjRCLdI5T1NnOx2lAHXEcgNlI8TfUlpyLib5YFdjL 1yCiAGv/KvdA89ubShvM6MFAwLPxbI4eGcBHjYJ/Y8FN04UG8ofXVaCETl0BD1Pv YZVc/hOoa+CSWUzE3n2wl2TGhMJX5ErHP/+DMBWifWKhrJGtTnZaU+8dysM4QwBx 7Skisvwod83MOzWtfujgs0ZcQ6PENPVdtIpM+IS5Q0ju1F/hNp1K/SpgDXNe/xi2 UewuK5L9kOTE0YheqBek9RRc7aRLrbG7H0Gs1i9doeLVMXkqbN0rffoH9KkeJpsz WEIpoGqDlxCwyPoNsZkETfriC9f+s7kXwcFIma8OS0s/TyJRnVeDghPofud8n5d1 u3uzckVkC739tgzNO/RenQNeQ/E4QTbF1Bh7FwbOAfiSM8g8uYLpoAbhvvxFB3qw D3Hetx2byg5ONe3SamHqk2mAzGYtGTIjUU4XV7YsUeqTUbFluAQTpCVGUjrrycX0 fphlgwq4 =MduN -----END PGP SIGNATURE----- --d4nggmrrrvv2zcqu--