Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C53BC61D97 for ; Sun, 29 Jan 2023 23:38:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234294AbjA2XiD (ORCPT ); Sun, 29 Jan 2023 18:38:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230220AbjA2XiA (ORCPT ); Sun, 29 Jan 2023 18:38:00 -0500 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A96B7ED3 for ; Sun, 29 Jan 2023 15:37:58 -0800 (PST) Received: by mail-pj1-x102d.google.com with SMTP id 88so9579848pjo.3 for ; Sun, 29 Jan 2023 15:37:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore.com; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Ii9FzGVPdJKeqmlVk6BfPihf+mnXJKtSNMOOo2LczXo=; b=TdgwbBC2khseugaXjKoePaiFnVk+3hmdfhoOgQhBmGp24IfmiXIB/zhxGUtbeiumye KD/8lQiZ4YKXlLpjiUVdOu/V+L76VEz5FsUjeSpl0roQ06tGt08zDJZ1qDk9LjL8BK3A S17nyOm8kfYvc29tifWLBmFROGdyKcn44vIu3q1QY4BO+eWmMsk6AGslSJXQqU7Z3HR6 l2yN3byEwuqPLTTLGbV37kYcvb/Fv97d/2PEHxgwcvkLWLu/A5VlYw6I9IkS+v4s7/Ji FAGlNPG2Rl8M2j6ROepL2M2yIjaQWttTHXnp31FtgS4HvXAzXL2itgTd2Oyo1UP4EvcB b/Vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Ii9FzGVPdJKeqmlVk6BfPihf+mnXJKtSNMOOo2LczXo=; b=TuJezOqrHEpfU3Z/4K05k1YpFJonpR5kwDkVlDwSzR/H/mlsnHoekLcBaMZ5dxpj/A zmAjwD3utXx9CvXozIb3ZmPdFeKNb1vl8Q9aEINzTeiOxx1fKql/YE5JHTHsVbbwGMxm QagbkSItsDRKoiLxY7L8rxiEBt7PJvRK1rTkeE2woQdbVUX25enmAacXhUjJG9GtGgSl /CIcbilW3HlmYwtwfM0c+rZeLE1GQshEaKKc8FygthK/LkrPOiJRxHlX5d/4CgisGuAC b5oheTUWjuZViAtvmwqgMH2jxfFjae8fj8IqNXIPWm1HXgW7knymRFu4/85TzPvUv48s xE5g== X-Gm-Message-State: AO0yUKVcIAJd2JL+0gSDR2CIOgUaIvdADPfXGYE5xm2qSrXO/BpDHGob cst3Rpnn9dOZe70mNWCC41oJ9Mcyjv9iCZT3Bm5+ X-Google-Smtp-Source: AK7set9i6kPMbxYMLoRoKdYNnrxmH+/Q1k10jefV7aKr2PmLgJDp7B1Q7hjCwqAcpxG54WssPx5U8ncUkGb/WCFxaLA= X-Received: by 2002:a17:90a:19c8:b0:22c:b70b:15ba with SMTP id 8-20020a17090a19c800b0022cb70b15bamr13988pjj.193.1675035477513; Sun, 29 Jan 2023 15:37:57 -0800 (PST) MIME-Version: 1.0 References: <13202484.uLZWGnKmhe@x2> In-Reply-To: <13202484.uLZWGnKmhe@x2> From: Paul Moore Date: Sun, 29 Jan 2023 18:37:46 -0500 Message-ID: Subject: Re: [PATCH v1 2/2] io_uring,audit: do not log IORING_OP_*GETXATTR To: Steve Grubb Cc: Richard Guy Briggs , Linux-Audit Mailing List , LKML , io-uring@vger.kernel.org, Eric Paris , Stefan Roesch , Christian Brauner , Jens Axboe , Pavel Begunkov Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 28, 2023 at 12:26 PM Steve Grubb wrote: > On Friday, January 27, 2023 5:43:02 PM EST Paul Moore wrote: > > On Fri, Jan 27, 2023 at 12:24 PM Richard Guy Briggs wrote: > > > Getting XATTRs is not particularly interesting security-wise. > > > > > > Suggested-by: Steve Grubb > > > Fixes: a56834e0fafe ("io_uring: add fgetxattr and getxattr support") > > > Signed-off-by: Richard Guy Briggs > > > --- > > > io_uring/opdef.c | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > Depending on your security policy, fetching file data, including > > xattrs, can be interesting from a security perspective. As an > > example, look at the SELinux file/getattr permission. > > > > https://github.com/SELinuxProject/selinux-notebook/blob/main/src/object_cla > > sses_permissions.md#common-file-permissions > > We're mostly interested in setting attributes because that changes policy. > Reading them is not interesting unless the access fails with EPERM. See my earlier comments, SELinux does have provisions for caring about reading xattrs, and now that I look at the rest of the LSMs it looks like Smack cares about reading xattrs too. Regardless of whether a given security policy cares about xattr access, the LSMs support enforcing access on reading xattrs so we need to ensure the audit is setup properly in these cases. > I was updating the user space piece recently and saw there was a bunch of > "new" operations. I was commenting that we need to audit 5 or 6 of the "new" > operations such as IORING_OP_MKDIRATor IORING_OP_SETXATTR. But now that I see > the patch, it looks like they are auditable and we can just let a couple be > skipped. IORING_OP_MADVISE is not interesting as it just gives hiints about > the expected access patterns of memory. If there were an equivalent of > mprotect, that would be of interest, but not madvise. Once again, as discussed previously, it is likely that skipping auditing for IORING_OP_MADVISE is okay, but given that several of the changes in this patchset were incorrect, I'd like a little more thorough investigation before we skip auditing on madvise. > There are some I'm not sure about such as IORING_OP_MSG_RING and > IORING_OP_URING_CMD. What do they do? Look at 4f57f06ce218 ("io_uring: add support for IORING_OP_MSG_RING command") for the patch which added IORING_OP_MSG_RING as it has a decent commit description. As for IORING_OP_URING_CMD, there were lengthy discussions about it on the mailing lists (including audit) back in March 2022 and then later in August on the LSM, SELinux, etc. mailing lists when we landed some patches for it (there were no audit changes). I also covered the IORING_OP_URING_CMD, albeit briefly, in a presentation at LSS-EU last year: https://www.youtube.com/watch?v=AaaH6skUEI8 https://www.paul-moore.com/docs/2022-lss_eu-iouring_lsm-pcmoore-r3.pdf -- paul-moore.com