<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:굴림;
panose-1:2 11 6 0 0 1 1 1 1 1;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"맑은 고딕";
panose-1:2 11 5 3 2 0 0 2 0 4;}
@font-face
{font-family:"\@맑은 고딕";
panose-1:2 11 5 3 2 0 0 2 0 4;}
@font-face
{font-family:"\@굴림";
panose-1:2 11 6 0 0 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:굴림;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:굴림;}
span.EmailStyle18
{mso-style-type:personal;
font-family:"맑은 고딕";
color:windowtext;}
span.EmailStyle19
{mso-style-type:personal-compose;
font-family:"맑은 고딕";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"맑은 고딕";}
@page WordSection1
{size:612.0pt 792.0pt;
margin:3.0cm 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=KO link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal style='word-break:break-hangul'><span lang=EN-US style='font-size:10.0pt;font-family:"맑은 고딕"'>Hi,<o:p></o:p></span></p><p class=MsoNormal style='word-break:break-hangul'><span lang=EN-US style='font-size:10.0pt;font-family:"맑은 고딕"'>To print kernel virtual address, you should use %px instead of %p in the printk.<o:p></o:p></span></p><p class=MsoNormal style='word-break:break-hangul'><span lang=EN-US style='font-size:10.0pt;font-family:"맑은 고딕"'>Probably that’s why you couldn’t see the pointer values correctly.<o:p></o:p></span></p><p class=MsoNormal style='word-break:break-hangul'><span lang=EN-US style='font-size:10.0pt;font-family:"맑은 고딕"'>Chan<o:p></o:p></span></p><p class=MsoNormal style='word-break:break-hangul'><span lang=EN-US style='font-size:10.0pt;font-family:"맑은 고딕"'><o:p> </o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'> admin LI <admin@hifiphile.com> <br><b>Sent:</b> Friday, January 14, 2022 6:02 AM<br><b>To:</b> kernelnewbies@kernelnewbies.org<br><b>Subject:</b> How to disable address randomization ?<o:p></o:p></span></p></div></div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><div><p class=MsoNormal style='margin-bottom:12.0pt'><span lang=EN-US>Hi,<br><br>I'm developing a kernel module for an ARM machine, while debugging I found addresses <br>printed are all randomized and useless for debugging.<br><br>To prove I was not crazy I wrote this small program:<br><br>---------------------------------<br>#include <linux/init.h><br>#include <linux/module.h><br>#include <linux/kernel.h><br>#include <linux/slab.h><br><br>MODULE_LICENSE("GPL");<br>MODULE_AUTHOR("Somebody");<br>MODULE_DESCRIPTION("A simple example Linux module.");<br>MODULE_VERSION("0.01");<br><br>static int __init example_init(void) {<br> uint32_t a;<br> uint32_t b;<br> uint32_t c;<br> uint8_t d[10];<br> uint8_t *e;<br><br> printk(KERN_INFO "Hello, World!\n");<br> printk(KERN_INFO "&a %p\n",&a);<br> printk(KERN_INFO "&b %p\n",&b);<br> printk(KERN_INFO "&c %p\n",&c);<br> printk(KERN_INFO "&d %p\n",d);<br> printk(KERN_INFO "&d[0] %p\n",&d[0]);<br> printk(KERN_INFO "&d[1] %p\n",&d[1]);<br><br> e = kmalloc(10, GFP_KERNEL);<br> printk(KERN_INFO "&e[0] %p\n",&e[0]);<br> printk(KERN_INFO "&e[1] %p\n",&e[1]);<br><br> kfree(e);<br><br> return 0;<br>}<br><br>static void __exit example_exit(void) {<br> printk(KERN_INFO "Goodbye, World!\n");<br>}<br><br>module_init(example_init);<br>module_exit(example_exit);<br>---------------------------------<br>And it gave me this output:<br><br>Hello, World!<br>&a b3f9fa31<br>&b 27e1c68a<br>&c da50d287<br>&d 9f9aec2b<br>&d[0] 9f9aec2b<br>&d[1] cc627580<br>&e[0] 98b8c9eb<br>&e[1] 45f248f8<br><br>Then I tested on my debian host machine which gave me the same kind of randomized addresses.<br><br>When I search randomization the only thing I found is KASLR which I don't think is the same thing.<o:p></o:p></span></p></div></div></div></body></html>