<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 3, 2016 at 5:00 PM, Paddie O'Brien <span dir="ltr"><<a href="mailto:paddieobrien@gmail.com" target="_blank">paddieobrien@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It is a 32-bit system.<br>
<br>
I have a C program that puts a number in a variable. I then retrieve<br>
the physical address of that variable using a system call I added to<br>
the kernel. I next seek to that address in /dev/mem and verify that<br>
what I find there matches the contents of the variable in my program.<br>
All works fine i.e. the values match up except when the physical<br>
address returned by the syscall is greater than 935321597. For lower<br>
physical addresses there is no error. Once above the threshold I get a<br>
"bad address" error when attempting the read from /dev/mem after<br>
seeking to the appropriate location.<br>
<br>
If I specify 512MB of physical memory on the VM then the problem goes<br>
away since the physical address returned never exceeds the threshold.<br>
<br>
So what you are suggesting is that there is a subrange of physical<br>
addresses from which it is illegal to read in /dev/mem?<br>
<br>
Thanks.<br>
<div class="HOEnZb"><div class="h5"><br>
On 1 October 2016 at 18:45, Mulyadi Santosa <<a href="mailto:mulyadi.santosa@gmail.com">mulyadi.santosa@gmail.com</a>> wrote:<br>
><br>
><br>
> On Wed, Sep 28, 2016 at 2:49 AM, Paddie O'Brien <<a href="mailto:paddieobrien@gmail.com">paddieobrien@gmail.com</a>><br>
> wrote:<br>
>><br>
>> Hi,<br>
>><br>
>> I have a system call that maps virtual to physical addresses. I have<br>
>> disabled CONFIG_STRICT_DEVMEM and am reading from /dev/mem to verify<br>
>> that the contents of the syscall-returned physical address match the<br>
>> contents of the virtual address. It works fine up to a point. Reading<br>
>> beyond byte 935321597 in /dev/mem throws a "bad address" error. Not<br>
>> sure it's relevant but I'm running on virtual box and specifying 1GB<br>
>> of RAM. Tried with 2GB of RAM and hit the same problem.<br>
>><br>
>> Any idea why I can't read beyond the above point?<br>
>><br>
>> Thanks.<br>
>><br>
><br>
> Hi paddie<br>
><br>
> Is it 32 bit system?<br>
><br>
> If yes, it seems you are about to exceed boundary of kernel linear addres<br>
> range, which is 0-896 MiB. The upper 896-1024 MiB (1 GiB) is reserved for<br>
> dynamic mapping<br>
><br>
> CMIIW people.<br>
><br>
> --<br>
> regards,<br>
><br>
> Mulyadi Santosa<br>
> Freelance Linux trainer and consultant<br>
><br>
> blog: <a href="http://the-hydra.blogspot.com" rel="noreferrer" target="_blank">the-hydra.blogspot.com</a><br>
> training: <a href="http://mulyaditraining.blogspot.com" rel="noreferrer" target="_blank">mulyaditraining.blogspot.com</a><br>
><br>
</div></div><div class="HOEnZb"><div class="h5">> ______________________________<wbr>_________________<br>
> Kernelnewbies mailing list<br>
> <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.<wbr>org</a><br>
> <a href="https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" rel="noreferrer" target="_blank">https://lists.kernelnewbies.<wbr>org/mailman/listinfo/<wbr>kernelnewbies</a><br>
><br>
</div></div></blockquote></div><br><br></div><div class="gmail_extra">Dear Paddie<br><br></div><div class="gmail_extra">Please don't top post, it's the core rules here :)<br><br></div><div class="gmail_extra">Anyway, there is no such thing as boundary, but more like what is mapped and what is not and who occupies it.<br><br></div><div class="gmail_extra">As other poster also said, other than my previous mentioned 896 MB mapping boundary, check /proc/iomem, maybe you hit I/O mapped region<br clear="all"></div><div class="gmail_extra"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">regards,<br><br>Mulyadi Santosa<br>Freelance Linux trainer and consultant<br><br>blog: <a href="http://the-hydra.blogspot.com" target="_blank">the-hydra.blogspot.com</a><br>training: <a href="http://mulyaditraining.blogspot.com" target="_blank">mulyaditraining.blogspot.com</a></div>
</div></div>