Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7153840rwr; Wed, 10 May 2023 04:49:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6kLFKXSSj/B7MiW/GRGo0EkjAVJakhOgq7odCBZ3G5T3FDyuWD19JUeyZcxPf/q48N3zNE X-Received: by 2002:a05:6a21:920d:b0:eb:69b3:116c with SMTP id tl13-20020a056a21920d00b000eb69b3116cmr20347498pzb.52.1683719354243; Wed, 10 May 2023 04:49:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683719354; cv=none; d=google.com; s=arc-20160816; b=UVadDtdVdxafLoYPbbs35uoJ0nTzHjWUV4jzonQpNdkvFDtJs1ArzV5H8VayrIMpeM 54/UgBaN3xRvcC/R0NIzX6Q+/aXikOgom0EYD64WxDggbMLWgNqU5cxBqWmH1oJrlAPn i9KKwRzkaq2j4YN1VZUVi0hDymmwMoLaaFg6UBtZ3Nnx1l2tm+RznGViLc/YY0fAlBIf vn/AdQvpE22/JPkPa0uA1f4DvYOuK9Sl5epfCHV/DGQAvB5obsx4RWYIc5VhvtgqfSzx VVOJF0smKF/v+l0kGfyxlF8LfYV1IVPATN4pX7Is3V9TpKwyWvG0Zl9ag9bYqLv0lA2H yKXA== 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=PkOGxR0M+FAPkq52+rH7zXIhdbVNcWipgwSVZpJf70E=; b=0yURfhvM7iPswNitDDdytDmCyVkokbetO3RZKxEbObMp0L20oYeDXaNEZL8CAikORQ CbI8WZ6omGrXFQI6p4XQqQEWsydYeYNQJBIZHbeUwF+WOWKUBpkIcr+Uar2b6aBDYasa twhmUlmjjH9B9ctpXZz1NajwSpL0fGRRBaGPvmb/aTdZEdTVyzsZGakKGS5GFOflWBKA gIm3mpPjAS6cn7srZU+ipxhCNBFMKlxFGZse2qX8cDgvU0sIsIVYpGbhrUq0HSNFzQx6 gpY4ctCYFEqL/HYoKoBBd6RBIfcdPoYBNDUt1SmzY4prtB4WHSJi8Rw/BHqvS0hh387e fVTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=TPM3gYl3; 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=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w12-20020a63934c000000b005186ed361f4si3694740pgm.315.2023.05.10.04.49.02; Wed, 10 May 2023 04:49:14 -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=@alien8.de header.s=dkim header.b=TPM3gYl3; 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=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236952AbjEJLgG (ORCPT + 99 others); Wed, 10 May 2023 07:36:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236932AbjEJLgA (ORCPT ); Wed, 10 May 2023 07:36:00 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15F7C2D77 for ; Wed, 10 May 2023 04:35:59 -0700 (PDT) Received: from zn.tnic (p5de8e8ea.dip0.t-ipconnect.de [93.232.232.234]) (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 5C6511EC067E; Wed, 10 May 2023 13:35:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1683718557; 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=PkOGxR0M+FAPkq52+rH7zXIhdbVNcWipgwSVZpJf70E=; b=TPM3gYl37YJLIK/XtmqUOJzS/ZpXdHIBRxfQ1+mDeUyBpZ6jBdiJaAj7aAN0YhQFS8n0IS de/IUb0zIXCU74S+IvKw+cgKTXRWHlqbtzjVHPRCI+mFjciO/fUQuQ5PqE91tJvG68TtQl qCbrBq1I7LqzUsmnj5jWlUunepuk04E= Date: Wed, 10 May 2023 13:35:53 +0200 From: Borislav Petkov To: Yazen Ghannam Cc: x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/amd_nb: Check for invalid SMN reads Message-ID: <20230510113553.GAZFuBmZbhAFkbqm1a@fat_crate.local> References: <20230403164244.471141-1-yazen.ghannam@amd.com> <20230403193245.GCZCsp3RjNZFSE5f9s@fat_crate.local> <20230403203623.GDZCs4x5yVReaPVOaS@fat_crate.local> <20230405180648.GEZC24uJ+GSMZxczaW@fat_crate.local> <05c682d7-bddc-d990-37fb-cd1779f7e604@amd.com> <83d4ad40-4812-0583-ba4a-da3e79732e51@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <83d4ad40-4812-0583-ba4a-da3e79732e51@amd.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 05, 2023 at 03:10:09PM -0400, Yazen Ghannam wrote: > What do you think? Yes, please put that as a comment over __amd_smn_rw() as to why callers should check the retval *and* make both the read and the write __must_check and get rid of if (err) pr_warn("Error %s SMN address 0x%x.\n", (write ? "writing to" : "reading from"), address); which won't be seen in all cases. The __must_check will force the callers to do the proper checking which is the only sane thing to do with such a variety of bit behaviors. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette