From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C03C7C433F5 for ; Thu, 13 Jan 2022 21:05:10 +0000 (UTC) Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94.2) (envelope-from ) id 1n87Gk-0003Nl-78; Thu, 13 Jan 2022 16:04:26 -0500 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1n87E9-0003MD-LB for kernelnewbies@kernelnewbies.org; Thu, 13 Jan 2022 16:01:46 -0500 Received: by mail-pf1-x42e.google.com with SMTP id i17so962146pfk.11 for ; Thu, 13 Jan 2022 13:01:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hifiphile-com.20210112.gappssmtp.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=ZhiSYg9n3+zKIhcuttIuoqPLcg1ZFW8VCfoKdeJD71U=; b=J5Upny5MHqCrXHpJGYoNTezkuARzKhh11uN8JHwvBARgtE8LA1GvdtVURg3p7zOJxT b/bWsn+grCR1ePKP92XA5bw/rR9dKHAyb0Yqtu2lsN/qcu/x++wa6S8OpbYqDGoTihJi H6+TNBG6lBMQ5igFtfUJJ2RqykJr1qCG90uij6FG9eZyMPmWH1cPLP26/kTQnyv7bq/5 Or/zgPEPnhkGMGSKI6qfD6Jzm4h3j6iEM9uY3UWkt7/s1IcUU7rTJolbkUjWx9wYDrMJ xALorsmi+q1MzJdO1FuniB7u7I4D2DCDY3g7ve+30C0ldFxx1F3Lpc5psXHVMzR5+7lh JbRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=ZhiSYg9n3+zKIhcuttIuoqPLcg1ZFW8VCfoKdeJD71U=; b=3gh7+vFaPwer9UbJy7M1MGTzpeENSWEaH+4EJr+7ezZsSNVsb40p5aNk5nmaKlvmt+ pMWLMdVrbKbj8qcAusYS65cKvAva21Ar86wRXLaaP7lcJ94XPWVtrfXgD2TyMSsX4Nqs EK3PyYFwsuyvkuvbrhcn0cfF19m8AU6By9XNLRqPZ62ANJBJ/4Hij6VsFrTItz5UH7zj 4tHx/f0QWaear5My3g+jFIARgiCI4siVfNwzUQYhLqJYk3JKZDZrPVC2nm7s4H8xZVYH C2UKL3Eg5AtsOS2eQCGn2x3P4m/SYjSmoUOlFaseNHTUPhc7xFwLahjqEtz0/SYcxOLb EE1Q== X-Gm-Message-State: AOAM533V19SzcKhlS1Wv6lPYtCzcxuqllSUeT5Ch3DbLJ5NzY1LvO9Mn 57KXfMTI7RTRaAyxMEO+WNKFyttNpRMilItqmdK9OylcQuNpwQDS X-Google-Smtp-Source: ABdhPJyJ+SW6k+EqPGPVshEcd69Mk2GKGzXI087kUcGamWSplWqJeTFOCIF5psWNqWzwZvJEaqQDhm6ysULLba0u9c0= X-Received: by 2002:a63:eb07:: with SMTP id t7mr5430259pgh.112.1642107702070; Thu, 13 Jan 2022 13:01:42 -0800 (PST) MIME-Version: 1.0 From: admin LI Date: Thu, 13 Jan 2022 22:01:30 +0100 Message-ID: Subject: How to disable address randomization ? To: kernelnewbies@kernelnewbies.org X-Mailman-Approved-At: Thu, 13 Jan 2022 16:04:24 -0500 X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============1863351192503639228==" Errors-To: kernelnewbies-bounces@kernelnewbies.org --===============1863351192503639228== Content-Type: multipart/alternative; boundary="00000000000043eada05d57cfe31" --00000000000043eada05d57cfe31 Content-Type: text/plain; charset="UTF-8" Hi, I'm developing a kernel module for an ARM machine, while debugging I found addresses printed are all randomized and useless for debugging. To prove I was not crazy I wrote this small program: --------------------------------- #include #include #include #include MODULE_LICENSE("GPL"); MODULE_AUTHOR("Somebody"); MODULE_DESCRIPTION("A simple example Linux module."); MODULE_VERSION("0.01"); static int __init example_init(void) { uint32_t a; uint32_t b; uint32_t c; uint8_t d[10]; uint8_t *e; printk(KERN_INFO "Hello, World!\n"); printk(KERN_INFO "&a %p\n",&a); printk(KERN_INFO "&b %p\n",&b); printk(KERN_INFO "&c %p\n",&c); printk(KERN_INFO "&d %p\n",d); printk(KERN_INFO "&d[0] %p\n",&d[0]); printk(KERN_INFO "&d[1] %p\n",&d[1]); e = kmalloc(10, GFP_KERNEL); printk(KERN_INFO "&e[0] %p\n",&e[0]); printk(KERN_INFO "&e[1] %p\n",&e[1]); kfree(e); return 0; } static void __exit example_exit(void) { printk(KERN_INFO "Goodbye, World!\n"); } module_init(example_init); module_exit(example_exit); --------------------------------- And it gave me this output: Hello, World! &a b3f9fa31 &b 27e1c68a &c da50d287 &d 9f9aec2b &d[0] 9f9aec2b &d[1] cc627580 &e[0] 98b8c9eb &e[1] 45f248f8 Then I tested on my debian host machine which gave me the same kind of randomized addresses. When I search randomization the only thing I found is KASLR which I don't think is the same thing. --00000000000043eada05d57cfe31 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

I'm developing a kernel module for an ARM m= achine, while debugging I found addresses
printed are all randomized an= d useless for debugging.

To prove I was not crazy I wrote this small= program:

---------------------------------
#include <linux/in= it.h>
#include <linux/module.h>
#include <linux/kernel.h&= gt;
#include <linux/slab.h>

MODULE_LICENSE("GPL")= ;
MODULE_AUTHOR("Somebody");
MODULE_DESCRIPTION("A sim= ple example Linux module.");
MODULE_VERSION("0.01");
<= br>static int __init example_init(void) {
=C2=A0 =C2=A0 uint32_t a;
= =C2=A0 =C2=A0 uint32_t b;
=C2=A0 =C2=A0 uint32_t c;
=C2=A0 =C2=A0 uin= t8_t d[10];
=C2=A0 =C2=A0 uint8_t *e;

=C2=A0 =C2=A0 printk(KERN_I= NFO "Hello, World!\n");
=C2=A0 =C2=A0 printk(KERN_INFO "&= amp;a %p\n",&a);
=C2=A0 =C2=A0 printk(KERN_INFO "&b %p= \n",&b);
=C2=A0 =C2=A0 printk(KERN_INFO "&c %p\n"= ,&c);
=C2=A0 =C2=A0 printk(KERN_INFO "&d %p\n",d);
= =C2=A0 =C2=A0 printk(KERN_INFO "&d[0] %p\n",&d[0]);
= =C2=A0 =C2=A0 printk(KERN_INFO "&d[1] %p\n",&d[1]);
=C2=A0 =C2=A0 e =3D kmalloc(10, GFP_KERNEL);
=C2=A0 =C2=A0 printk(KERN= _INFO "&e[0] %p\n",&e[0]);
=C2=A0 =C2=A0 printk(KERN_I= NFO "&e[1] %p\n",&e[1]);

=C2=A0 =C2=A0 kfree(e);
=C2=A0return 0;
}

static void __exit example_exit(void) {=C2=A0printk(KERN_INFO "Goodbye, World!\n");
}

module= _init(example_init);
module_exit(example_exit);
---------------------= ------------
And it gave me this output:

Hello, World!
&a = b3f9fa31
&b 27e1c68a
&c da50d287
&d 9f9aec2b
&d= [0] 9f9aec2b
&d[1] cc627580
&e[0] 98b8c9eb
&e[1] 45f24= 8f8

Then I tested on my debian host machine which gave me the same k= ind of randomized addresses.

When I search randomization the only th= ing I found is KASLR which I don't think is the same thing.

--00000000000043eada05d57cfe31-- --===============1863351192503639228== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies --===============1863351192503639228==--