Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2407944rdb; Mon, 5 Feb 2024 05:55:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IFeJFXCTXTUXkRWMGI60FvqUVZldZWaa1+bVetOzWrPxzqsW9X45Lm9n4ZSV+G+Fh2JkqT9 X-Received: by 2002:a17:906:cc9:b0:a37:3acc:4ff4 with SMTP id l9-20020a1709060cc900b00a373acc4ff4mr5119188ejh.75.1707141322513; Mon, 05 Feb 2024 05:55:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707141322; cv=pass; d=google.com; s=arc-20160816; b=Mb5NRHC3pdoHeMAxKf/S7NadncO8/1PTw/txDq2SqY4K+W1hMsgx3bda6PDR1SiL6v 8eGlLn3ZzD0f2DT3Ao7n9K58mLKokFLBsRuU+EfRkeGOiqVvRR3BD2qZukIu0WQM6/CR O6KEiMQfWHnD6g517SpsEPdcAlwF8WRzx2oGpk3+4j7+0suW+PKF8/cE9fMbU+qgFPh0 TzEmQgPaNPNBduepxZtyN7Isgt5nR0CJvnl/T92APW46hy1A7xIV1GO7Rfu8+b9ErhPY sXnZkjB0Cw9riibwQAU/b0VPDFOqpXBTQbHr/+4AeHJB3T5a7KPXldXCy8RFsAbYxiq/ 8xxg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature:dkim-signature :dkim-signature:dkim-signature; bh=91FYVkMXI27dv7DB+mH1AzEVYKDByPJDu/tzLV3zDrs=; fh=He9kTkDxPwR0h4IneGZ0C6HoRcJ35aedGR6fz2I5ZHk=; b=gfzrt7VTrhBWVlY1oYJkTpFqoY/3L3nhw7eBGGyK1C9VCJ1QBLM10A+D3/YyjJArWA UfHrrYj96o0MTcLa3jYEN/xDgJ+5BjLuASwFfe/o2x7m+Di0d1eAoRMyEVApmE0+2d5M dfVnkJTlXM2e4VdTqSO+lavv/9uF0TLolFLSkLLLwVxHm30LNz0JN1/gWGDEItsSztdB KimsdNOAVCpVP1aBCjKCnmesrvguBNvCE72vgR1vm8I5sVC8N2shS+HOJ/818k+ypuBE JjM+rcBTAHZjJw/dOqjBfirMpi8k7/vvS9+3pPAiv2StglP3rqTBrTQb/m/bmiikrZQu GxpQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=UsKyBxQw; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b="RQO/mBUe"; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=UsKyBxQw; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-52754-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52754-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de X-Forwarded-Encrypted: i=1; AJvYcCVZaRk9fH71ztofO514wVZXzNmwUG+HmIVkBU7fatqEKCvXJBRssOhsQPfVV80eNQU5qbEqL7HEq/Yti07hWU5O/E8mcQK7vtsf9CxGmw== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h26-20020a170906591a00b00a37b94dc563si1119845ejq.429.2024.02.05.05.55.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 05:55:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-52754-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=UsKyBxQw; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b="RQO/mBUe"; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=UsKyBxQw; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-52754-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52754-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 1BFF11F25772 for ; Mon, 5 Feb 2024 13:55:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 09F1B22EFD; Mon, 5 Feb 2024 13:54:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="UsKyBxQw"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="RQO/mBUe"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="UsKyBxQw"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="RQO/mBUe" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61BBC2263E; Mon, 5 Feb 2024 13:54:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707141279; cv=none; b=FGMkTqYiGmvKLkphBOe4Uqg/xgF58CC4Ym4PwITaRV7T2YrtAP210ZixRSsg6YeBgIcqwQ8FXLYHu3QqGZ3wqcqIVSQV2T7y99aLnqgDPNQIycLhGBUdIF51vdWA1x8loL+qiiyudvSySBwLqcCM5G/G+4OTPAdqaZY4g+4ZvYk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707141279; c=relaxed/simple; bh=xY7sIFM80Rbz3G4McrGuT+OINz0NOWltW76ses9f6pM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=L5b7G5x/RNny81zYuBw/9sMtcF7H6MYyUhEjwUkhwq8y0sBprKYnWE78YS5tD65fcWp41E5HVF7N/RokuXEZ6nUJ6ei7BnpKh0oVUb0K0eaqr3CePvlVluRJLcAIqwDaHIYEnw/rivRqu3vjWLqn0YvmKybfs9fKjGuI9SfNdDA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=UsKyBxQw; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=RQO/mBUe; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=UsKyBxQw; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=RQO/mBUe; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 99D80219DA; Mon, 5 Feb 2024 13:54:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1707141273; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=91FYVkMXI27dv7DB+mH1AzEVYKDByPJDu/tzLV3zDrs=; b=UsKyBxQw21LyQfWqRS0xMqZYRSLQEl5j76mYaTD4EaIz7FQ71hfuhAntMi3PfZ7zbtDfwl wH4nIGAjLyrg0OKkgyj1F4wzufQSZjy+uo5u0cNPWqxcCevh48Tyuc/B0AfW57eF00XRjW m/iwevtE5g5smuCkAoZSZ8CKBWwe6Ts= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1707141273; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=91FYVkMXI27dv7DB+mH1AzEVYKDByPJDu/tzLV3zDrs=; b=RQO/mBUecyRisGHTsrmvIVXTs232vjGtIyhwEAWTtA0UTetQwt2StSE3lID+CiATLiS0za iLmvjPuD5Tb5t8Cg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1707141273; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=91FYVkMXI27dv7DB+mH1AzEVYKDByPJDu/tzLV3zDrs=; b=UsKyBxQw21LyQfWqRS0xMqZYRSLQEl5j76mYaTD4EaIz7FQ71hfuhAntMi3PfZ7zbtDfwl wH4nIGAjLyrg0OKkgyj1F4wzufQSZjy+uo5u0cNPWqxcCevh48Tyuc/B0AfW57eF00XRjW m/iwevtE5g5smuCkAoZSZ8CKBWwe6Ts= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1707141273; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=91FYVkMXI27dv7DB+mH1AzEVYKDByPJDu/tzLV3zDrs=; b=RQO/mBUecyRisGHTsrmvIVXTs232vjGtIyhwEAWTtA0UTetQwt2StSE3lID+CiATLiS0za iLmvjPuD5Tb5t8Cg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2762E136F5; Mon, 5 Feb 2024 13:54:28 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id KPBuBZTowGWYZQAAD6G6ig (envelope-from ); Mon, 05 Feb 2024 13:54:28 +0000 Received: from localhost (brahms.olymp [local]) by brahms.olymp (OpenSMTPD) with ESMTPA id 27a4dd74; Mon, 5 Feb 2024 13:54:11 +0000 (UTC) From: Luis Henriques To: David Howells Cc: Jarkko Sakkinen , Eric Biggers , keyrings@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] keys: update key quotas in key_put() In-Reply-To: <3007646.1707134664@warthog.procyon.org.uk> (David Howells's message of "Mon, 05 Feb 2024 12:04:24 +0000") References: <20240130101344.28936-1-lhenriques@suse.de> <3007646.1707134664@warthog.procyon.org.uk> Date: Mon, 05 Feb 2024 13:54:11 +0000 Message-ID: <87il33f24c.fsf@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out1.suse.de; none X-Spamd-Result: default: False [-0.10 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[4]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; BAYES_HAM(-0.00)[16.05%] X-Spam-Level: X-Spam-Flag: NO X-Spam-Score: -0.10 David Howells writes: > Luis Henriques wrote: > >> Delaying key quotas update when key's refcount reaches 0 in key_put() has >> been causing some issues in fscrypt testing, specifically in fstest >> generic/581. This commit fixes this test flakiness by dealing with the >> quotas immediately, and leaving all the other clean-ups to the key garba= ge >> collector. > > Okay, I'll accept this. > That's awesome, thanks a lot David. And, as Eric requested, I'll send out shortly a follow-up fscrypt-specific patch, which will make generic/581 fstest finally pass. Cheers, --=20 Lu=C3=ADs >> This is done by moving the updates to the qnkeys and qnbytes fields in >> struct key_user from key_gc_unused_keys() into key_put(). >> Unfortunately, this also means that we need to switch to the >> irq-version of the spinlock that protects these fields and use >> spin_lock_{irqsave,irqrestore} in all the code that touches these >> fields. > > ... Which shouldn't be that often. It only happens when a key is created= or > finally let go of. > >> Signed-off-by: Luis Henriques > > Acked-by: David Howells > > Jarkko - could you pick this up? >