From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 C42EA31AF31 for ; Thu, 13 Nov 2025 19:55:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763063758; cv=none; b=dnsG/99LwkMjhibNjHro85I/eW4SIyAs5vDQ+BuZOS1QFYCIX9MsiBMdJ0BbMtfsQXwNdVb1z+WQsH9dZaoo/NCymtbRMHKJ5O739qpjXt7+LOQXmrdOeJ3HN/WSZL9P3+ZFmGF8gI9cb7k+jTmUI0QrmxAv5Ye7BvB4SU6VGX8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763063758; c=relaxed/simple; bh=GCe4H+ZS7ZpuCxEa2OSnEn2BVuby3QFDOyU801Ks9nA=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KIZr7w23UD7/pPY+UiSTYUpOi1KRIn60asUMOzosTRzFshSkBRlBg+yDoi6zIEk4IVkRrXQ4jFVa3fIQE0kY/1YEHrWCmkFJOEKQ8pujIR9fFi74HwlOH2XgphDRwzvIhEUNdVQ06NYOIlGFMxsqfFtb6PpMTm/Ui6Sfnvxq1Dk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BK1V71Su; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BK1V71Su" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4777a9aeedaso10823275e9.3 for ; Thu, 13 Nov 2025 11:55:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763063755; x=1763668555; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=iibEg+8KYqg0N+n/bMKXquTDEwfr7GOLDNMFV/UY+dQ=; b=BK1V71SuLUWkqCClpWEAbHtQp7i4duEGNdoHNUCGhscWj4QFmLPVDx2vH673V9tlLA QGCD015S4wt0b2IK7h/kPk0jq6FGrWMOqwYfuwkMtMtsqvReh796e6UkjN/0FNoKzEHH GFADo7czRpcoimWINQ7qt9bWFuT0HxZ+84e9YtnfhMlVB+BXV4UppgiYwjxQLDVCPTpp eHtHz8LBaOhkf/VFFV9g3M7SQNtv6AiIoUgcR7z2Hhsz6XvSooshhIdOuBwKiv29hyBX 4sU64YH2a21CZe0stxt4rAONxICwys7WPKxAuAePvGtszpsnVopvXI2njywID0Ymb16J UUjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763063755; x=1763668555; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=iibEg+8KYqg0N+n/bMKXquTDEwfr7GOLDNMFV/UY+dQ=; b=u/q82E3QE+o2TIuaF6OuwtnBXkRArBfD0sOpgyyiJd3OGpRZ97Djk/nnrGxV3s3C2z iAt1XbGG4NIruGVxFMtKNWW46sTpcEpEkX6KgVrTPKPVsh38ROUL8IVFTkg/VTM549Ws +Nr8OInOA66P2mMcONwBPkOTWqZkmVW7b2YejZ1EfJYRpXhTkg3MvCJ6CCtvyK/ZW5KA YvGGrZk21FWqOJihaM2p9rgJOQtZWvZ82ERTc1LiCItC0m6A+aTNT19EPkpDOJCXN369 ujSyuQxNa/cD27zFKsaBMIpgnYThNEjmb9VOGowbEkpUhpwJt+9iqJs7tsMsYfD32TU6 b0fA== X-Gm-Message-State: AOJu0YwYDtmADxlzOW6aDen/Cw6vOZ4OrCPkVV056xkvAmoTP3Zdv/tW CK243ZrdePE9PPnLfdVjS+9daGGK8BJSLNLOyInFTgEwUIh9iK5SP9aY X-Gm-Gg: ASbGncsvPCVoKT2CXmJfYJdsc49ONwew2rVTiywl/2V52Jo3Ew56YDfSbrge/BerWow g1qyBnTFsPTRFJvnmr05arDm5kyKez+hdTBclRpsIjWqmhAfRDkmVTRSao6jpqfNoItW2NYJmKt BD8A+3FH6Ge0F80FzjEAZUmE3+IWVAUJo0XcGzYWZ+7ryNmZ+LuOiQR6tfozVs8OwxNAQD8xY5c Ln2dEE1cbPf22JlZqiVoh0MsMDqHxvOnCWEh5SqZcAadt2XDaV5Gq4pi5CavOCys0ei98GBp366 70CD7ZIgzPVhB9Zsds0RzP5SidxkI4ALgB3XMibz1rBKZ+UdIfM/mP28G6IC5ziupZTy+f6K188 zjLE3GPjiNP84fKZO0b2xFDaq4cG/+NnrMVrVowEY31IfFmrN0DFq57CSpSe3PJzwCMKZJ7Y1D2 Wn6wSh7/Jg5WF5BixI/XxZmvq82NAT5yxaKmwP8RBXHD1e1u3TGnJ2wI5bRmTKn4o= X-Google-Smtp-Source: AGHT+IG/G35upljTbEEklVZBRalGd87MTsKhXMOfx+IND9ebjKEjVMCI2JP6dWbJp6EskQ9QFK29mQ== X-Received: by 2002:a05:600c:4703:b0:475:dde5:d91b with SMTP id 5b1f17b1804b1-4778fe63090mr6802675e9.17.1763063754930; Thu, 13 Nov 2025 11:55:54 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53e85e6fsm5773880f8f.18.2025.11.13.11.55.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Nov 2025 11:55:54 -0800 (PST) Date: Thu, 13 Nov 2025 19:55:53 +0000 From: David Laight To: Alexandre Chartre Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, jpoimboe@kernel.org, peterz@infradead.org Subject: Re: [PATCH v4 00/28] objtool: Function validation tracing Message-ID: <20251113195553.34bc309c@pumpkin> In-Reply-To: <20251113164917.2563486-1-alexandre.chartre@oracle.com> References: <20251113164917.2563486-1-alexandre.chartre@oracle.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 13 Nov 2025 17:48:49 +0100 Alexandre Chartre wrote: > Hi, > > These patches change objtool to disassemble code with libopcodes instead > of running objdump. You will find below: > > - Changes: list of changes made in this version > - Overview: overview of the changes > - Notes: description of some particular behavior > - Examples: output examples ... > Example 3 (--disas option): Alternatives with multiple instructions > ------------------------------------------------------------------- > Alternatives with multiple instructions are displayed side-by-side, with > an header describing the alternative. The code in the first column is the > default code of the alternative. > > > $ ./tools/objtool/objtool --disas=__switch_to_asm --link vmlinux.o > __switch_to_asm: > 82c0: __switch_to_asm+0x0 push %rbp > 82c1: __switch_to_asm+0x1 push %rbx > 82c2: __switch_to_asm+0x2 push %r12 > 82c4: __switch_to_asm+0x4 push %r13 > 82c6: __switch_to_asm+0x6 push %r14 > 82c8: __switch_to_asm+0x8 push %r15 > 82ca: __switch_to_asm+0xa mov %rsp,0x1670(%rdi) > 82d1: __switch_to_asm+0x11 mov 0x1670(%rsi),%rsp > 82d8: __switch_to_asm+0x18 mov 0xad8(%rsi),%rbx > 82df: __switch_to_asm+0x1f mov %rbx,%gs:0x0(%rip) # 0x82e7 <__stack_chk_guard> > 82e7: __switch_to_asm+0x27 | | !X86_FEATURE_ALWAYS | X86_FEATURE_RSB_CTXSW > 82e7: __switch_to_asm+0x27 | jmp 0x8312 <__switch_to_asm+0x52> | NOP1 | mov $0x10,%r12 > 82e8: __switch_to_asm+0x28 | | NOP1 | > 82e9: __switch_to_asm+0x29 | NOP1 | callq 0x82ef <__switch_to_asm+0x2f> | > 82ea: __switch_to_asm+0x2a | NOP1 | | > 82eb: __switch_to_asm+0x2b | NOP1 | | > 82ec: __switch_to_asm+0x2c | NOP1 | | > 82ed: __switch_to_asm+0x2d | NOP1 | | > 82ee: __switch_to_asm+0x2e | NOP1 | int3 | callq 0x82f4 <__switch_to_asm+0x34> > 82ef: __switch_to_asm+0x2f | NOP1 | add $0x8,%rsp | > 82f0: __switch_to_asm+0x30 | NOP1 | | > 82f1: __switch_to_asm+0x31 | NOP1 | | > 82f2: __switch_to_asm+0x32 | NOP1 | | > 82f3: __switch_to_asm+0x33 | NOP1 | lfence | int3 > 82f4: __switch_to_asm+0x34 | NOP1 | | callq 0x82fa <__switch_to_asm+0x3a> > 82f5: __switch_to_asm+0x35 | NOP1 | | > 82f6: __switch_to_asm+0x36 | NOP1 | | > 82f7: __switch_to_asm+0x37 | NOP1 | | > 82f8: __switch_to_asm+0x38 | NOP1 | | > 82f9: __switch_to_asm+0x39 | NOP1 | | int3 > 82fa: __switch_to_asm+0x3a | NOP1 | | add $0x10,%rsp > 82fb: __switch_to_asm+0x3b | NOP1 | | > 82fc: __switch_to_asm+0x3c | NOP1 | | > 82fd: __switch_to_asm+0x3d | NOP1 | | > 82fe: __switch_to_asm+0x3e | NOP1 | | dec %r12 > 82ff: __switch_to_asm+0x3f | NOP1 | | > 8300: __switch_to_asm+0x40 | NOP1 | | > 8301: __switch_to_asm+0x41 | NOP1 | | jne 0x82ee <__switch_to_asm+0x2e> > 8302: __switch_to_asm+0x42 | NOP1 | | > 8303: __switch_to_asm+0x43 | NOP1 | | lfence > 8304: __switch_to_asm+0x44 | NOP1 | | > 8305: __switch_to_asm+0x45 | NOP1 | | > 8306: __switch_to_asm+0x46 | NOP1 | | movq $0xffffffffffffffff,%gs:0x0(%rip) # 0x20b <__x86_call_depth> > 8307: __switch_to_asm+0x47 | NOP1 | | > 8308: __switch_to_asm+0x48 | NOP1 | | > 8309: __switch_to_asm+0x49 | NOP1 | | > 830a: __switch_to_asm+0x4a | NOP1 | | > 830b: __switch_to_asm+0x4b | NOP1 | | > 830c: __switch_to_asm+0x4c | NOP1 | | > 830d: __switch_to_asm+0x4d | NOP1 | | > 830e: __switch_to_asm+0x4e | NOP1 | | > 830f: __switch_to_asm+0x4f | NOP1 | | > 8310: __switch_to_asm+0x50 | NOP1 | | > 8311: __switch_to_asm+0x51 | NOP1 | | > 8312: __switch_to_asm+0x52 pop %r15 > 8314: __switch_to_asm+0x54 pop %r14 > 8316: __switch_to_asm+0x56 pop %r13 > 8318: __switch_to_asm+0x58 pop %r12 > 831a: __switch_to_asm+0x5a pop %rbx > 831b: __switch_to_asm+0x5b pop %rbp > 831c: __switch_to_asm+0x5c jmpq 0x8321 <__switch_to> That might be rather easier to read if the alternatives followed each other. Not all of us want to use a very wide window to look at object files. (I didn't see any other example like that either.) Similarly in Ex 5: 332d4: early_ioremap_pmd+0x4 callq *0x0(%rip) # 0x332da | mov %cr3,%rax (!X86_FEATURE_XENPV) | callq xen_read_cr3 (+X86_FEATURE_ALWAYS) # might be more readable flipped to something like: 332d4: early_ioremap_pmd+0x4 callq *0x0(%rip) # 0x332da !X86_FEATURE_XENPV: mov %cr3,%rax +X86_FEATURE_ALWAYS: callq xen_read_cr3 David