Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp120895ybg; Mon, 8 Jun 2020 18:11:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbnaDdXCZicrMhqKIR8S+ln9ht+/FuRy2+hlhY6C1QyY0jmRXmD7RBVq8du8DQKWHzua0d X-Received: by 2002:a05:6402:1606:: with SMTP id f6mr24071073edv.286.1591665098063; Mon, 08 Jun 2020 18:11:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591665098; cv=none; d=google.com; s=arc-20160816; b=ruFeC4s6WV0y9XBKZd4uMourS/KHx8dVVmh1rIudXkfPbPqAIL9I4awJPPCP8YK+Ip uf0UUZ/gaCY3sp/UnD6xjvRCyRdI+T6zYLT0Zf2pS6FIK1R3TGFZ6v9Jjz61AD8GIyfv 2nToQy4cX1xKjKrfJB3vjm1RnR6qbjQLUrW/JCuFa1WeIbvKEBg9HCZCu/8y4qAkUknW eqj9YoXA/jjdxq5hFbxp8lXqOozvJcwPv/ViT1ykYwLEdgdOjabSHbDAiv/BnRU7YvA4 gNHsz03olStpwPLhNwQjLR3vii7O574RUJLlhGc/vPF+SDRXk9otVQUFBLBFCk3560cb 3dyw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1Qrqv8q9RcyoAIbT2COIBmZlRc+Jlz8BrXbd0gfKglo=; b=vNrL5uggL9UtzhnT4+qWLnLwjwm0j9/PtaVDUn+yQhGIRp+JUjF9tO6bBkCNL3c0nX yXXIzKcGQx6dmaIw5EH5Aktj557+KlhphP7N/Q+mB7EPIRseiWHWnD5nYG7nNeUmxk/Y IWTnnsYql4Cd5foQEui4Hi6KD5+KmWKTPB13D+7RSSDIKewbZArg8l0pk+XfibBX+6yQ lJnBuKhR34tE18dIECiaW0H0IEi0eLLzqjHD3X0XQrhe8UsEAsF6mc8tD2Nt2WB+7aYJ jjOLbAtsEWtNQybbQk3qfzaAQVKDOjmIofG6jhWudwuwchdAD0gS92GBXPm6RyLj0itX yBKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="VlX2/C5t"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ds3si12049365ejc.545.2020.06.08.18.11.14; Mon, 08 Jun 2020 18:11:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="VlX2/C5t"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730035AbgFIBJa (ORCPT + 99 others); Mon, 8 Jun 2020 21:09:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:49546 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726987AbgFHXG1 (ORCPT ); Mon, 8 Jun 2020 19:06:27 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C30892078B; Mon, 8 Jun 2020 23:06:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657586; bh=QvvVCvpXuafBpUcquVWzRQSZlm/2kfM6wsz5kMmPuOY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VlX2/C5tn7WpAQ3rnSVSb0eQFLlTpTjQPiwpTLt19c7sFwXwPljqmg4ZA+hhz6RCo vuxPdWJOYNrElV9pLeixR4IezgltNqwkB6KlFdQ7HAZQRe7/gfteQH0oNcOcLDYoeV hk6hHBDk75V/3ZVarK2z/VC7nwCzDvsJAIx3anhw= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Julien Thierry , Peter Zijlstra , Miroslav Benes , Josh Poimboeuf , Ingo Molnar , Sasha Levin Subject: [PATCH AUTOSEL 5.7 015/274] objtool: Ignore empty alternatives Date: Mon, 8 Jun 2020 19:01:48 -0400 Message-Id: <20200608230607.3361041-15-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Julien Thierry [ Upstream commit 7170cf47d16f1ba29eca07fd818870b7af0a93a5 ] The .alternatives section can contain entries with no original instructions. Objtool will currently crash when handling such an entry. Just skip that entry, but still give a warning to discourage useless entries. Signed-off-by: Julien Thierry Acked-by: Peter Zijlstra (Intel) Reviewed-by: Miroslav Benes Signed-off-by: Josh Poimboeuf Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin --- tools/objtool/check.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 3c6da70e6084..5a867a469ba5 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -916,6 +916,12 @@ static int add_special_section_alts(struct objtool_file *file) } if (special_alt->group) { + if (!special_alt->orig_len) { + WARN_FUNC("empty alternative entry", + orig_insn->sec, orig_insn->offset); + continue; + } + ret = handle_group_alt(file, special_alt, orig_insn, &new_insn); if (ret) -- 2.25.1