Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp471986ybb; Fri, 3 Apr 2020 06:20:33 -0700 (PDT) X-Google-Smtp-Source: APiQypIVnvH37P3cJpx+r50DW049juDpBByBR0ND3qF6/QlOiKrDK4LaYv2/f9lQ3ahvGMYK9x58 X-Received: by 2002:aca:682:: with SMTP id 124mr2967036oig.69.1585920033335; Fri, 03 Apr 2020 06:20:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585920033; cv=none; d=google.com; s=arc-20160816; b=b7XkBQHPzdLaXggO+tHe1Jx57Bx0MplUaTC1bSJb6UI5V2P2zieNCZC2TQgheVr8sG G57jghO8h4NY5/Tm8SvLa46wWOKikGt2wkf6dWaryc1xCsyK4ZTVx/8BIi2sHYMSF31G OgucC18f/uSYAMtn87VIl2M/TA0hLpD8nuyRmb/ZrWxx7zxcDJRBlNDbpnqzWzbb2tt9 DxG+DL5AdmtOAcinnsN3Og8Tx27jfNwypUM8lQuulLtRFkA8gmIXZ0y/17/1uoJaWuAA +PAlVwWOqMxMnrvBQ5L+DJHKe3wHW9SEqSv5lk2TDUg+9LlDOzhUZddaEsRAAcndIEgf Wzkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ArqORMrJA2OqQPY2t/1A7/OKoVfVWVKes8TY2CWI73M=; b=bf2NoeW3M4UVipwgu8CNJ0IRPswvXhWNgrkMBJtkgW1jghIgoMtmAk4F0zUxYGBuCY LrdzqqUD6yv7MCd2nHCsdhMuBYUb3EgWjwztLbPJ5ofi6MgTJalTbYBMXv5UBoQhwc/7 uN/hkNNHpqCcXilYM/rIoQ4zSlhVXudQSFqTdAOnodTOCM7LN+NBO5h4n/bUbFaktUcc jpJQ3BiDT8jsnliMyNBkGVKidW8pzFHLUvjH1s+83yxwBR3qHiYnArllpRUmDTAQmSZG DqcaFnGZheS2+yCkXEIfPRnxQ4w7OOsM8lPk+mjnE3ZRTMDWMV4sk+65enq4J9Qm1Uqo myog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="NZGNNLO/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 34si3382403oth.307.2020.04.03.06.20.20; Fri, 03 Apr 2020 06:20:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="NZGNNLO/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403989AbgDCNRi (ORCPT + 99 others); Fri, 3 Apr 2020 09:17:38 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:50194 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728044AbgDCNRi (ORCPT ); Fri, 3 Apr 2020 09:17:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585919857; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ArqORMrJA2OqQPY2t/1A7/OKoVfVWVKes8TY2CWI73M=; b=NZGNNLO/TxWo0oQ7DhvsBSV0OCGijfzIJ0Vlv2ULJy98JxfxnzU/bhn0LIES9qBdALS7+C 1gX5gNPBCw9VABLHOLew190jmafrlq9bTR1cURBUNjkThE5br/Iq6wgCPWHtu05DAswRxK U9oCGUJb8Il134hVCs/3vTJG2jAta5k= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-419-dVnzUjVvOSWicbIa5YfI0w-1; Fri, 03 Apr 2020 09:17:36 -0400 X-MC-Unique: dVnzUjVvOSWicbIa5YfI0w-1 Received: by mail-wm1-f71.google.com with SMTP id y1so2770082wmj.3 for ; Fri, 03 Apr 2020 06:17:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ArqORMrJA2OqQPY2t/1A7/OKoVfVWVKes8TY2CWI73M=; b=RQJms5ZprhR8uQfTx1OLAJLqQAJj3suDFwoVuynUFbev1Yl2LZTwRl5zjBeMBuBCtC JmYhAGSG+AII8jNqJpVnz2EMD4rQuGJXRt99Y9l2QDKusTEIvIFJpFaDLNFT/7+m7eWC fyNDRcEYG1g/Zc6En+JmiZJcbDqn1aT+LlEm87rdEOCIeIwEuFUtkdX1LLClvZjDGWuP flwyMMz4fDM6CLA2pfTD2NCsz5w9GDQXf8dM1JQUD5JQbpvOT2CQ9Ikw0yUYgws0caXx qC2DgVs5EsyaLBrklihHYyLTTL9oGywDe3B3SA+e+jZCPDG2YX/T+ctfWwWnAb7TE6Mv QOBA== X-Gm-Message-State: AGi0PuYRGJuQ4qG9ObX7HYzMYWTK0Gam9QDO2bRa0awQK9GWPVv+E47B RhzKDfgulf9jnwF6nfimGB5sfhmFtv2W9dxWWZukAa6qiulxp9PlaE7nw4yjNwNXEcBbuFkx3sJ ePZxsUbmUBM4PaZLM7ShXgTZ6 X-Received: by 2002:a1c:bad5:: with SMTP id k204mr8540084wmf.162.1585919854426; Fri, 03 Apr 2020 06:17:34 -0700 (PDT) X-Received: by 2002:a1c:bad5:: with SMTP id k204mr8540065wmf.162.1585919854180; Fri, 03 Apr 2020 06:17:34 -0700 (PDT) Received: from redfedo.redhat.com ([2a01:cb14:58d:8400:ecf6:58e2:9c06:a308]) by smtp.gmail.com with ESMTPSA id e23sm774957wra.43.2020.04.03.06.17.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 06:17:33 -0700 (PDT) From: Julien Thierry To: linux-kernel@vger.kernel.org Cc: jpoimboe@redhat.com, peterz@infradead.org, mbenes@suse.cz, Julien Thierry Subject: [PATCH] objtool: Fix off-by-one in symbol_by_offset() Date: Fri, 3 Apr 2020 14:17:30 +0100 Message-Id: <20200403131730.32618-1-jthierry@redhat.com> X-Mailer: git-send-email 2.21.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sometimes, WARN_FUNC() and other users of symbol_by_offset() will associate the first instruction of a symbol with the symbol preceding it. This is because symbol->offset + symbol->len is already outside of the symbol's range. Signed-off-by: Julien Thierry --- tools/objtool/elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index 09ddc8f1def3..c4857fa3f1d1 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -105,7 +105,7 @@ static int symbol_by_offset(const void *key, const struct rb_node *node) if (*o < s->offset) return -1; - if (*o > s->offset + s->len) + if (*o >= s->offset + s->len) return 1; return 0; -- 2.21.1