Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp286869pxy; Wed, 5 May 2021 02:06:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyctolKgSd8yOdJ3RTSD9cEC9zGeiAa4A8oIdhjcpAXqFgOExpTY/sbQR/kkmT19GF9GK0p X-Received: by 2002:a17:906:79a:: with SMTP id l26mr26131581ejc.268.1620205579521; Wed, 05 May 2021 02:06:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620205579; cv=none; d=google.com; s=arc-20160816; b=Nd5zQt6p4vJ/3kxn4MvXs6wOC79uYp047ZTTgNahDEML8Eq7p6orAowHS+MsKvzt/l gNI9wtk0qQz7EttQZwkUeAQxy8XJxMH8/hunhu/juhSzPk/jEtUTYwtMyT/pAetShbm4 obexdG6XWEzPUiIChCmyPHgnD9m1TmiSlJP2mKTDdOAHuvs1NoVb0esXtCxxdINv/s7c aRLtdFpKV/HyUh7gkN/OsWfnBWjppGGmsJyhpPyzE3xokepfCHrXVylsylkkyTaLY0uD 52eZj1JzJfsmldiM/oW8NJEcGBvRt1+a7a34l/i0D13ZRLY8wUURRpO2QNVVBVGHhBI2 1Xcg== 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=hZi4ewpCK+lWJiEHygFzyAaJ5g9okvi4iFAZbz7URD4=; b=DCilylJNSsuV+4zhgO7CveqKXVe76ZOF/VMxWkDD323HWt2zbxdFjAddFQQDTGZrHS 03XnxrYegR9ywSS5QX3QUW2bcsODf9RFtQeyTfQR4CZEj4Uzv4SGWraQQp1moC3UsnFt sUbXbbbExmLhCTDHP79ET6XlOWjjkj46ZakSlLFv6FJsifyy1CKOj+zs3xOHBvBIbDma Tef5rzEx8iuTLmrwD/QnUDs7QUpApYA7C/+UFOR69We0UUgvOIZ6oZ9Aj8q/LkC4WLrh mFgzYFaAkT+cnT3FTuDKm9ZChCLKqJtrKKpCOGRBhOZT3uiC9fFqKS36MPM6t+XdtloN T1pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b="S/TjwcGJ"; 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 w11si17410255ede.590.2021.05.05.02.05.42; Wed, 05 May 2021 02:06:19 -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=@infradead.org header.s=desiato.20200630 header.b="S/TjwcGJ"; 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 S232201AbhEEJFJ (ORCPT + 99 others); Wed, 5 May 2021 05:05:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231637AbhEEJFI (ORCPT ); Wed, 5 May 2021 05:05:08 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FD4CC061574; Wed, 5 May 2021 02:04:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=hZi4ewpCK+lWJiEHygFzyAaJ5g9okvi4iFAZbz7URD4=; b=S/TjwcGJW4mvEfpR6nIld3U6i0 CyIjLMHdu64BoRAxRHSbjt2wxX48/d8evhD6/+8avByoarKoSYTR3LLQclubCjpyDqgDmspHR9la0 afjvdQWFEp36KlSS0i6u+v/yf9Zzbfrh3m7KgL16hwi1SV5q0/So85SPgWXf+21kQbTm0C0vCfjyS OrLOPfOILtlKYP+BiNTgXrso+kwUB1dYyWrJItONgGFUOTgS/p8PQ8+EtarNSbhIloRZPhEUYJLyU OBP5mnDLppgnZj2bEgbmv2XU9BzIukTe2rgUMEyb7R7bDi/yNFClnohIvb30ZREzJWBbZMRQlrHbO fVpC+R1g==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1leDRq-000gJa-F5; Wed, 05 May 2021 09:04:03 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 7BEF93001CD; Wed, 5 May 2021 11:04:01 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 62D54200CAA24; Wed, 5 May 2021 11:04:01 +0200 (CEST) Date: Wed, 5 May 2021 11:04:01 +0200 From: Peter Zijlstra To: Florian Weimer Cc: Andi Kleen , linux-kernel@vger.kernel.org, Andi Kleen , linux-toolchains@vger.kernel.org Subject: Re: [PATCH] sched: Work around undefined behavior in sched class checking Message-ID: References: <20210505033945.1282851-1-ak@linux.intel.com> <875yzxh8j8.fsf@oldenburg.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <875yzxh8j8.fsf@oldenburg.str.redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 05, 2021 at 10:47:07AM +0200, Florian Weimer wrote: > * Peter Zijlstra: > > > On Tue, May 04, 2021 at 08:39:45PM -0700, Andi Kleen wrote: > >> From: Andi Kleen > >> > >> The scheduler initialization code checks that the scheduling > >> classes are consecutive in memory by comparing the end > >> addresses with the next address. > >> > >> Technically in ISO C comparing symbol addresseses outside different objects > >> is undefined. With LTO gcc 10 tries to exploits this and creates an > >> unconditional BUG_ON in the scheduler initialization, resulting > >> in a boot hang. > >> > >> Use RELOC_HIDE to make this work. This hides the symbols from gcc, > >> so the optimizer won't make these assumption. I also split > >> the BUG_ONs in multiple. > > > > Urgh, that insanity again :/ Can't we pretty please get a GCC flag to > > disable that? > > Context: > > > > Obviously, GCC doesn't do this in general. Would you please provide a > minimal test case? Andi has this GCC-LTO patch-set that triggers this, but the thing I'd like fixed is the UB mentioned above. Not this particular instance. And, we've had the problem before, see all the RELOC_HIDE crud. Having this pointer arith outside object be UB is just really annoying. And in the spirit of UB bad, can we please get a flag to remove the UB and have it do the obvious, just do the arithmetic and don't do daft things. Pretty please.