From patchwork Thu May 10 23:13:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 10392571 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4462D60153 for ; Thu, 10 May 2018 23:15:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32A1C28DA6 for ; Thu, 10 May 2018 23:15:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 26E1528DAA; Thu, 10 May 2018 23:15:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7E2228DA6 for ; Thu, 10 May 2018 23:15:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751893AbeEJXPY (ORCPT ); Thu, 10 May 2018 19:15:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:58786 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751449AbeEJXOH (ORCPT ); Thu, 10 May 2018 19:14:07 -0400 Received: from garbanzo.do-not-panic.com (c-73-15-241-2.hsd1.ca.comcast.net [73.15.241.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6A1862183D; Thu, 10 May 2018 23:14:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1525994047; bh=Mzhgx7u4C9bHpzkWdnxQzJo15aulQfP56d3BCVQZV5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rf+cJiRTa8bo/jKNKeZVqe9oczPzZqcd0HubKRwjd7DsHn8FleuiamO2JAMPbcWgi vWK41Kn17tF0BdRox7CbFhill8axyAmlR/I6MWy9jKS3GkpIIG56SLUpQOHo9WvAz3 jEGcDyXlmevfFdqJRaH2SLeTcWBZ+Xu5ADvGq/bo= From: "Luis R. Rodriguez" To: viro@zeniv.linux.org.uk, darrick.wong@oracle.com, tytso@mit.edu, adilger.kernel@dilger.ca, clm@fb.com, jbacik@fb.com, dsterba@suse.com Cc: sandeen@sandeen.net, dhowells@redhat.com, fliu@suse.com, jack@suse.cz, jeffm@suse.com, nborisov@suse.com, jake.norris@suse.com, mtk.manpages@gmail.com, linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, "Luis R. Rodriguez" Subject: [RFC v2 2/4] xfs: add verifier check for symlink with append/immutable flags Date: Thu, 10 May 2018 16:13:57 -0700 Message-Id: <20180510231359.16899-3-mcgrof@kernel.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180510231359.16899-1-mcgrof@kernel.org> References: <20180510231359.16899-1-mcgrof@kernel.org> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The Linux VFS does not allow a way to set append/immuttable attributes to symlinks, this is just not possible. If this is detected we can correct this with xfs_repair, so inform the user. Signed-off-by: Luis R. Rodriguez --- fs/xfs/libxfs/xfs_symlink_remote.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/xfs/libxfs/xfs_symlink_remote.c b/fs/xfs/libxfs/xfs_symlink_remote.c index 5ef5f354587e..42dd81ede3d6 100644 --- a/fs/xfs/libxfs/xfs_symlink_remote.c +++ b/fs/xfs/libxfs/xfs_symlink_remote.c @@ -242,5 +242,10 @@ xfs_symlink_shortform_verify( /* We /did/ null-terminate the buffer, right? */ if (*endp != 0) return __this_address; + + /* Immutable and append flags are not allowed on symlinks */ + if (ip->i_d.di_flags & (XFS_DIFLAG_APPEND | XFS_DIFLAG_IMMUTABLE)) + return __this_address; + return NULL; }