Message ID | 20230320205617.GA1434@sol.localdomain |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp1438056wrt; Mon, 20 Mar 2023 14:07:44 -0700 (PDT) X-Google-Smtp-Source: AK7set+8cBbu5G3aQxKqb99OItL57wVJYqT//xakYktgQsBpzJuEg0ODGvZzxYZb6vhQGfO2S5CH X-Received: by 2002:a05:6a20:be04:b0:da:4e05:768 with SMTP id ge4-20020a056a20be0400b000da4e050768mr1300940pzb.38.1679346464154; Mon, 20 Mar 2023 14:07:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679346464; cv=none; d=google.com; s=arc-20160816; b=kXjHz0ZF/YdUtc7WluFlozuIprMBZ8cxSafpAu1d5S9APfV6HaSWJ+DzmzXXX1H5tM iliJut0F1GsXgVWo16xrdqnaJS4zWx5fmgrUH2aqHrTDeoqlvvaLnMg/gcOCktIYW3Td y9qX41zrndljPpY1i1dCxWVUACnXKX5YKWPLdIZxv/HIF2LkhTRIDxGAbPrSO2YPo/Fb fphhLM+zX+fEwXZMMpnvtOHogXmQbehoLZku+VRMA+EcGy8EHEfCIfWwCH3173fsEYGV vUtdA/Im/9tcgdfueIFp+WWP5hO2Bvyy5FEdMhX1tu9CAmSFfAKgS/Cyf9cHUWazAaaL wJhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=QLg/ISaInymVvp/5UvtkC2t4FzK6wwh9CGZ250ya4QY=; b=ajvvQbBh7WFgYDRiNJ+O2/VFvrM0togKno5O54epqak/FfH6+zJ5V3G7JhaL5Bh0v6 W1Z5T+jJqgEGJObzrzy51lVdYfOP3G+dswAdyItnENJcomllxjGCusi4x9twoL5bKm9o xcSGoDF8jgb6VF2L69fGOF1Il5NKnGDXogUuTrglA0T+rbA/vvads047fQ4fS3nriEYA YDAFj/iyWgLEi2B+zHsmCiFKrLId1fTyhGKwnBJ8KLY1EyE6tO7ZrM6uJLz7jYQ5/sP2 vqJ/xfP8CiEqcOCvm8t03Lvxuby4tpNIAgKFrhLkXmnUUfA1uMkkkkacRjTQT4zUKlYi 0pnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=U5f18BUk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q11-20020a63504b000000b004fbe30d869esi11045358pgl.268.2023.03.20.14.07.30; Mon, 20 Mar 2023 14:07:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=U5f18BUk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229799AbjCTU4a (ORCPT <rfc822;pusanteemu@gmail.com> + 99 others); Mon, 20 Mar 2023 16:56:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230138AbjCTU41 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 20 Mar 2023 16:56:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDF7846A2; Mon, 20 Mar 2023 13:56:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E685161812; Mon, 20 Mar 2023 20:56:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E15DCC4339B; Mon, 20 Mar 2023 20:56:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679345779; bh=TIisIt10fTBip8aXju7/P4H6FODyu04/HbhhX49wO9c=; h=Date:From:To:Cc:Subject:From; b=U5f18BUkAyOeemq+22V7ydwhU6CkvKYt0o8epjIrF0czmcfDjiO6l/qH1Dyj1kzrG QUAI3mZzKD1ahZyJY/KWPlbSVe81sqXAgnCpIfAz7MtASKADACYryCU8cSEgZecc9j zlehdT5gmVpt7G0PLyEOhsCKfSvds1PuNphhyQR+qmiQ7CLu2Sr4pjgROgcYXoVIs3 j7wG3QUllgK7yn6mDxn7RRzvw4shjIilMNewkePzbuVLGayq9mmz8FotoZES+8VJBZ prpx8rnFWGiQOwqVeiOBeP6SSJ8xPJJ0C48++C7IVdHdUPzetM8UTP6LNoz6iPVulj CkKA5jzVtGvrQ== Date: Mon, 20 Mar 2023 13:56:17 -0700 From: Eric Biggers <ebiggers@kernel.org> To: Linus Torvalds <torvalds@linux-foundation.org> Cc: linux-fscrypt@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Theodore Ts'o <tytso@mit.edu>, Jaegeuk Kim <jaegeuk@kernel.org> Subject: [GIT PULL] fscrypt fix for v6.3-rc4 Message-ID: <20230320205617.GA1434@sol.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760922397692464611?= X-GMAIL-MSGID: =?utf-8?q?1760922397692464611?= |
Series |
[GIT,PULL] fscrypt fix for v6.3-rc4
|
|
Pull-request
https://git.kernel.org/pub/scm/fs/fscrypt/linux.git tags/fscrypt-for-linusMessage
Eric Biggers
March 20, 2023, 8:56 p.m. UTC
The following changes since commit fe15c26ee26efa11741a7b632e9f23b01aca4cc6: Linux 6.3-rc1 (2023-03-05 14:52:03 -0800) are available in the Git repository at: https://git.kernel.org/pub/scm/fs/fscrypt/linux.git tags/fscrypt-for-linus for you to fetch changes up to 4bcf6f827a79c59806c695dc280e763c5b6a6813: fscrypt: check for NULL keyring in fscrypt_put_master_key_activeref() (2023-03-18 21:08:03 -0700) ---------------------------------------------------------------- Fix a bug where when a filesystem was being unmounted, the fscrypt keyring was destroyed before inodes have been released by the Landlock LSM. This bug was found by syzbot. ---------------------------------------------------------------- Eric Biggers (3): fscrypt: destroy keyring after security_sb_delete() fscrypt: improve fscrypt_destroy_keyring() documentation fscrypt: check for NULL keyring in fscrypt_put_master_key_activeref() fs/crypto/keyring.c | 23 +++++++++++++---------- fs/super.c | 15 ++++++++++++--- 2 files changed, 25 insertions(+), 13 deletions(-)
Comments
On Mon, Mar 20, 2023 at 1:56 PM Eric Biggers <ebiggers@kernel.org> wrote: > > fscrypt: check for NULL keyring in fscrypt_put_master_key_activeref() Side note: please just use WARN_ON_ONCE() for things like this, not WARN_ON. If it's triggerable, it should be triggered only once rather than flood the logs and possibly cause a DoS. And if it's not triggerable, the "ONCE" doesn't matter. I note that fscypt in general seems to be *way* too happy with WARN_ON() as some kind of debugging aid. It's not good in general (printf for debugging is wonderful, but shouldn't be left in the sources to rot for all eternity), but it's particularly not good in that form. Linus
The pull request you sent on Mon, 20 Mar 2023 13:56:17 -0700:
> https://git.kernel.org/pub/scm/fs/fscrypt/linux.git tags/fscrypt-for-linus
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/4f1e308df88ad25c88ab4240161cbac45ba2d78e
Thank you!
On Mon, Mar 20, 2023 at 03:16:48PM -0700, Linus Torvalds wrote: > On Mon, Mar 20, 2023 at 1:56 PM Eric Biggers <ebiggers@kernel.org> wrote: > > > > fscrypt: check for NULL keyring in fscrypt_put_master_key_activeref() > > Side note: please just use WARN_ON_ONCE() for things like this, not WARN_ON. > > If it's triggerable, it should be triggered only once rather than > flood the logs and possibly cause a DoS. > > And if it's not triggerable, the "ONCE" doesn't matter. > > I note that fscypt in general seems to be *way* too happy with > WARN_ON() as some kind of debugging aid. > > It's not good in general (printf for debugging is wonderful, but > shouldn't be left in the sources to rot for all eternity), but it's > particularly not good in that form. > Yes, I agree that most of the WARN_ONs should be WARN_ON_ONCEs. I think I've been assuming that WARN_ON is significantly more lightweight than WARN_ON_ONCE. But that doesn't seem to be the case, especially since commit 19d436268dde ("debug: Add _ONCE() logic to report_bug()"). But besides that, I believe WARN* is generally being used appropriately in fs/crypto/. It's used when assumptions made by the code are violated, but where the hard crash of a BUG() is not necessary. I think this is a good thing to have, versus the alternative of doing nothing and making it much harder to track down bugs... Some particularly bad crypto bugs that we can easily WARN about, such as IVs being truncated, may not even be detectable by users otherwise. There are probably a few that should be removed, though. I'm also considering whether the refcounting-related ones should use CHECK_DATA_CORRUPTION, though that may run afoul of the "don't use BUG() unless absolutely needed" rule... - Eric
On Mon, Mar 20, 2023 at 03:59:34PM -0700, Eric Biggers wrote: > > Yes, I agree that most of the WARN_ONs should be WARN_ON_ONCEs. I think I've > been assuming that WARN_ON is significantly more lightweight than WARN_ON_ONCE. > But that doesn't seem to be the case, especially since commit 19d436268dde > ("debug: Add _ONCE() logic to report_bug()"). Another option is WARN_RATELIMITED. As an unrelated side-note, one of the things I've been working on in some of the ext4 code paths when I've been moving BUG_ON's to WARN_RATELIMITED is to think about what might be needed to debug a problem, and sometimes it can be helpful to use a printf string to provide more context than just a WARN_ON. Cheers, - Ted
On Mon, Mar 20, 2023 at 7:03 PM Theodore Ts'o <tytso@mit.edu> wrote: > > Another option is WARN_RATELIMITED. I don't think that exists. There's 'pr_warn_ratelimited()', but honestly, the rate limiting is a joke. It's fine for things that never happen, but if you can flood things without the rate limiting, you can still flood things with the rate limiting. The default rate limiting is "max five reports every five seconds". For some "this should never happen", a reasonable rate limit might be "once every 24 hours" or something like that. Just make sure that if the machine stays up for months or years at a time, it doesn't get hidden in all the *other* noise. Our rate limiting sucks. The only thing that really saves it is that rate limiting is used for things that never happen in the first place, and the default values are basically picked for "this is a network DoS attempt, let's make sure it stands out in the logs without completely bogging down the machine". So no. Please don't use "ratelimited" for "this shouldn't happen". It's still going to suck. We had that *exact* thing just a couple of weeks ago: https://lore.kernel.org/all/CAHk-=wjTMgB0=PQt8synf1MRTfetVXAWWLOibnMKvv1ETn_1uw@mail.gmail.com/ where the networking people thought that ratelimiting would be a good idea. It's not a good idea. Linus