From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FA9FC4338F for ; Sat, 21 Aug 2021 12:46:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0DCC361244 for ; Sat, 21 Aug 2021 12:46:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230167AbhHUMqk (ORCPT ); Sat, 21 Aug 2021 08:46:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:48706 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229722AbhHUMqj (ORCPT ); Sat, 21 Aug 2021 08:46:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 26DB461222; Sat, 21 Aug 2021 12:45:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629549960; bh=BWRBpnQrNoRcs319+vTr8OUV7hK/02HoruNC5g/r9g8=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=fa7ZeHuGl+4XP1WpEyzmi5hufYrREjDgNdRg4U3s/96SFCEqdGYDGUtBnHEuVeQqG 15E2/qqommNNVF93RIEDLEQP4hibseJYGAbILdAXC/LwejAZfgBOGT6SdESXBfYcDN cd7+Xd17PsJ2c9mp9buI/usXYtVu6bkO7afSWz4635iAHyaAYKSzDM3WPhavCSsRv0 ClTsJRXKpG8hsODsdUHQ/aV4CV1rhOspJM2fWX2hRqBJCYHxYAYyp8at738ytBtNYE 0IToQvyCx1mwLtuRTjN4k+vGA4g035zp2YTFthSWuCdKxQhCRB0nph9IOGgywfzekG j3T7MrokxJRCg== Message-ID: <18b073b95d692f4c7782c68de1f803681c15a467.camel@kernel.org> Subject: Re: Removing Mandatory Locks From: Jeff Layton To: "H. Peter Anvin" , Kees Cook , Linus Torvalds Cc: "Eric W. Biederman" , Matthew Wilcox , Andy Lutomirski , David Laight , David Hildenbrand , Linux Kernel Mailing List , Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Al Viro , Alexey Dobriyan , Steven Rostedt , "Peter Zijlstra (Intel)" , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Petr Mladek , Sergey Senozhatsky , Andy Shevchenko , Rasmus Villemoes , Greg Ungerer , Geert Uytterhoeven , Mike Rapoport , Vlastimil Babka , Vincenzo Frascino , Chinwen Chang , Michel Lespinasse , Catalin Marinas , Huang Ying , Jann Horn , Feng Tang , Kevin Brodsky , Michael Ellerman , Shawn Anastasio , Steven Price , Nicholas Piggin , Christian Brauner , Jens Axboe , Gabriel Krisman Bertazi , Peter Xu , Suren Baghdasaryan , Shakeel Butt , Marco Elver , Daniel Jordan , Nicolas Viennot , Thomas Cedeno , Collin Fijalkovich , Michal Hocko , Miklos Szeredi , Chengguang Xu , Christian =?ISO-8859-1?Q?K=F6nig?= , "linux-unionfs@vger.kernel.org" , Linux API , the arch/x86 maintainers , "" , Linux-MM , Florian Weimer , Michael Kerrisk Date: Sat, 21 Aug 2021 08:45:54 -0400 In-Reply-To: <8a6737f9fa2dd3b8b9d851064cd28ca57e489a77.camel@kernel.org> References: <87eeay8pqx.fsf@disp2133> <5b0d7c1e73ca43ef9ce6665fec6c4d7e@AcuMS.aculab.com> <87h7ft2j68.fsf@disp2133> <87k0kkxbjn.fsf_-_@disp2133> <0c2af732e4e9f74c9d20b09fc4b6cbae40351085.camel@kernel.org> <202108200905.BE8AF7C@keescook> <8a6737f9fa2dd3b8b9d851064cd28ca57e489a77.camel@kernel.org> Content-Type: text/plain; charset="ISO-8859-15" User-Agent: Evolution 3.40.4 (3.40.4-1.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-unionfs@vger.kernel.org On Fri, 2021-08-20 at 17:29 -0400, Jeff Layton wrote: > No, Windows has deny-mode locking at open time, but the kernel's > mandatory locks are enforced during read/write (which is why they are > such a pain). Samba will not miss these at all. > > If we want something to provide windows-like semantics, we'd probably > want to start with something like Pavel Shilovsky's O_DENY_* patches. > > -- Jeff > Doh! It completely slipped my mind about byte-range locks on windows... Those are mandatory and they do block read and write activity to the ranges locked. They have weird semantics vs. POSIX locks (they stack instead of splitting/merging, etc.). Samba emulates these with (advisory) POSIX locks in most cases. Using mandatory locks is probably possible, but I think it would add more potential for deadlock and security issues. -- Jeff Layton From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEC49C4320E for ; Sat, 21 Aug 2021 12:46:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4DC5861244 for ; Sat, 21 Aug 2021 12:46:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4DC5861244 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 5D67B8D0001; Sat, 21 Aug 2021 08:46:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 55DAD6B0072; Sat, 21 Aug 2021 08:46:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3FEBA8D0001; Sat, 21 Aug 2021 08:46:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0146.hostedemail.com [216.40.44.146]) by kanga.kvack.org (Postfix) with ESMTP id 22B516B0071 for ; Sat, 21 Aug 2021 08:46:02 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id A6F8B8248047 for ; Sat, 21 Aug 2021 12:46:01 +0000 (UTC) X-FDA: 78499060122.18.99C6C5C Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf15.hostedemail.com (Postfix) with ESMTP id 3A50CD00009A for ; Sat, 21 Aug 2021 12:46:01 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 26DB461222; Sat, 21 Aug 2021 12:45:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629549960; bh=BWRBpnQrNoRcs319+vTr8OUV7hK/02HoruNC5g/r9g8=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=fa7ZeHuGl+4XP1WpEyzmi5hufYrREjDgNdRg4U3s/96SFCEqdGYDGUtBnHEuVeQqG 15E2/qqommNNVF93RIEDLEQP4hibseJYGAbILdAXC/LwejAZfgBOGT6SdESXBfYcDN cd7+Xd17PsJ2c9mp9buI/usXYtVu6bkO7afSWz4635iAHyaAYKSzDM3WPhavCSsRv0 ClTsJRXKpG8hsODsdUHQ/aV4CV1rhOspJM2fWX2hRqBJCYHxYAYyp8at738ytBtNYE 0IToQvyCx1mwLtuRTjN4k+vGA4g035zp2YTFthSWuCdKxQhCRB0nph9IOGgywfzekG j3T7MrokxJRCg== Message-ID: <18b073b95d692f4c7782c68de1f803681c15a467.camel@kernel.org> Subject: Re: Removing Mandatory Locks From: Jeff Layton To: "H. Peter Anvin" , Kees Cook , Linus Torvalds Cc: "Eric W. Biederman" , Matthew Wilcox , Andy Lutomirski , David Laight , David Hildenbrand , Linux Kernel Mailing List , Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Al Viro , Alexey Dobriyan , Steven Rostedt , "Peter Zijlstra (Intel)" , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Petr Mladek , Sergey Senozhatsky , Andy Shevchenko , Rasmus Villemoes , Greg Ungerer , Geert Uytterhoeven , Mike Rapoport , Vlastimil Babka , Vincenzo Frascino , Chinwen Chang , Michel Lespinasse , Catalin Marinas , Huang Ying , Jann Horn , Feng Tang , Kevin Brodsky , Michael Ellerman , Shawn Anastasio , Steven Price , Nicholas Piggin , Christian Brauner , Jens Axboe , Gabriel Krisman Bertazi , Peter Xu , Suren Baghdasaryan , Shakeel Butt , Marco Elver , Daniel Jordan , Nicolas Viennot , Thomas Cedeno , Collin Fijalkovich , Michal Hocko , Miklos Szeredi , Chengguang Xu , Christian =?ISO-8859-1?Q?K=F6nig?= , "linux-unionfs@vger.kernel.org" , Linux API , the arch/x86 maintainers , "" , Linux-MM , Florian Weimer , Michael Kerrisk Date: Sat, 21 Aug 2021 08:45:54 -0400 In-Reply-To: <8a6737f9fa2dd3b8b9d851064cd28ca57e489a77.camel@kernel.org> References: <87eeay8pqx.fsf@disp2133> <5b0d7c1e73ca43ef9ce6665fec6c4d7e@AcuMS.aculab.com> <87h7ft2j68.fsf@disp2133> <87k0kkxbjn.fsf_-_@disp2133> <0c2af732e4e9f74c9d20b09fc4b6cbae40351085.camel@kernel.org> <202108200905.BE8AF7C@keescook> <8a6737f9fa2dd3b8b9d851064cd28ca57e489a77.camel@kernel.org> Content-Type: text/plain; charset="ISO-8859-15" User-Agent: Evolution 3.40.4 (3.40.4-1.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=fa7ZeHuG; spf=pass (imf15.hostedemail.com: domain of jlayton@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=jlayton@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 3A50CD00009A X-Stat-Signature: 18a8dpig3ttud5y3m9gchrxbot387yes X-HE-Tag: 1629549961-374791 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, 2021-08-20 at 17:29 -0400, Jeff Layton wrote: > No, Windows has deny-mode locking at open time, but the kernel's > mandatory locks are enforced during read/write (which is why they are > such a pain). Samba will not miss these at all. > > If we want something to provide windows-like semantics, we'd probably > want to start with something like Pavel Shilovsky's O_DENY_* patches. > > -- Jeff > Doh! It completely slipped my mind about byte-range locks on windows... Those are mandatory and they do block read and write activity to the ranges locked. They have weird semantics vs. POSIX locks (they stack instead of splitting/merging, etc.). Samba emulates these with (advisory) POSIX locks in most cases. Using mandatory locks is probably possible, but I think it would add more potential for deadlock and security issues. -- Jeff Layton