From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E15D2C433F5 for ; Wed, 20 Apr 2022 17:25:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381039AbiDTR2I (ORCPT ); Wed, 20 Apr 2022 13:28:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243846AbiDTR2E (ORCPT ); Wed, 20 Apr 2022 13:28:04 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D4CAE0EB for ; Wed, 20 Apr 2022 10:25:18 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 3430021115; Wed, 20 Apr 2022 17:25:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1650475517; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=beOjjz8wjPVhCvHg8uOnVQKum2lXeuiW4masHsPOdQQ=; b=bGx1CePCrWIifOZZocpsdLrRHb3bgZQRw2KTWM0IxQsNVFcswYWm9Nl50qP6Y05eVFzfD5 flUscuZHsRgFKEGkpjCu3qdhQPkzQZkGEyiOmu7JpkmwheL5ba8VYSpuEEAqFAmFxLaxhx mNAo0jTWrBdIUx+5Wy+4Pe+dQM1Gu3Y= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1650475517; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=beOjjz8wjPVhCvHg8uOnVQKum2lXeuiW4masHsPOdQQ=; b=aFwBWj2uAWyjKcRIkbMSkBNkU0gAhBlMgpYJSL2wiqvVxkkTtlIc9+q4CnbbNyaAJPF2GH kT0LqluDjAW5jWBA== Received: from pobox.suse.cz (pobox.suse.cz [10.100.2.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 19D502C142; Wed, 20 Apr 2022 17:25:17 +0000 (UTC) Date: Wed, 20 Apr 2022 19:25:16 +0200 (CEST) From: Miroslav Benes To: Josh Poimboeuf cc: x86@kernel.org, Peter Zijlstra , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 15/25] objtool: Rework ibt and extricate from stack validation In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A nit and it was there even before this patch... > -static struct instruction * > -validate_ibt_reloc(struct objtool_file *file, struct reloc *reloc) > -{ > - struct instruction *dest; > - struct section *sec; > - unsigned long off; > - > - sec = reloc->sym->sec; > - off = reloc->sym->offset; > - > - if ((reloc->sec->base->sh.sh_flags & SHF_EXECINSTR) && > - (reloc->type == R_X86_64_PC32 || reloc->type == R_X86_64_PLT32)) > - off += arch_dest_reloc_offset(reloc->addend); here... > +static int validate_ibt_insn(struct objtool_file *file, struct instruction *insn) > +{ ... > + off = reloc->sym->offset; > + if (reloc->type == R_X86_64_PC32 || reloc->type == R_X86_64_PLT32) > + off += arch_dest_reloc_offset(reloc->addend); > + else > + off += reloc->addend; it looks kind of strange to have arch_dest_reloc_offset() and still reference arch-specific relocation types here. On the other hand it seems difficult to achieve complete arch-agnostic code, so take it just as a note and maybe someone porting objtool to a different architecture will split the code, make it all arch-independent and all will be nice and shiny. Miroslav