From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id F01CC3858D33 for ; Mon, 16 Jan 2023 13:04:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F01CC3858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 309B667838; Mon, 16 Jan 2023 13:04:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1673874243; 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=BNyJOBAsH5CWLbMWh+nsc5i9QgIqAL0jhiStKkJSPHA=; b=IY2Xp1vOByP9oIwDAfdQta9NOFWOK8kOTP5KFIPyEEMlFxm1YzfFBeZZMFXRTPtXH+LrVb oZls+MAxZlkBe62FiOmCLuQvuPvn36mEkpWRzrK0onRm2WBuaaWlav3hqFj4wwEczymrBf 7SO7bj/LgjG/stWsiqosManM1XPXfC4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1673874243; 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=BNyJOBAsH5CWLbMWh+nsc5i9QgIqAL0jhiStKkJSPHA=; b=uhC3UvAppBNKDClAbl1yTnmW9a8YSKo3npM7prp20KPfwGlw5kPXZaWPjGCLJHyt2o7fHk IieLtrR/wn3rKyBw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 124CF138FA; Mon, 16 Jan 2023 13:04:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id R7yHA0NLxWOrMAAAMHmgww (envelope-from ); Mon, 16 Jan 2023 13:04:03 +0000 Message-ID: Date: Mon, 16 Jan 2023 14:04:02 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH] libgcc: Fix uninitialized RA signing on AArch64 [PR107678] To: Jakub Jelinek , Wilco Dijkstra Cc: Szabolcs Nagy , Richard Sandiford , GCC Patches References: Content-Language: en-US From: =?UTF-8?Q?Martin_Li=c5=a1ka?= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE,SPF_SOFTFAIL,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 1/12/23 19:57, Jakub Jelinek via Gcc-patches wrote: > On Tue, Jan 10, 2023 at 04:33:59PM +0000, Wilco Dijkstra via Gcc-patches wrote: >> Hi Szabolcs, >> >>> i would keep the assert: how[reg] must be either UNSAVED or UNDEFINED >>> here, other how[reg] means the toggle cfi instruction is mixed with >>> incompatible instructions for the pseudo reg. >>> >>> and i would add a comment about this e.g. saying that UNSAVED/UNDEFINED >>> how[reg] is used for tracking the return address signing status and >>> other how[reg] is not allowed here. >> >> I've added the assert back and updated the comment. > > BTW, the patch doesn't apply to trunk cleanly (since the January 2nd > r13-4955-gcb775ecd6e437 commit). @Wilco, can you please send the rebased patch for patch review? We would need in out openSUSE package soon. Thank you, Martin > >> v3: Improve comments, add assert. >> >> A recent change only initializes the regs.how[] during Dwarf unwinding >> which resulted in an uninitialized offset used in return address signing >> and random failures during unwinding. The fix is to encode the return >> address signing state in REG_UNSAVED and REG_UNDEFINED. >> >> Passes bootstrap & regress, OK for commit? >> >> libgcc/ >> PR target/107678 >> * unwind-dw2.c (execute_cfa_program): Use REG_UNSAVED/UNDEFINED >> to encode return address signing state. >> * config/aarch64/aarch64-unwind.h (aarch64_demangle_return_addr) >> Check current return address signing state. >> (aarch64_frob_update_contex): Remove. > > Jakub >