Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751599AbdINLvO (ORCPT ); Thu, 14 Sep 2017 07:51:14 -0400 Received: from mail-eopbgr20091.outbound.protection.outlook.com ([40.107.2.91]:13640 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751323AbdINLvM (ORCPT ); Thu, 14 Sep 2017 07:51:12 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=skinsbursky@virtuozzo.com; Reply-To: skinsbursky@virtuozzo.com Subject: Re: [RFC PATCH 1/2] autofs: set compat flag on sbi when daemon uses 32bit addressation To: Ian Kent Cc: autofs@vger.kernel.org, linux-kernel@vger.kernel.org, devel@openvz.org, ldv@altlinux.org References: <20170901110906.2669.1577.stgit@localhost.localdomain> <20170901112144.2669.1453.stgit@localhost.localdomain> <889ec02e-6146-c180-642b-017f6ca71f8a@virtuozzo.com> <323d8907-8fd6-2d8d-35a9-272faa7e7811@themaw.net> From: Stanislav Kinsburskiy Message-ID: Date: Thu, 14 Sep 2017 13:51:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <323d8907-8fd6-2d8d-35a9-272faa7e7811@themaw.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [178.19.210.162] X-ClientProxiedBy: AM5PR0502CA0023.eurprd05.prod.outlook.com (2603:10a6:203:91::33) To DB6PR0802MB2246.eurprd08.prod.outlook.com (2603:10a6:4:85::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c23394b7-5337-433c-1ec8-08d4fb66e2ca X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:DB6PR0802MB2246; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0802MB2246;3:+Wx2vtvZwRK2NYhmvS5zAfH3xbYIYLU0CJtn6q2LM2YW7avEkHTc3Q+iy3nj5fRK2xNd9dY71/NyZeptIJO925w9D4oGMzLS3bJR/AwzYnwr+3UydS63x7YJS8z3J+r7wKnWAhZyg7JC/u7j6zHGHA6flNabkpv6iqwNrBuqdqciaQF1aLXmbh8ZjhcDnUZfwslQU65xomIhnANUN+3v6gDZPa1hG5FhIui4U+T10Y0+qRHhzvvk1nAYQvjW5TL3;25:a59Htyc6uBTdt0rl3BO6LLONQCFyJKn9XhqCfVVaPhwIpLEYQ2hvhAq29S5lz5NQFN36YfvcZv2lVbIeW5pfGmOmirM/JiEqef0wFqkaDANQyj0kQoONxSuIalnYMTMRY/XKDIHbvzKT0nscqqEq56kpYgq1RqUHT74/g+ThHtWM3wAbeQpDIQJVv7oTJqlIQt59m6zA3C7nRK/y7MYyTGEIGTwr8VYS5zXmJHfrcWKI+YJvyu0B+Ha0PAbRulqGtrQFDovBY2gcxkSjsHvQVBZPiV7dVVPkRsP/1T5FBlsa0E4p3xvjvqMe4HDquLQX4tpkgZSBtIJ+9UhC+rNrew==;31:L3XsMSmBA6NzXfcUjDiWPJJ4jgwbnnl7O+eIH/8xptPTlNFnE8ZTzjuNNoXcgXHsUgtm+SkN7UQaIzh+E+SFxvMLRTB6+4HPr1RVC1YB1bNgBFlEacYBaHn5c5EiptBbtl3Ih6s1PtTrpkyrIwTyxP3iNrD3WqGhTx4g3Va3+ER8lZpxjVxCjwiSoS4/73f7ggS0c+lxpWr5cegbyeJPSpj4oplYx1Aha35migln8po= X-MS-TrafficTypeDiagnostic: DB6PR0802MB2246: X-Microsoft-Exchange-Diagnostics: 1;DB6PR0802MB2246;20:l92jlr2Aq0fvxxbk3Z53fblcUgBVrlgkPpmIr1SBg3oacoZx/Dy77DJazQHDbi17w29Fly9upoKrFl2ZWSzEQBSWvLfhmXvYkv/U6uTXIJL7g1cc6WKreGvj5h2a4UVorIYYsyqv9uEvnCv9fXsZ95kNj+BapzMWscRWk085IinC0y+oNzWgIgYHHOsb9cpS6gXLx6gN6cG/kklWA3rhTqxmWgeITnmRDtd0w8XoSMBnwxu1Hk9IUpkO3JtPEXpCr/3qCyQl+Oqyo+LFcPyqVOA+ZSgZaF0tVuPIWj87/WDqnzQHfreZr/IdzHh7WduSTj8BcazWYyXI70kVzpZQ+Ahx/vlrZVuIldXxzzCTQPnWCJuvBuM743+wF1C9ST/Is++kX7g/LvDrlSXAfJ1QQVxOereXLaVUde69h0d3EjA=;4:Ba16ePVMYzyGnAcDkcnci+gaMWnbpaJVmnkw8O5pbWmb0/LVzQJCt+WGzLpg4PWrcRXkl9ckPtn3JF1ww8YmZlZqwD/HCBV6jigKDJUZr0aGQc78LOiSee+q6Zn/A9LMfkQa+zQ46kr7UqAZlVZzkCuhf3E7Txbf2XEBIngS4aOnucte7y3HiCKd030zcw9tVIPWcVy2pMHLzTZU90mbqBSArpn2+ZnuT4eIIpVio4YQvYt+hJMahA/8L6izHtQ0 X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(3002001)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123558100)(20161123564025)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DB6PR0802MB2246;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DB6PR0802MB2246; X-Forefront-PRVS: 0430FA5CB7 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(7370300001)(4630300001)(6049001)(6009001)(39830400002)(346002)(376002)(24454002)(199003)(189002)(5660300001)(7736002)(93886005)(8676002)(305945005)(81156014)(6666003)(6486002)(77096006)(229853002)(33646002)(3846002)(6916009)(65826007)(2950100002)(478600001)(106356001)(105586002)(316002)(575784001)(4001350100001)(31696002)(6116002)(23676002)(16526017)(16576012)(83506001)(97736004)(86362001)(3450700001)(50986999)(2906002)(54356999)(76176999)(66066001)(65956001)(65806001)(2870700001)(50466002)(47776003)(81166006)(64126003)(189998001)(110136004)(6246003)(31686004)(36756003)(7350300001)(43066003)(101416001)(53546010)(68736007)(4326008)(25786009)(53936002)(16300500001)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DB6PR0802MB2246;H:[10.134.193.232];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtEQjZQUjA4MDJNQjIyNDY7MjM6Nlhpc1VxbkJ4djRaK2E1N2FtKzZNRGNC?= =?utf-8?B?STQ1dklQMlYrdEZ1NmNrRmU3UTA5K1lsblVCRC90RlQ0OUx3WXBhbzQ1Y3NO?= =?utf-8?B?N3FiNGVsL3lRRG0vbXpXTmtwOGV4dlppS3NoTm9IZlZpdVlodWdXdHJpeThB?= =?utf-8?B?M25ESzlReHdDS0EyWkswV01SMU1NdnhoSk1xR3FRZ2JUZ0hSSVNWWDRpRlZo?= =?utf-8?B?bnI5VFZHMmRJdGdXRTlJdEZkbjJ0L21BNVNoNzRETGdZSFRrM3Rwb29reldl?= =?utf-8?B?b25Qay93WWZRTzY2eStUaVd4S1MvOWtQNVRqT1dGb0UzcXU4aTZDZk03bEFm?= =?utf-8?B?aG5BZzE5MjVFQ3pBaFZreHhmVVNyem5zd0lvTEFUaVgvV1JqZzIzYVlFN3Aw?= =?utf-8?B?bXdxV096UHFwUUtuQ2xvMnMwcUxNUFdBRDd3SHdTeEJLSVZyUDhtK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HQhSL9H3kyEQzT8OYNlqa4UR63efVxoRz70LLF2RuoB+bb4S+LQjZTRZ74gx286elRBuwiBVc4VtksfMZQt39erp4PYpcF+QE10rI+SrEJk+8mv6Hios7PcvpqjmO6VBW9RTJtCdhRR3LUKRzQQu4tL0nUw1cpGNQbwv9b34pSfa8b1kZ6Z+2ebSuk/U90q4Rob/Il4UrWFBgbp/evtuNJHR1LkBG445PR/U+fzMXMSdxcQ==;5:ILg7p0QsHc0jI0Kwus5TkqEn0ZIytsdE3axLaYU5CjA6Fvj5z+nhPnl91PTcCkDmazyYV2FX+pjzOJCWw/PUQFSP+fwyhBrMHs7pBylzdMHhJ9znfaUCOL+Sh/D03PVGBPQGViWg+Dlid3KLf7Z+IA==;24:6pb6872f/vy5sVDopT17W+SHT+yqIGlyholj5x8S3OJWCkH214rVIM3kNNXxkh6aaKTDFxHH6y9bl6JkqxYC+a/D5ccES2savGAHDNcqafw=;7:igZwEnqAsv/7MuECbC0Idvvl8SM5Xu0PP7MEtiDqFo8qdVJjRj0poZXOKT6Ovg0ZikS55u0Dr+d+a1vC2L+nwix1JzarkwD+t4KdSRr8W5groZeUmmsZpfU+P+z4tvqFJhhFvQhBIkZCisN7w+bg04BvGlNIjSFsNo6o7/4wEOVsncgin/nFvNdU7hd/dAy8rVLyiRNv/9qvQ0CThOOEKYstZRQ3TTBvwpdDcXDUHjg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DB6PR0802MB2246;20:2iE2c9v5uUp6RonYxXaE/Wk7FdeLJ0BsfqaU0GRUEfNtk52dPilZRAs+ziylaph/v5OrmYhy5KAQKj3HRLUpb6vW8upGItSnJvgITh5YUikmC+3NWiNsieHN0XIjgS66UBeuPi3DcMQlVRdX8VAnOOy+jKA4fqonrkw6g8AKlOk= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2017 11:51:07.3090 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2246 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3299 Lines: 102 14.09.2017 13:45, Ian Kent пишет: > On 14/09/17 19:39, Stanislav Kinsburskiy wrote: >> >> >> 14.09.2017 13:29, Ian Kent пишет: >>> On 14/09/17 17:24, Stanislav Kinsburskiy wrote: >>>> >>>> >>>> 14.09.2017 02:38, Ian Kent пишет: >>>>> On 01/09/17 19:21, Stanislav Kinsburskiy wrote: >>>>>> Signed-off-by: Stanislav Kinsburskiy >>>>>> --- >>>>>> fs/autofs4/autofs_i.h | 3 +++ >>>>>> fs/autofs4/dev-ioctl.c | 3 +++ >>>>>> fs/autofs4/inode.c | 4 +++- >>>>>> 3 files changed, 9 insertions(+), 1 deletion(-) >>>>>> >>>>>> diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h >>>>>> index 4737615..3da105f 100644 >>>>>> --- a/fs/autofs4/autofs_i.h >>>>>> +++ b/fs/autofs4/autofs_i.h >>>>>> @@ -120,6 +120,9 @@ struct autofs_sb_info { >>>>>> struct list_head active_list; >>>>>> struct list_head expiring_list; >>>>>> struct rcu_head rcu; >>>>>> +#ifdef CONFIG_COMPAT >>>>>> + unsigned is32bit:1; >>>>>> +#endif >>>>>> }; >>>>>> >>>>>> static inline struct autofs_sb_info *autofs4_sbi(struct super_block *sb) >>>>>> diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c >>>>>> index b7c816f..467d6c4 100644 >>>>>> --- a/fs/autofs4/dev-ioctl.c >>>>>> +++ b/fs/autofs4/dev-ioctl.c >>>>>> @@ -397,6 +397,9 @@ static int autofs_dev_ioctl_setpipefd(struct file *fp, >>>>>> sbi->pipefd = pipefd; >>>>>> sbi->pipe = pipe; >>>>>> sbi->catatonic = 0; >>>>>> +#ifdef CONFIG_COMPAT >>>>>> + sbi->is32bit = is_compat_task(); >>>>>> +#endif >>>>>> } >>>>>> out: >>>>>> put_pid(new_pid); >>>>>> diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c >>>>>> index 09e7d68..21d3c0b 100644 >>>>>> --- a/fs/autofs4/inode.c >>>>>> +++ b/fs/autofs4/inode.c >>>>>> @@ -301,7 +301,9 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) >>>>>> } else { >>>>>> sbi->oz_pgrp = get_task_pid(current, PIDTYPE_PGID); >>>>>> } >>>>>> - >>>>>> +#ifdef CONFIG_COMPAT >>>>>> + sbi->is32bit = is_compat_task(); >>>>>> +#endif >>>>>> if (autofs_type_trigger(sbi->type)) >>>>>> __managed_dentry_set_managed(root); >>>>>> >>>>>> >>>>> >>>>> Not sure about this. >>>>> >>>>> Don't you think it would be better to avoid the in code #ifdefs by doing some >>>>> checks and defines in the header file and defining what's need to just use >>>>> is_compat_task(). >>>>> >>>> >>>> Yes, might be... >>>> >>>>> Not sure 2 patches are needed for this either ...... >>>>> >>>> >>>> Well, I found this issue occasionally. >>> >>> I'm wondering what the symptoms are? >>> >> >> Size of struct autofs_v5_packet is 300 bytes for x86 and 304 bytes for x86_64. >> Which means, that 32bit task can read more than size of autofs_v5_packet on 64bit kernel. > > Are you sure? > > Shouldn't that be a short read on the x86 side of a 4 bytes longer > structure on the x86_64 side. > > I didn't think you could have a 64 bit client on a 32 bit kernel > so the converse (the read past end of struct) doesn't apply. > Sorry for the confusion, I had to add brackets like this: > Which means, that 32bit task can read more than size of autofs_v5_packet (on 64bit kernel). IOW, 32bit task expects to read 300 bytes (size of struct autofs_v5_packet) while there are 304 bytes available on the "wire" from the 64bit kernel. > Ian >