Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp2640038imw; Sun, 17 Jul 2022 13:29:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t+8TYpTJhd8abWAdWwkgrsqWGh07n98ANDpyL8DZ8tyDj2dvB4+XgTdfuIEaWXUn0kTgOj X-Received: by 2002:a05:6402:1006:b0:43a:d397:68c3 with SMTP id c6-20020a056402100600b0043ad39768c3mr33218933edu.170.1658089797547; Sun, 17 Jul 2022 13:29:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658089797; cv=none; d=google.com; s=arc-20160816; b=uRRhZKLO37GKKeHKHaWDja94C/AM6aNxlBWMfKnPWUOfSD9In+EFJoVd1ljgZLNbjp ilpqk73Mt9FeDloDs+apT6sRGAIgHzvlnVpq+0zKkqY6QIPImtnMCR2gzH04n//IGQCA kwhRJcHEpoGuxrWtNA74+e6wbCawiy0tMvlZkyaqkogJe48NUPsiKUK6e82jvBlRnvy8 1PpdS9y4mOyMFfmKvimCqaPoS3UGNrRvROr2CB++WuixsJXLykMh9Pr3nkpp5Awzes89 4StUegwJIyX4U3tffYZHAMVaOZo8t/T3BszmN0GehkNGNyt2cDkOdTttSq3G4ZI2jfBS VvsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=lmz69AJqc7YQJAzV5kxeyg0rdEsaL2H0oPSjBwOu7II=; b=0jvm+V/KKHwEkyduJB7gZgl7F4iOME8+LotX0Nlrkbbn3p982hIl4Pw3/feZ0l1+Wd qO6Zkvcx80aXU18bOLE8ypsHNZX94hTRn2Y6YEp2jII0x79UVOzGrW7+7l7Z2Ltf7oU+ +Y57IiQGt8JieTdWeKqS9QVsycl654DTR9zDWa6zzugdSjSuyv8je6eF8NtDekA4qV0A lxz6tkUkh51cYQmdsqEEfIBq+vnQ8fTs1M6jLK5hZuJh9ZORmNVossRLyJuh0YYMGnVn EuGWxVMcPEwDGDwwzn1R/dJoIduKkCD+hu9SF5nK2SSTaJTX93xuKBpQX8id+tm0YQ2h QF8w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k17-20020aa7d2d1000000b004381b6af19csi11963093edr.155.2022.07.17.13.29.31; Sun, 17 Jul 2022 13:29:57 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229982AbiGQUBY (ORCPT + 99 others); Sun, 17 Jul 2022 16:01:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbiGQUBX (ORCPT ); Sun, 17 Jul 2022 16:01:23 -0400 Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 997E51208E; Sun, 17 Jul 2022 13:01:22 -0700 (PDT) Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 26HJsmgu016415; Sun, 17 Jul 2022 14:54:48 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 26HJsmPs016414; Sun, 17 Jul 2022 14:54:48 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Sun, 17 Jul 2022 14:54:48 -0500 From: Segher Boessenkool To: Linus Torvalds Cc: Sudip Mukherjee , Kees Cook , linux-kernel , Paul Mackerras , linux-hardening@vger.kernel.org, linuxppc-dev Subject: Re: mainline build failure of powerpc allmodconfig for prom_init_check Message-ID: <20220717195448.GB25951@gate.crashing.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS 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 Sun, Jul 17, 2022 at 07:44:22AM -0700, Linus Torvalds wrote: > On Sun, Jul 17, 2022 at 2:13 AM Sudip Mukherjee > wrote: > > I was trying to check it. With gcc-11 the assembly code generated is > > not using memset, but using __memset. > > But with gcc-12, I can see the assembly code is using memset. One > > example from the assembly: > > You could try making the 'args' array in 'struct prom_args' be marked > 'volatile'. > > Ie something like this: > > --- a/arch/powerpc/kernel/prom_init.c > +++ b/arch/powerpc/kernel/prom_init.c > @@ -115,6 +115,6 @@ struct prom_args { > __be32 service; > __be32 nargs; > __be32 nret; > - __be32 args[10]; > + volatile __be32 args[10]; > }; > > because I think it's just the compilers turning the small loop over > those fields into a "memset()". Yes. See near the end: Most of the compiler support routines used by GCC are present in libgcc, but there are a few exceptions. GCC requires the freestanding environment provide memcpy, memmove, memset and memcmp. Finally, if __builtin_trap is used, and the target does not implement the trap pattern, then GCC emits a call to abort. Can't we simply have a small simple implementation of these functions in arch/powerpc/boot/? This stuff is not performance-critical, and this is not the first time we hit these problems. Segher