From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA253C2D0F8 for ; Tue, 12 May 2020 22:03:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A050820575 for ; Tue, 12 May 2020 22:03:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="GIs92r1+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731548AbgELWDd (ORCPT ); Tue, 12 May 2020 18:03:33 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:48311 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728313AbgELWDc (ORCPT ); Tue, 12 May 2020 18:03:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589321011; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ns5UOQMLizpSxZdFpRK9TbCkGBwHVENlcHczF4G1fL8=; b=GIs92r1+5nz8mVeriRwhTQ1n+A77LC+5gqTWCUV2qS06lcAtvWY5j41Ow7cU4RqAtjpSJo s8PROhhmLEN0KNpg0CpJlNxx1hDR8LQofSuKdqA/QNmelvtQC08whwWYEIgMuuDGlyVX7N XbGtRAo42vjXrpKoYK26Qpd0X/pWj3c= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-164-0MUo9GkKPLKCnl2yk28XwQ-1; Tue, 12 May 2020 18:03:28 -0400 X-MC-Unique: 0MUo9GkKPLKCnl2yk28XwQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3F194473; Tue, 12 May 2020 22:03:26 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-112-59.rdu2.redhat.com [10.10.112.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 29D2953E3B; Tue, 12 May 2020 22:03:24 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: References: <20200511215101.302530-1-Jason@zx2c4.com> <2620780.1589289425@warthog.procyon.org.uk> To: "Jason A. Donenfeld" Cc: dhowells@redhat.com, keyrings@vger.kernel.org, LKML , Andy Lutomirski , Greg KH , Linus Torvalds , kernel-hardening@lists.openwall.com, Eric Biggers Subject: Re: [PATCH v3] security/keys: rewrite big_key crypto to use library interface MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2858488.1589321003.1@warthog.procyon.org.uk> Date: Tue, 12 May 2020 23:03:23 +0100 Message-ID: <2858489.1589321003@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jason A. Donenfeld wrote: > So long as that ->update function: > 1. Deletes the old on-disk data. > 2. Deletes the old key from the inode. > 3. Generates a new key using get_random_bytes. > 4. Stores that new key in the inode. > 5. Encrypts the updated data afresh with the new key. > 6. Puts the updated data onto disk, > > then this is fine with me, and feel free to have my Acked-by if you > want. But if it doesn't do that -- i.e. if it tries to reuse the old > key or similar -- then this isn't fine. But it sounds like from what > you've described that things are actually fine, in which case, I guess > it makes sense to apply your patch ontop of mine and commit these. Yep. It calls big_key_destroy(), which clears away the old stuff just as when a key is being destroyed, then generic_key_instantiate() just as when a key is being set up. The key ID and the key metadata (ownership, perms, expiry) are maintained, but the payload is just completely replaced. David