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=-5.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_MUTT autolearn=unavailable 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 DB173C282DE for ; Tue, 9 Apr 2019 03:18:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 95898218EA for ; Tue, 9 Apr 2019 03:18:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="qPxHoQrB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726387AbfDIDSL (ORCPT ); Mon, 8 Apr 2019 23:18:11 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:57512 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726081AbfDIDSL (ORCPT ); Mon, 8 Apr 2019 23:18:11 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3934sXf134961; Tue, 9 Apr 2019 03:18:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=jBEr9KpoXXYFgFcdLwqasRo12XkN4IbExkA0ZDwKwVw=; b=qPxHoQrBKAB1BW7whygSvj4xi7L10edhI7Pi54VSf9OJHg2wAokUFXHwQNIkn3YMSou2 lEmvFLtUS66S9yLKni1RD/jmF1D6jBjolc4B9sljYOSzobOvYFUmM15+22z6btJNxPaY Ker0U0emieDLVTqZwi5PSaYGmI5Ow0xXB02jsImSfU4x1EQ4xnmDPbTGllDyiJ2sUCI3 as47Uisrp86eXY+NoNckvL63Dw689kQcMaNfKSQGz86U+/eEpaF7qKrencP7CW3ORSRV N37exHDCmxBdcASQt03JdfMKtjm2N8/UCYaJDSaAm0wmPTG3ura9jrJeJpNELQEPZMh4 eA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 2rphmeabnv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 09 Apr 2019 03:18:06 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x393I5PH127162; Tue, 9 Apr 2019 03:18:06 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3030.oracle.com with ESMTP id 2rph7sbdsb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 09 Apr 2019 03:18:05 +0000 Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x393I32T025291; Tue, 9 Apr 2019 03:18:03 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 08 Apr 2019 20:18:03 -0700 Date: Mon, 8 Apr 2019 20:18:01 -0700 From: "Darrick J. Wong" To: Amir Goldstein Cc: Dave Chinner , linux-xfs , Linux MM , linux-fsdevel , Ext4 , Linux Btrfs Subject: Re: [PATCH 4/4] xfs: don't allow most setxattr to immutable files Message-ID: <20190409031801.GD5147@magnolia> References: <155466882175.633834.15261194784129614735.stgit@magnolia> <155466884962.633834.14320700092446721044.stgit@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9221 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=857 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904090021 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9221 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=880 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904090020 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Mon, Apr 08, 2019 at 09:20:47AM +0300, Amir Goldstein wrote: > On Sun, Apr 7, 2019 at 11:28 PM Darrick J. Wong wrote: > > > > From: Darrick J. Wong > > > > The chattr manpage has this to say about immutable files: > > > > "A file with the 'i' attribute cannot be modified: it cannot be deleted > > or renamed, no link can be created to this file, most of the file's > > metadata can not be modified, and the file can not be opened in write > > mode." > > > > However, we don't actually check the immutable flag in the setattr code, > > which means that we can update project ids and extent size hints on > > supposedly immutable files. Therefore, reject a setattr call on an > > immutable file except for the case where we're trying to unset > > IMMUTABLE. > > > > Signed-off-by: Darrick J. Wong > > Did you miss my comment on v1, or do you not think this use case > is going to hurt any application that is not a rootkit? > > chattr +i foo => OK > chattr +i foo => -EPERM Nah, I plain forgot to update the patch. :( Will send v2 where you're allowed to +i multiple times so long as that's the only thing you're changing. --D > Thanks, > Amir.