From patchwork Mon Feb 26 09:49:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Qi X-Patchwork-Id: 206544 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1980331dyb; Mon, 26 Feb 2024 02:23:58 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU81KcJXbaMUg6AP68tzlju4MiwvG8ghWROAXbaxvmp1y8FfxPhgduzjn4PEOsrUOn9bKMniH+bIUTlpgrW9rm6/CtKCg== X-Google-Smtp-Source: AGHT+IG4Wg8n7zsKhJMCQUkP5tg/gYaLJ5jMrRRSzrQnVl4coR9pJE3/VitFM15RMS8izeokLvsI X-Received: by 2002:a05:6358:769e:b0:17b:5a9a:f76d with SMTP id e30-20020a056358769e00b0017b5a9af76dmr3466947rwg.11.1708943038700; Mon, 26 Feb 2024 02:23:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708943038; cv=pass; d=google.com; s=arc-20160816; b=jMfNRzt3SzA1O8jZqAVVn5zqA9Vg4i/e6pnkcJBeYiC5svuKC00hNTc/dVsVDEFa/C FfAeo7kKWDUHHvkKErtVngcVa5gSsi0LU/oRDID+UWzO56hG2DFa8hgOvRgySZIJq85R rjb30NHSt821jQH6xAbZkbzUvodzExNvrj8bGPxZ/jmGokj8MEloThva+E46vy96faxK 8X6cDN+YT0q/PtOOMTuyTOw03kZnyyhgYdkyw2XOnDI174DlZxN+qQ1d3j9nhwJZAJBc DwfOG2+8QnggtyemkPRqfvd1dl5BoSuRfdLVlN13spBoeGNfc3ZKuQLXRIFSA/8XAQQc R8YA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=1YFU6WdZM9SQFy2Ur5i4rzS9kbd1FF1r6Cyc0pRvjOk=; fh=LGx7a9qaaTpjgF2CDOonnjAGPmT9RQDS0s///HGX0YY=; b=xnkTFdIQiT3CbhdzPb1fmmY7KM2F04a2NLTlgLNIRCw/2NOxg3UuoGqbR0/sPrjx33 WRX2IdapIT9mqZkqUxyGfDdBihdpJ8qdcry8LZRSXlM0s7qwpkdXTE5Np/uQugOkqlKs krstgKft6DUhsPsvM/KHw+WESbSZVi296x/s7LAhxFic3PAeOnQvo1dtOTaPrxIfLHaW D/0VGiLiioweqnhHo3ceNRmZcjwqkpMZqYJ6i6njkKmLrwQHr05gt8eJYaFvONv6G8vi KTAvggOnCuzr43T6biTgXRlLJw5vcStYBRDZaYpPm8UVxZkSO4VxCoKAhCpQ6d6xIxQz MFag==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=j9aE7DNg; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-81093-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81093-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id f2-20020a056a00238200b006e4df2c9b0dsi3509356pfc.329.2024.02.26.02.23.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 02:23:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81093-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=j9aE7DNg; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-81093-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81093-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 42E2328A032 for ; Mon, 26 Feb 2024 10:10:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B04162A12; Mon, 26 Feb 2024 09:49:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="j9aE7DNg" Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 113B22E648 for ; Mon, 26 Feb 2024 09:49:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.66 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708940983; cv=none; b=ajB+OZEexFMXxW5N8oLH2mbdC8w3IWeR1esq3uFXwgvL+JiOVlFZUCInPmGkyM4ObMaGXjBcPXY5pipV+F37tlvB9cy8a4iey5g1zQImyGuTy07UHDW/qHB61PVj4tOrgVafZQr46y7YpzBpXYu6IqSJZSP138molNrUCCVW4As= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708940983; c=relaxed/simple; bh=vTbbnU0AQBSusnj9unjWrvIi8LxU8OXeteKwp4FBQTs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SyC1mct2gTJ9mbUujQYLXJKSWSCfogGjBtqbVW9B/qtbSntaUUr12/2RE5NIi94ginC/JoCp4VkkiUmfj3L5vaGBNPVTCEraWVACIZq8bhBythIDmJcVSyUP9+/q33NDGyhhd2f+/SlLiMiRmYDOhT3OdcQlvZOUb0oYYG7l1J0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=j9aE7DNg; arc=none smtp.client-ip=209.85.216.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Received: by mail-pj1-f66.google.com with SMTP id 98e67ed59e1d1-29a858a0981so1606927a91.0 for ; Mon, 26 Feb 2024 01:49:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1708940981; x=1709545781; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1YFU6WdZM9SQFy2Ur5i4rzS9kbd1FF1r6Cyc0pRvjOk=; b=j9aE7DNgNIhyVrQEsOfxi/oYHFRykmAN3ACnkHjxFUDgzhYhtcx1VIM0ZjoJ2EcRaO DaLY/iaaIMR0G3tiGhYNtVwx1oW3t2RbGhz0+2UGcd8kl5UUYz1Viabzq7DTTQhXULzN r7tycG+rqshOv8hNnsF8FbtM1/xXvsfg95KxzrhoWSXM1CMv60pCm3L0aOrSys8ui74D QRBetEYCm4QcfcChqt1vXC3N/hBGGIkTk1+iCDJLf4Vxkij2/HQeazogKd1WvF3L0lgI Cj2xiGLsKape7lA9yTCx2BOD3p0qRM7i5nILFGcRpM1CfQyDTGY2cMhpIVazMPI7Xye7 S3gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708940981; x=1709545781; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1YFU6WdZM9SQFy2Ur5i4rzS9kbd1FF1r6Cyc0pRvjOk=; b=ODc54PqDw5pjI8F3NAFEr6T/klxG1q/La8+fb3MI3WUHy02xPgF96xmyGc38+XVfOJ mrxA/Y4uQOcOfmQmU2OgaQhkU8eAtY76xGey2nxyc2YSBdg+REIkjQxoGx2TOpioTkSX okvoT9X28xNw5IDfYmt9uFhOSMx5Y9PJWKBJnjpZJl7du6X2sk7d4mDFEwXP0Fsqs3Os QSSyoaD/to61ypX+42NR7dHA08ncXyyU8RiH5XlZnS8zIL8U4m0j96WymOt17lMOi51I xvdiqODdGv9OTs/e8vCpd0/EwC8kKaIhZWNvU6JxHLsUnqa/7wnlXuVy1X5Vvjn7n78S Z3YA== X-Forwarded-Encrypted: i=1; AJvYcCVHSLaw+ok3tYneGmqGnlBsPYcUwNXw/ysxkxsiNjUu58yg2RJuSlJK3L6Ke3+9KyhZbi1u/pbWhB5dePU81he5kusrZSlabiNuoj11 X-Gm-Message-State: AOJu0Yw6RfAYEQnOdCIND/P9QKcJ55ks1JLFJ0dHdkOKgyluSErVlNTL J62BxBUbQaL8A1CngR0KdvSqIOKinz0+fWliFuEI7pF6OeWVfWTElHmUdpGBu/E= X-Received: by 2002:a17:90b:1103:b0:29a:9fe3:3d92 with SMTP id gi3-20020a17090b110300b0029a9fe33d92mr3110121pjb.44.1708940981319; Mon, 26 Feb 2024 01:49:41 -0800 (PST) Received: from C02CV19DML87.bytedance.net ([203.208.189.12]) by smtp.gmail.com with ESMTPSA id x19-20020a17090ab01300b002990d91d31dsm5934779pjq.15.2024.02.26.01.49.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 01:49:41 -0800 (PST) From: Rui Qi To: bp@alien8.de, mingo@redhat.com, tglx@linutronix.de, hpa@zytor.com, jpoimboe@redhat.com, peterz@infradead.org, mbenes@suse.cz, gregkh@linuxfoundation.org, stable@vger.kernel.org, alexandre.chartre@oracle.com Cc: x86@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] objtool: is_fentry_call() crashes if call has no destination Date: Mon, 26 Feb 2024 17:49:23 +0800 Message-Id: <20240226094925.95835-2-qirui.001@bytedance.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240226094925.95835-1-qirui.001@bytedance.com> References: <20240226094925.95835-1-qirui.001@bytedance.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791956655680228432 X-GMAIL-MSGID: 1791956655680228432 From: Alexandre Chartre commit 87cf61fe848ca8ddf091548671e168f52e8a718e upstream. Fix is_fentry_call() so that it works if a call has no destination set (call_dest). This needs to be done in order to support intra- function calls. Signed-off-by: Alexandre Chartre Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Miroslav Benes Acked-by: Josh Poimboeuf Link: https://lkml.kernel.org/r/20200414103618.12657-2-alexandre.chartre@oracle.com --- tools/objtool/check.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index dfd67243faac..71a24fd46dbd 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1367,7 +1367,7 @@ static int decode_sections(struct objtool_file *file) static bool is_fentry_call(struct instruction *insn) { - if (insn->type == INSN_CALL && + if (insn->type == INSN_CALL && insn->call_dest && insn->call_dest->type == STT_NOTYPE && !strcmp(insn->call_dest->name, "__fentry__")) return true;