Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp753894imm; Wed, 26 Sep 2018 06:21:54 -0700 (PDT) X-Google-Smtp-Source: ACcGV63RmiJ7LEsmohu0RW8Laj4MM0EC5jVQ5Foj2zZyvpALnUcRX//WyV0u42bhUWyywSdDJ08v X-Received: by 2002:a65:5347:: with SMTP id w7-v6mr5845807pgr.17.1537968114485; Wed, 26 Sep 2018 06:21:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537968114; cv=none; d=google.com; s=arc-20160816; b=jipYzODKP8MIO3wqEXCeIWj5k3YCb4ZQC3TFl/jO2elvBfx9uAAxD49YQ1qRQndh+Q B9Mtbmx5bynvcMxvQDnz0NGZNhunx1nM3EFuljIh/+0JB/R4wjJFTDzLynM3H1TSn3AI EpmlYTE9QERZe4evqICjms6eY5xjyyAPqN8UrDMfjmNYRkvI+iRPa4awbiehHOVEd6q8 FYQtiV7WhyA2XcJq/q/9FiKwMKgLU7BTCctOZkVp1SkoWabj2G7fG13PfyApQsXYTcas Vez0btzmMU+/QhVWl6VPG2tOGvm6C5D6gPrTdYCKAfkJPRmEMHO/WkRoov9wL7HD+b+n wwUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:ironport-phdr; bh=OQ6AR5vmggp8KP85BXn9B8QROH2W1WASZDILe35tn0I=; b=CJ323nBJ0JwbsySmI1S1j3WdCmqAzInfuexe8C298WEAyuTNVXnlG/5QdNESaNMLh8 /nbPTkbwedYXfxe9/x27t/hbU8zob3EFpaP8Chnw5Ib9Ok27YL07T3bkof1t3ubYE4sh rt8kdSdmTHqA0ES0W4v3+db/CZAPsr5LawzWIm4i3G6bEEdvJzR66sPP4kUNkwQJQCAR G1V6KVsca9FetZy/M8R7RfhHAZcvmDs+swNI5JqU/UgZzV2VIs/NYji00x/mRTdEIjLz g5/4XsNhQVRiT3p9jfIuL5dyg9/dMcbCB5YCD7/T+4SqG1XhkLVw/vGFq5qASlP7XD0P Ik4A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v20-v6si5336800plo.147.2018.09.26.06.21.39; Wed, 26 Sep 2018 06:21:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728517AbeIZTeC (ORCPT + 99 others); Wed, 26 Sep 2018 15:34:02 -0400 Received: from uphb19pa11.eemsg.mail.mil ([214.24.26.85]:41128 "EHLO USFB19PA14.eemsg.mail.mil" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726802AbeIZTeC (ORCPT ); Wed, 26 Sep 2018 15:34:02 -0400 X-EEMSG-check-008: 84295363|USFB19PA14_EEMSG_MP10.csd.disa.mil Received: from emsm-gh1-uea11.ncsc.mil ([214.29.60.3]) by USFB19PA14.eemsg.mail.mil with ESMTP/TLS/DHE-RSA-AES256-SHA256; 26 Sep 2018 13:21:03 +0000 X-IronPort-AV: E=Sophos;i="5.54,306,1534809600"; d="scan'208";a="18684909" IronPort-PHdr: =?us-ascii?q?9a23=3AENA4uROSzKllhP4hTcsl6mtUPXoX/o7sNwtQ0K?= =?us-ascii?q?IMzox0K/77oMbcNUDSrc9gkEXOFd2Cra4c1KyO6+jJYi8p2d65qncMcZhBBV?= =?us-ascii?q?cuqP49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL1LdrWev4jEMBx?= =?us-ascii?q?7xKRR6JvjvGo7Vks+7y/2+94fcbglUhjexe69+IAmrpgjNq8cahpdvJLwswR?= =?us-ascii?q?XTuHtIfOpWxWJsJV2Nmhv3+9m98p1+/SlOovwt78FPX7n0cKQ+VrxYES8pM3?= =?us-ascii?q?sp683xtBnMVhWA630BWWgLiBVIAgzF7BbnXpfttybxq+Rw1DWGMcDwULs5Qi?= =?us-ascii?q?qp4bt1RxD0iScHLz85/3/Risxsl6JQvRatqwViz4LIfI2ZMfxzca3HfdMeWG?= =?us-ascii?q?FPQMBfWSJcCY+4docDEfYNMeNeooLgpVUBsAG+CBGxCu3xxD9Ghnz406M03O?= =?us-ascii?q?suEw7JwAMuEskSsHnWttj5KLseXO63waTO0D7Nb+lW2TD46IXQbx4hve+DXa?= =?us-ascii?q?pwccXPz0kkCh7LjlCKpozhOzOayOQMuHWc4up7SO2vkHUqqx1xozezxscsjZ?= =?us-ascii?q?PFhoQOyl/e7yl5z4E1JcOhRUN9fNWqE4NQujmHO4Z5Tc4uWWFltDsgxrEYtp?= =?us-ascii?q?O3YjIGxIkhyhXCcfKIaZKI7QjmVOuJJDd4g29qd6ynihap9Eig1vX8Vs6p0F?= =?us-ascii?q?ZWtiZFksfDtnQK1xHL9siIUOF9/ka82TaUzQzT9uFFLlw0larcMZIhxKI/lo?= =?us-ascii?q?EPvkjZGy/2mUH2gLeXdkUi5Oeo9/zqbqjpq5KTLYN5ihzyPr4wlsGwH+g0KB?= =?us-ascii?q?UCU3Ce+eum1b3j+UP5QK9Njv0ziqTZq43VJd8Aq66lAw5azoYj6xGlAzegy9?= =?us-ascii?q?QXh2MLLF1CeBKZl4TpIU3BIOjkDfejhFShiCpkyOrYPr3gH5rANXbDkK3mfb?= =?us-ascii?q?Z47E5c0hE8zdFD555OFr4BJ/fzUFfrtNPEFh85LxC0w+H/BdR8yoMeXmSPAq?= =?us-ascii?q?CCPaPMrV+E/PwgLPSRZIUNojbyN+Al5+LyjX8+gVISYLOm3YENaHC5AvtmIF?= =?us-ascii?q?+VYHTrgtcHHmcHpQ0+TPbwh1KeVT5ceWy+UL475jE+EIimF5vMRpixgLyd2y?= =?us-ascii?q?e2BplWZmFAClCRHnbkboqFW/kXaC+JPM9hnSILVaK7R48iyx6urgn6xKRjLu?= =?us-ascii?q?bO/S0Yr53j3sBv5+LPjREy6SB0D8OF3mGJTmF0mH4IRjAv0KB8v0N90FGD3r?= =?us-ascii?q?Z8g/FDC9xT6O1GUh0gOZ7f0eN6EdbyVRzFftuTT1amWNqmCykrTt0t298Of1?= =?us-ascii?q?p9G9K6gxDH3iqqBaIVlrOSCJwv7K3Tw2XxJ9x8y3ba1KgtllwmQsxSOm27gq?= =?us-ascii?q?5w6RPeB5DGk0qHjaamb6cc0zDX9GeF02WOuFtUUAlqUaXKRXoffFfZrczl5k?= =?us-ascii?q?PeSL+jEa8nMgtfxs6EJKpFdNvpgk5BRPf4PdTeYmaxlHmrCBaHw7ODdovqe2?= =?us-ascii?q?EH0CrBD0gEllNbwXHTGQEgC2+Ko2PYCjF0XQbjal3t/cFwsnS+SVU+zh3MZE?= =?us-ascii?q?pkgf79xhkTis6cQvUcluYWpCAnpB1qABCw08+AWPSaoA80R7lRedMw5h980G?= =?us-ascii?q?vdswFsdsi7I7tKmk8VcwMxuVjnkRpwFNMTwoARsHo2wV8qeuqj21RbembdhM?= =?us-ascii?q?qoNw=3D=3D?= X-IPAS-Result: =?us-ascii?q?A2AZAAB2hqtb/wHyM5BaDgsBAQEBAQEBAQEBAQEHAQEBA?= =?us-ascii?q?QEBgVSBYSqBZIQclEZQAQEGgQgtiGmNeoFmNgGEQAKDfSE3FQEDAQEBAQEBA?= =?us-ascii?q?gFsKII1JAGCXwEFIxVBEAsOCgICJgICVwYBDAgBAYJeP4F1DaMWgS6Ed4Uig?= =?us-ascii?q?QuJcBd5gQeBOYJrhDoRAQwGAYMgglcCiGaFWo5HCZAnBhePNJZpImRxKwgCG?= =?us-ascii?q?AghDzuCbZAZViOBKwEBiXsOF4ImAQE?= Received: from tarius.tycho.ncsc.mil ([144.51.242.1]) by emsm-gh1-uea11.NCSC.MIL with ESMTP; 26 Sep 2018 13:21:01 +0000 Received: from moss-pluto.infosec.tycho.ncsc.mil (moss-pluto.infosec.tycho.ncsc.mil [192.168.25.131]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id w8QDKxhB030987; Wed, 26 Sep 2018 09:21:00 -0400 Subject: Re: Leaking Path in XFS's ioctl interface(missing LSM check) To: Dave Chinner , TongZhang Cc: darrick.wong@oracle.com, linux-xfs@vger.kernel.org, LKML , linux-security-module@vger.kernel.org, Wenbo Shen References: <5EF0D46A-C098-4B51-AD13-225FFCA35D4C@vt.edu> <20180926013329.GD31060@dastard> From: Stephen Smalley Message-ID: Date: Wed, 26 Sep 2018 09:23:03 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180926013329.GD31060@dastard> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/25/2018 09:33 PM, Dave Chinner wrote: > On Tue, Sep 25, 2018 at 08:51:50PM -0400, TongZhang wrote: >> Hi, >> >> I'm bringing up this issue again to let of LSM developers know the situation, and would like to know your thoughts. >> Several weeks ago I sent an email to the security list to discuss the issue where >> XFS's ioctl interface can do things like vfs_readlink without asking LSM's >> permission, which we think is kind of weird and this kind of operation should be >> audited by LSM. > > These aren't user interfaces. They are filesystem maintenance and > extension interfaces. They are intended for low level filesystem > utilities that require complete, unrestricted access to the > underlying filesystem via holding CAP_SYSADMIN in the initns. > > i.e. they are used to perform filesystem maintenance and extension > operations that need to be completely invisible to users from > userspace. e.g. online file defragmentation (xfs_fsr), data > migration (e.g. HSM products), efficient backup of data (xfsdump), > metadata and data scrubbing, online repair, etc. > > IOWs, I really don't think these interfaces are something the LSMs > should be trying to intercept or audit, because they are essentially > internal filesystem interfaces used by trusted code and not general > user application facing APIs. If they are interfaces exposed to userspace, then they should be mediated via LSM. We only omit the LSM hook when the usage is purely kernel-internal. Security modules are often used to limit even "trusted" applications to least privilege and protect them from untrustworthy inputs, moving from binary trust notions to only trusting them for what they must be trusted to do. CAP_SYS_ADMIN doesn't necessarily indicate that they are trusted to override any given MAC policy restrictions. Wondering why we don't perform the security_inode_readlink() call inside of vfs_readlink() currently. The general pattern is that we do perform security_inode_*() calls inside the other vfs_*() helpers, so vfs_readlink() is an exception currently.