Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1423602pxb; Tue, 17 Aug 2021 11:17:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLoo27UyFMhLi51vSsHnh38RidaZcmLFoKNqQQ/t8QpSsx2VAWiZtbOGTeA4kOQBocaIxe X-Received: by 2002:a50:9fa3:: with SMTP id c32mr5618224edf.354.1629224258538; Tue, 17 Aug 2021 11:17:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629224258; cv=none; d=google.com; s=arc-20160816; b=EX4ik9qGS4IuUwS4E3+lY+2E0wshhLZ+iArfxNRrJxM8y892sJ4xyvL6omsZINS9Fp 1Fi4Cp5nDD7MRg8eriDZF4FQv3b/UwBMtyDhiRxT70WL+W0H21cE6CvTMSrZyDY24r1u 79ekBhFg+M4ph/IRPblwxW7kQ7RzBphdVO6Ut5gdayj9HmoDLEdIZiUmzyeTIBrXNoX9 lu2KCp84g24eS7x342BmGaGvvVA5qSac9JurOmo43JDvMbw/HWG+jPb20iqjneSMLiP1 AW4Uy6hqTeqa5l5UZLuaxRIVs6iXK8+HmKqfMXoU5lObwjRnBktJWcMvsDBuy3A9YmeI Rp8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XxZOJFQ4/UtYMMPE2hte00+BJM98D2VDLNtyNZE78CM=; b=YQiYjFmtFQSYrDIfqnNgp7zk6TpInaJT/u6hyJ6d+jog1ytx0kt05J/rtz0QISS7aN kZdHtTO1lHikTOfIBpSuV3T6LZdJO7WpDWFpPcZmZN6qZk/DlNpqohs5ks5BezkDgzpl CIKC1IF0d+dG7r5wvSYIjbuoZflfhz/nSK61ImAyMu09Y/Oou7wXZl4SSycZHUqY0Map IndkAdUMw6n/tIy0aZ+O1VnJ7/Hj1kn1dxqt79wPSlNKwA1xgyimqCzYZQBa7WYv8Nof BczlkpnazWD+ypCogjw8p49zW2yXTbArus5FAqZG92Fr+FEwCkudWBGh5N0dZZA8rZJh Z/Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=BsBVJFBS; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q5si3437056edh.492.2021.08.17.11.17.10; Tue, 17 Aug 2021 11:17:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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=@alien8.de header.s=dkim header.b=BsBVJFBS; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229918AbhHQSRk (ORCPT + 99 others); Tue, 17 Aug 2021 14:17:40 -0400 Received: from mail.skyhub.de ([5.9.137.197]:46944 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229850AbhHQSRk (ORCPT ); Tue, 17 Aug 2021 14:17:40 -0400 Received: from zn.tnic (p200300ec2f1175006a73053df3c19379.dip0.t-ipconnect.de [IPv6:2003:ec:2f11:7500:6a73:53d:f3c1:9379]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 5AA421EC0556; Tue, 17 Aug 2021 20:17:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1629224221; 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: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=XxZOJFQ4/UtYMMPE2hte00+BJM98D2VDLNtyNZE78CM=; b=BsBVJFBSgu8Iv+F/GHrHfxj/N39ok4iLAd9NnK//E2y4h0hIzNsuRbvYJV5enGEYZ+ladi EEOmWDLqlrqST8OrYcF6YjXH7HODiN1sGhL6u9ylqdwKxjmjnHWbnQyWax69Htj3T+/Osz CFyip7AO9eYqt6jCKmskrU3WvMimYlk= Date: Tue, 17 Aug 2021 20:17:40 +0200 From: Borislav Petkov To: Brijesh Singh Cc: x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, linux-crypto@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Andy Lutomirski , Dave Hansen , Sergio Lopez , Peter Gonda , Peter Zijlstra , Srinivas Pandruvada , David Rientjes , Dov Murik , Tobin Feldman-Fitzthum , Michael Roth , Vlastimil Babka , tony.luck@intel.com, npmccallum@redhat.com, brijesh.ksingh@gmail.com Subject: Re: [PATCH Part1 RFC v4 15/36] x86/mm: Add support to validate memory when changing C-bit Message-ID: References: <20210707181506.30489-1-brijesh.singh@amd.com> <20210707181506.30489-16-brijesh.singh@amd.com> <162d75ca-f0ec-bb7e-bb47-70060772a52c@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <162d75ca-f0ec-bb7e-bb47-70060772a52c@amd.com> Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Tue, Aug 17, 2021 at 01:07:40PM -0500, Brijesh Singh wrote: > > > + if (!desc) > > > + panic("failed to allocate memory"); > > > > Make that error message more distinctive so that *if* it happens, one > > can pinpoint the place in the code where the panic comes from. > > > > Now I am running checkpatch and notice that it complain about the message > too. I can add a BUG() or WARN() to get the stack trace before the crashing. checkpatch complains because there's a kmalloc before it and if it fails, the mm core will issue a warning so there's no need for a warning here. But in this case, you want to panic and checkpatch doesn't see that so you can ignore it here and leave the panic message but make it more distinctive so one can find it by grepping. IOW, something like if (!desc) panic("SEV-SNP: Failed to allocame memory for PSC descriptor"); Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette