Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3153196pxj; Mon, 7 Jun 2021 03:49:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYfeTdQeFeE/C2sWsvhxIGC5iJhtz4TBa8D0tyKDHGK1PDgsJzyDB5djTTT7ne0rVeUurT X-Received: by 2002:a17:906:4c8c:: with SMTP id q12mr17408315eju.254.1623062980595; Mon, 07 Jun 2021 03:49:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623062980; cv=none; d=google.com; s=arc-20160816; b=Z9tqnJYaV+ay3kSzcSbzqhI2T3aFAaKCWtRDrC/rJdu4O8+ZKPq5izYFhAZuZedvhn Scf38jcbqoYPn7IT05ciGWnXenRKWEYs76rWjnst+ZSGqbXH5eY6f2LRJFNUd/HOybzJ hk84Bls/b9Zi91c5HUC253jDvrGBP4YhXnsU8p52Vob8GtdGUVGB4x7EpOLrnmUkbxzy uYutxCkQa39zR6BPTi7fSGFxLfu8zBFFwUQxPnjXHV9hmSWR0yj+AERzEpg2osFG/XbW G7mkYzmtHq0pV8sGP6+R+JORmwK/4guH4N2qZM124aI7O1xqmx52tRsBn/74pYR/LlS1 1Q9w== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature:dkim-signature :dkim-signature; bh=Iwf+7I0qD+iYIYXypUMOZrY7NC8vYclySCnJ8RyP60E=; b=dQ+UlMLFJpY5dshOlKBM6H+4YKoLuT0QXXBU+kAlu6/egRntv2cywxAF85m8Yg99be x4/byMWBrD9NAXJTt79Itn4VGqkxi4ghO4xainOJ8/sVZzHQqsZfZ9MCH6EePnw++/xp tLhVcCw9seR2OIy+ZNXsrVo2kXAzjLqkUnJtcRTgQfJxVRMAl1PZlcCvf5TCmFxrwoiT Q2UXeyBWQhzlRrNyRTcADAzorJ2H7p6wVkX803yshpU0hUDhIzJyeP99hGlkQQ7s2sHx dj4FcZ6ljpJ96qogrK2+JpCW9ryw0AIQMYR4yteZWJYx/E6XnlCzUkrLldL8Bgvg9nJF shBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="l0clv/Ey"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=s8PK2PDR; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="l0clv/Ey"; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z13si11703418edq.281.2021.06.07.03.49.18; Mon, 07 Jun 2021 03:49:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@suse.de header.s=susede2_rsa header.b="l0clv/Ey"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=s8PK2PDR; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="l0clv/Ey"; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230219AbhFGKt7 (ORCPT + 99 others); Mon, 7 Jun 2021 06:49:59 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:50306 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230178AbhFGKt7 (ORCPT ); Mon, 7 Jun 2021 06:49:59 -0400 Received: from imap.suse.de (imap-alt.suse-dmz.suse.de [192.168.254.47]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 70F4C1FDA5; Mon, 7 Jun 2021 10:48:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1623062887; 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=Iwf+7I0qD+iYIYXypUMOZrY7NC8vYclySCnJ8RyP60E=; b=l0clv/Ey9u3JZcTSd4VMItu30ryfflQQMXORRwcAoT9s8jGZjRD6lL1BUUHmG4jB5dyJjQ KB4LsUEK/Vi4I4G0/Qs0sH5wOHkmgJ6P5v+FZ95njukRQRzI+stjMeBFy8h/dgMFejrpv4 OzE91MBBRtjPqN8fzlApaDwf4tTLtXQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1623062887; 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=Iwf+7I0qD+iYIYXypUMOZrY7NC8vYclySCnJ8RyP60E=; b=s8PK2PDR0jd+mwiLOwUioxBTHpWcDNRA6zDXnrKq1sS6mGNI4NJOwK+Zrsip2zLiHMfQf3 tvIvXPDLNisnNSCQ== Received: from imap3-int (imap-alt.suse-dmz.suse.de [192.168.254.47]) by imap.suse.de (Postfix) with ESMTP id 2FFC6118DD; Mon, 7 Jun 2021 10:48:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1623062887; 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=Iwf+7I0qD+iYIYXypUMOZrY7NC8vYclySCnJ8RyP60E=; b=l0clv/Ey9u3JZcTSd4VMItu30ryfflQQMXORRwcAoT9s8jGZjRD6lL1BUUHmG4jB5dyJjQ KB4LsUEK/Vi4I4G0/Qs0sH5wOHkmgJ6P5v+FZ95njukRQRzI+stjMeBFy8h/dgMFejrpv4 OzE91MBBRtjPqN8fzlApaDwf4tTLtXQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1623062887; 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=Iwf+7I0qD+iYIYXypUMOZrY7NC8vYclySCnJ8RyP60E=; b=s8PK2PDR0jd+mwiLOwUioxBTHpWcDNRA6zDXnrKq1sS6mGNI4NJOwK+Zrsip2zLiHMfQf3 tvIvXPDLNisnNSCQ== Received: from director2.suse.de ([192.168.254.72]) by imap3-int with ESMTPSA id BcxtCGf5vWCIQQAALh3uQQ (envelope-from ); Mon, 07 Jun 2021 10:48:07 +0000 Received: from localhost (brahms [local]) by brahms (OpenSMTPD) with ESMTPA id 6266486c; Mon, 7 Jun 2021 10:48:06 +0000 (UTC) Date: Mon, 7 Jun 2021 11:48:06 +0100 From: Luis Henriques To: Peter Oberparleiter Cc: linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] gcov: add basic gcov_info validation to gcov initialization Message-ID: References: <20210602102455.11724-1-lhenriques@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 07, 2021 at 11:59:45AM +0200, Peter Oberparleiter wrote: > On 02.06.2021 12:24, Luis Henriques wrote: > > Add a basic gcov_info struct validation helper to gcc to ensure we have > > sane from the compiler. > > > > Signed-off-by: Luis Henriques > > --- > > Hi! > > > > I know this won't really validate the gcov_info struct, but it will at > > least prevent kernel crashes in simple scenarios (such as the one I'm > > seeing with gcc 9.3.1). > > Thanks for your suggestion of adding validity checking for the gcov_info > struct. The goal you aim at is definitely something that we want to have > to reduce the impact of fallout from changes to GCC's gcov_info struct. > > In my opinion though the approach you described - looking at the > contents of specific fields in gcov_info - isn't the correct way to go > forward. Since you cannot know how gcov_info changed, accessing any data > in it is very dangerous. Even if there's no out-of-bounds access (if the > struct's size was reduced) the field you are checking could have moved > elsewhere so the meaningfulness of the check is very limited. > > In a previous discussion on the same topic I proposed a different > approach for a build-time check that would fully check the compatibility > of kernel code and GCC-emitted gcov-related data structures. See: > > https://lore.kernel.org/patchwork/patch/1393585/#1592411 > Thanks, I see the problem is way more complex and I understand that my patch is just wrong. Thanks for pointing me at this thread. > Unfortunately I have not yet found the time to implement this approach > but it's still on my to-do-list. > > Regarding the cause of the error you're seeing I'll have a look at the > corresponding GCC source to see if there's anything that could be > causing the issue. Great, thanks. Let me know if you need me to provide more info or testing. I'll be glad to help. Cheers, -- Lu?s