Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4902087rdb; Tue, 12 Dec 2023 12:31:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFZxjwNKPqL4PINqjRGXe1iDDr4D9HLXsScLdz/ZxeOnE5N5kjvRoqdNoif4z4PWU5adu6F X-Received: by 2002:a05:6a20:3d85:b0:191:bc5f:e803 with SMTP id s5-20020a056a203d8500b00191bc5fe803mr66931pzi.72.1702413076368; Tue, 12 Dec 2023 12:31:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702413076; cv=none; d=google.com; s=arc-20160816; b=zL5yHvOeIOPD9idMsNuIZjziid3I/hgnVToHjlJD7MRR2biT2dfmw3Q2EVMKGsIldO m2QzILILXyvVTkwB0d38agkANOtBC7fiiTCqYm2IJ7J1AXq0xYnWoNGQ3uTVUBZbXh+s K8qTtJnv/CaKGyyS7EOFntgYptZCZSs3DAwjwSJJNMEXEKcTAya0S4OV/QP5u0SXsF0z MvgurGpj7gIu3tk6vSwpsLql53bmAmkrD2BTIu35LUxbMPZxFhDwByYKo5poE04W0jP9 u7Sm6Ut8VyNAtlpzVvieB9KrhueufZKDT9rHhPgOrnzkhRnjDo3uIK7OpmbndvxmezFB HV1A== 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=iLIl0LoBmYNL+NWFxh8UetiQoZPQETOwmLsQrrnWg+0=; fh=xpzMXz8SRrLG+6yY1/aJR4zltJdFY9WdeG3HfqKg7RQ=; b=Ls0K3EEWU+52SvGuIXP8mU92n0u4dvqzODNDoo0fywxLgNGrot2kszIp7dIYHnd8uZ PDbSP3dfPKR2r9nz/h8j+snqxfDi4Tq7opgCf5eur+skMbOpiT9Kx+REAWq++MVWscAG sKGriGZaNKRhMzJJun8dgTcuzQaoA8oLkCkeeKjJ2TAut1nv6x6SaJAOkX5GNH8sUWSA yFi2FDnojBV3bHMddUyG5SWQHVlK+0MrYS14n+WKYH1WS/kMD0JdjMQRPoigMFx89zrC e7YdCEEy9a6I21wd30JVsDs8zhUOZ2sPpp8XAp7TMwFuLv3hhiRaJICb1THLonWAZEqz vqYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ggi7OEoG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id bo7-20020a056a02038700b005c637e836cfsi8894441pgb.885.2023.12.12.12.31.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 12:31:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ggi7OEoG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 8AB4C807D41A; Tue, 12 Dec 2023 12:30:43 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377349AbjLLUa1 (ORCPT + 99 others); Tue, 12 Dec 2023 15:30:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230051AbjLLUa0 (ORCPT ); Tue, 12 Dec 2023 15:30:26 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58DD4CA for ; Tue, 12 Dec 2023 12:30:33 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D46CFC433C7; Tue, 12 Dec 2023 20:30:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702413033; bh=lJ7TjUTNGLGKt05CTrfDgwIXhWJ2nCGi3+BsvF6xJp8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ggi7OEoGg12Dr3HRp9DDY87kc5CkZEFVrsUnbPggPaOC/K0bLHhYa0sVRR3qGMMkJ Xcs5Gw25L9wi3JNPcFP0KmPytLmDnLGi67hjAnPE7ATJe+TOLBCGVc2IlBWYHkwsfn QvUD2LOrX+sN7uTbhGTCWuA6UBySotNAfT8Iz+huk1QEAMRd68r5hw547iBCEdWoNT KGKWrMJN8K2+OqbrBKqBYG/B4R2wDK2LsTQOBGDbcbiyOa3ocgAR50odWWW6xyjN7w di+yrBO4VISZRzes1I4eP0lyGQzsGxbrRZSuFUjbD9JELtIR1yiAbhLAcCOb7mNBN1 IqbEU13R+skDA== Date: Tue, 12 Dec 2023 12:30:31 -0800 From: Josh Poimboeuf To: Dimitri John Ledkov Cc: Peter Zijlstra , linux-kernel@vger.kernel.org Subject: Re: [PATCH] objtool: Make objtool check actually fatal upon fatal errors Message-ID: <20231212203031.uudk57xhegi5yziz@treble> References: <20231212185339.1562967-1-dimitri.ledkov@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20231212185339.1562967-1-dimitri.ledkov@canonical.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 12 Dec 2023 12:30:43 -0800 (PST) On Tue, Dec 12, 2023 at 06:53:38PM +0000, Dimitri John Ledkov wrote: > Currently function calls within check() are sensitive to fatal errors > (negative return codes) and abort execution prematurely. However, in > all such cases the check() function still returns 0, and thus > resulting in a successful kernel build. > > The only correct code paths were the ones that escpae the control flow > with `return ret`. > > Make the check() function return `ret` status code, and make all > negative return codes goto that instruction. This makes fatal errors > (not warnings) from various function calls actually fail the > build. E.g. if create_retpoline_sites_sections() fails to create elf > section pair retpoline_sites the tool now exits with an error code. > > Signed-off-by: Dimitri John Ledkov We had problems trying this before, but we can try again. Maybe we'll have better luck now :-) > if (opts.orc && nr_insns) { > ret = orc_create(file); > if (ret < 0) > goto out; > warnings += ret; > } > > free_insns(file); > > if (opts.verbose) > disas_warned_funcs(file); > > if (opts.stats) { > printf("nr_insns_visited: %ld\n", nr_insns_visited); > printf("nr_cfi: %ld\n", nr_cfi); > printf("nr_cfi_reused: %ld\n", nr_cfi_reused); > printf("nr_cfi_cache: %ld\n", nr_cfi_cache); > } > > out: > /* > * For now, don't fail the kernel build on fatal warnings. These > * errors are still fairly common due to the growing matrix of > * supported toolchains and their recent pace of change. > */ > - return 0; > + return ret; Here it should check for ret < 0, since orc_create() or some other function might have returned non-fatal warnings (ret > 0). Also the comment is no longer relevant. -- Josh