Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5647960imu; Wed, 30 Jan 2019 00:56:45 -0800 (PST) X-Google-Smtp-Source: ALg8bN7+3otGM5dDBrb2MLp08+SWvHv+UQV6hx4Sizkn1Miztg/4T5VGXW+TO1eG8UkGcW1x4dc/ X-Received: by 2002:a17:902:33c1:: with SMTP id b59mr29168364plc.220.1548838605869; Wed, 30 Jan 2019 00:56:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548838605; cv=none; d=google.com; s=arc-20160816; b=SZCggmqCEU6KVFzsj5t4n/jYXW4Kxs6VJG6Kp5fUa3jYOZrAaHMV0M7/JdXrHl/5/S JNIS3anY33Osoe0pBtLX/ck0VaRsTvyMXD8cTzB24VjbhCkdj1xstvOhOtIRD1MeuPts 5PkZnQ6rI2ZWDF1KMvhYPNgb5F4H/QIbJTf5hR6A7c5DHX6jTM4EVOwyfglDsnfgkkAP BEpSPxQKpqC7chOhvYIOICZnFjzsXLmJSq6qPxs7ZNEe9vfFKTWkymXLw0qF7qowahci Tze/9uufKSNuD9/lBSlrtdKZlCYnjWYhdFBPprArQ17YEMCEI1aWR6Wh04FKVS660vKa QcKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=+pnAzYer3LfzqMA/n7yqQL+jOJz6qqRl/fJMKWdDAm0=; b=thioTlP9rtAQ+cxP4tZ55msgrV0qEXg7OFnOO0f3VGjNqGS6eGHwuhOgAeoKGQmdpl rhYfJP24YRt+BrRDWevMOOz3AQGdsRVEuWC3mEJS4o9aZTeZlnLM1Kql4aBB4yy9eDE/ x9Zx+9Mw6OSWAb9bUCjkbj47bsBAUuBpMLBxVkRWeUQqmQuUtspkis5FDcnKPfRwbnl/ Mm///PofJILMF84hFM7JqLc5g2+Qo7vt76cfKS8+zIflV52iGdyyR/rVaOzlN2thr29P xDfyAI2at5WF9H3F6Qiv8sgmOUARna3hqw0gy5Q1oXsbHMMQ1fskladdy20tKjNdRi4S Rgtg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v68si904489pgb.70.2019.01.30.00.56.30; Wed, 30 Jan 2019 00:56:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728290AbfA3I4Z (ORCPT + 99 others); Wed, 30 Jan 2019 03:56:25 -0500 Received: from mx2.suse.de ([195.135.220.15]:40022 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725850AbfA3I4Z (ORCPT ); Wed, 30 Jan 2019 03:56:25 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 75B43AC4B; Wed, 30 Jan 2019 08:56:23 +0000 (UTC) Date: Wed, 30 Jan 2019 09:56:22 +0100 From: Petr Mladek To: Joe Lawrence Cc: Jiri Kosina , Josh Poimboeuf , Miroslav Benes , Jason Baron , Evgenii Shatokhin , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] livepatch: Handle failing allocation of shadow variables in the selftest Message-ID: <20190130085622.y4de47nekrhy4pmq@pathway.suse.cz> References: <20190116161720.796-1-pmladek@suse.com> <20190116161720.796-3-pmladek@suse.com> <20190121224012.GB8766@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190121224012.GB8766@redhat.com> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 2019-01-21 17:40:12, Joe Lawrence wrote: > On Wed, Jan 16, 2019 at 05:17:18PM +0100, Petr Mladek wrote: > > Do not dereference pointers to the shadow variables when either > > klp_shadow_alloc() or klp_shadow_get() fail. > > > > There is no need to check the other locations explicitly. The test > > would fail if any allocation fails. And the existing messages, printed > > during the test, provide enough information to debug eventual problems. > > > > I didn't run the test under those failing conditions, but at looking at > the code, I think it would simply skip the "expected found" > and the test script would complain about not seeing that msg. Accessing an invalid pointer would crash the kernel. > Would it be easier to just bite the bullet and verify sv[0-4] at their > allocation sites? Then later uses (ie, the sv3 dereference that > Miroslav spotted at the bottom) or new code wouldn't fall through the > cracks. As I wrote in the replay to Miroslav. The best practice is to handle errors everywhere. I am going to do so in v2. People might use it as a sample... Best Regards, Petr