[Devel] [PATCH RHEL9 COMMIT] rh/x86: hide unused field in thread_info (fix for drgn)

Konstantin Khorenko khorenko at virtuozzo.com
Tue Jun 18 21:06:28 MSK 2024


The commit is pushed to "branch-rh9-5.14.0-425.vz9.60.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-425.vz9.60.5
------>
commit 5a46bfdfbe091f6f2fffc7ae08e60c0d65c15bf1
Author: Alexey Kuznetsov <kuznet at virtuozzo.com>
Date:   Sat Jun 15 19:29:12 2024 +0800

    rh/x86: hide unused field in thread_info (fix for drgn)
    
    RHEL added this unused field by an unknown reason, apparently
    brainlessy porting some patch from mainstream.
    
    It looks just as waste of memory, but it is worse, as tools
    like drgn interpret its presence as indicator that kernel
    works according to rules of that mainstream kernel where that
    patch was borrowed from. The result - drgn becomes useless.
    
    We could delete it. But for now it seems more clever to
    keep struct 100% binary compatible, only with the field renamed.
    
    Signed-off-by: Alexey Kuznetsov <kuznet at acronis.com>
    
    Feature: fix rh/x86
    
    khorenko@ notes:
    =======================================
    Comment from RedHat commit:
      commit 6d09fbd042c8d99009e16ddba62af09c89358f80
      Author: Prarit Bhargava <prarit at redhat.com>
      Date:   Tue Jan 24 09:29:59 2023 -0500
    
          x86: add CPU field to struct thread_info
    
          Bugzilla: https://bugzilla.redhat.com/2163809
    
          commit 5443f98fb9e06e765e24f9d894bf028accad8f71
          Author: Ard Biesheuvel <ardb at kernel.org>
          Date:   Tue Sep 14 14:10:30 2021 +0200
    
              x86: add CPU field to struct thread_info
    
              The CPU field will be moved back into thread_info even when
              THREAD_INFO_IN_TASK is enabled, so add it back to x86's definition of
              struct thread_info.
    
              Signed-off-by: Ard Biesheuvel <ardb at kernel.org>
              Acked-by: Borislav Petkov <bp at suse.de>
              Acked-by: Mark Rutland <mark.rutland at arm.com>
    
          Signed-off-by: Prarit Bhargava <prarit at redhat.com>
    =======================================
    
    So RedHat has ported the ms patch
      5443f98fb9e0 ("x86: add CPU field to struct thread_info")
    but has not ported the patch from the same patchset
      bcf9033e5449 ("sched: move CPU field back into thread_info if THREAD_INFO_IN_TASK=y")
    
    so i guess drgn just has been tricked - how come, the THREAD_INFO_IN_TASK=y,
    the field "cpu" is in place in task->thread_info->cpu, but not updated.
    
    Acked-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 arch/x86/include/asm/thread_info.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index eb2256c84476..61795200cb73 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -58,7 +58,7 @@ struct thread_info {
 	unsigned long		syscall_work;	/* SYSCALL_WORK_ flags */
 	u32			status;		/* thread synchronous flags */
 #ifdef CONFIG_SMP
-	u32			cpu;		/* current CPU */
+	u32			__unused_cpu;	/* current CPU */
 #endif
 	int			preempt_lazy_count;	/* 0 => lazy preemptable
 							  <0 => BUG */


More information about the Devel mailing list