Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4245019pxb; Tue, 17 Nov 2020 15:41:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxtvwTUojqYdlmG6/pu7Vgic6dHOLyhwosntmjvE1uecH18vXaJB7efKyXkkbAgPeEs3aGn X-Received: by 2002:aa7:da01:: with SMTP id r1mr23832983eds.45.1605656477708; Tue, 17 Nov 2020 15:41:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605656477; cv=none; d=google.com; s=arc-20160816; b=I4GMPRwX22pE/M5V1cA01bnxKsMRuHnJFyOeccnh3aNiPkJXEVxkS/bLCASFmcHkS2 N4+xUcj3y4XPx/ekc1PgxVcH8OzjEAReKwv3fyu9JoPKtaMJ8T1G7tUMQTIuScPnNlIx Mw6q2PycLRBf+O4HW1TjT6A2utifxHKCOpbSgbQ8eWNfhskt/PvjvdS3dKwUpmAIWW0p u0oi1cNl7zUXLWB496t3P+7virJWphx+GqEnAX71b6/D1OQWMS1iLJ6z/h6N8iGBCKcG xcaNPP6xr1HfJOhr1I5kZjEjczyjr7xCIVb8v9xQ1rjSv+spu72YnpKPdo8wpL6MZAin 0UCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=D0kv/TGZCBjgkfEmVlmQGbddq7Vuqk22W0hkuqKhgPg=; b=0JWwRzbv0BKcGZc3m/FhXb41rALb+DrN1L75mlVgJR1wC91ntsS12HYaWPj+Yx42yW cDfcUp2KFjWIH2MRK7G0S3eoShco4COKvnxtG/SW7KL5jXkaLQIVA+YALtkJDfFk55EA tH6IXQGfvGTNgYt4A7D0GYvAoLcbzcWCTx6pGhvTU07ugQoqu6gK0N+zQ2MJwTV5d9Mr h/1CFQl79bEZRhItNgT/RMTjrMaKbSPMC3l3PavJX/4ruSkC1C7gWkkJvHyQI8NEUY8r WElkk7N1bd1b8rCLH4sZaZkUpdS5sCags/uJ+m7O4rNvxaF51WEHJuQpv8oFgLhUHShB yUbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=ZfCK9fE5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l30si14086380edl.99.2020.11.17.15.40.54; Tue, 17 Nov 2020 15:41:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=ZfCK9fE5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728678AbgKQXgw (ORCPT + 99 others); Tue, 17 Nov 2020 18:36:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726273AbgKQXgw (ORCPT ); Tue, 17 Nov 2020 18:36:52 -0500 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B029C0617A7 for ; Tue, 17 Nov 2020 15:36:51 -0800 (PST) Received: by mail-lj1-x243.google.com with SMTP id l10so288976lji.4 for ; Tue, 17 Nov 2020 15:36:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=D0kv/TGZCBjgkfEmVlmQGbddq7Vuqk22W0hkuqKhgPg=; b=ZfCK9fE5KEx2c6LJVDvCKbk18EHOGfANhut79KLdPiY11VCpPSw0vPYJaLCzYbWfN7 rxR97+wOKkrhlTSFjVmx0Ens33MZNx+ydmyDkcSx3o5aSc4rS+WnAeqjoTEjOy+8p4IX mcTfZ1lbMzrFtnx5GPNlU5oqnxJmpNU4bc8o8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=D0kv/TGZCBjgkfEmVlmQGbddq7Vuqk22W0hkuqKhgPg=; b=bZVWgxl8qlIo14IdZIB5dBDWcDGsBaUlaNsoS23hyRdWBEB6yNxeRRheJLID7eHPvY 5SBt3CpLZaO0bJpYPmZNV/l0UGIe3o9+AJ3KbOOzpLQo45V7mC3d/2ZwH2taWjYKvZSb Dni5V55gH1u9jwdHh55cp1quOHa/OqmS4THSezmq/mRmyTjZtaspU7o7iTKPbw2xHgAK Mm5tWmSnQdBEX7bLi1fbN+HfC6Sb453iuPs9whVxhcHPXb1v3kN8pw1eVBmzdJJXipT2 HphH1bjzUmMEjBN2Unl5CAGV9MrWNTVzDxBOjLCBIzQwXhI0WdNoAs7Dy8gEtMJxHOgE 10zw== X-Gm-Message-State: AOAM532XS6VSRzpYArWGzsUdgQslhUNxLhZyyQiGmEnNmCGMNpJTcmp2 rmWFDU2wIJBcqYuBi8mnjmPBnevY4G9sLQ== X-Received: by 2002:a2e:8e76:: with SMTP id t22mr2942401ljk.10.1605656209724; Tue, 17 Nov 2020 15:36:49 -0800 (PST) Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com. [209.85.208.178]) by smtp.gmail.com with ESMTPSA id r19sm1535218lfi.41.2020.11.17.15.36.47 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Nov 2020 15:36:47 -0800 (PST) Received: by mail-lj1-f178.google.com with SMTP id y16so311876ljh.0 for ; Tue, 17 Nov 2020 15:36:47 -0800 (PST) X-Received: by 2002:a2e:80c7:: with SMTP id r7mr1059615ljg.285.1605656206837; Tue, 17 Nov 2020 15:36:46 -0800 (PST) MIME-Version: 1.0 References: <20201113080132.16591-1-roberto.sassu@huawei.com> <20201114111057.GA16415@infradead.org> <0fd0fb3360194d909ba48f13220f9302@huawei.com> <20201116162202.GA15010@infradead.org> <20201116174127.GA4578@infradead.org> <3f8cc7c9462353ac2eef58e39beee079bdd9c7b4.camel@linux.ibm.com> <5d8fa26d376999f703aac9103166a572fc0df437.camel@linux.ibm.com> In-Reply-To: From: Linus Torvalds Date: Tue, 17 Nov 2020 15:36:30 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RESEND][PATCH] ima: Set and clear FMODE_CAN_READ in ima_calc_file_hash() To: Mimi Zohar Cc: Christoph Hellwig , Roberto Sassu , "linux-integrity@vger.kernel.org" , "linux-security-module@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Silviu Vlasceanu , "stable@vger.kernel.org" , "viro@zeniv.linux.org.uk" , "linux-fsdevel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 17, 2020 at 3:29 PM Linus Torvalds wrote: > > On Tue, Nov 17, 2020 at 3:24 PM Mimi Zohar wrote: > > > > I really wish it wasn't needed. > > Seriously, I get the feeling that IMA is completely mis-designed, and > is doing actively bad things. > > Who uses this "feature", and who cares? Because I would suggest you > just change the policy and be done with it. Another alternative is to change the policy and say "any write-only open gets turned into a read-write open". But it needs to be done at *OPEN* time, not randomly afterwards by just lying to the 'struct file'. Why? Because the open has told the filesystem that it's only for writing, and a filesystem could validly do things that make reading invalid. The simplest example of this is a network filesystem, where the server might simply not *allow* reads, because the open was for writing only. See? IMA really does something fundamentally quite wrong when it tries to read from a non-readable file. It might "work" by accident, but I really do think that commit a1f9b1c0439db didn't "break" IMA - it showed that IMA was doing something fundamentally wrong. Linus