* Error reading /dev/mem @ 2016-09-27 19:49 Paddie O'Brien 2016-10-01 17:45 ` Mulyadi Santosa 2016-10-03 13:00 ` Arun Sudhilal 0 siblings, 2 replies; 5+ messages in thread From: Paddie O'Brien @ 2016-09-27 19:49 UTC (permalink / raw) To: kernelnewbies Hi, I have a system call that maps virtual to physical addresses. I have disabled CONFIG_STRICT_DEVMEM and am reading from /dev/mem to verify that the contents of the syscall-returned physical address match the contents of the virtual address. It works fine up to a point. Reading beyond byte 935321597 in /dev/mem throws a "bad address" error. Not sure it's relevant but I'm running on virtual box and specifying 1GB of RAM. Tried with 2GB of RAM and hit the same problem. Any idea why I can't read beyond the above point? Thanks. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Error reading /dev/mem 2016-09-27 19:49 Error reading /dev/mem Paddie O'Brien @ 2016-10-01 17:45 ` Mulyadi Santosa 2016-10-03 10:00 ` Paddie O'Brien 2016-10-03 13:00 ` Arun Sudhilal 1 sibling, 1 reply; 5+ messages in thread From: Mulyadi Santosa @ 2016-10-01 17:45 UTC (permalink / raw) To: kernelnewbies On Wed, Sep 28, 2016 at 2:49 AM, Paddie O'Brien <paddieobrien@gmail.com> wrote: > Hi, > > I have a system call that maps virtual to physical addresses. I have > disabled CONFIG_STRICT_DEVMEM and am reading from /dev/mem to verify > that the contents of the syscall-returned physical address match the > contents of the virtual address. It works fine up to a point. Reading > beyond byte 935321597 in /dev/mem throws a "bad address" error. Not > sure it's relevant but I'm running on virtual box and specifying 1GB > of RAM. Tried with 2GB of RAM and hit the same problem. > > Any idea why I can't read beyond the above point? > > Thanks. > > Hi paddie Is it 32 bit system? If yes, it seems you are about to exceed boundary of kernel linear addres range, which is 0-896 MiB. The upper 896-1024 MiB (1 GiB) is reserved for dynamic mapping CMIIW people. -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20161002/b87fa50e/attachment.html ^ permalink raw reply [flat|nested] 5+ messages in thread
* Error reading /dev/mem 2016-10-01 17:45 ` Mulyadi Santosa @ 2016-10-03 10:00 ` Paddie O'Brien 2016-10-10 6:55 ` Mulyadi Santosa 0 siblings, 1 reply; 5+ messages in thread From: Paddie O'Brien @ 2016-10-03 10:00 UTC (permalink / raw) To: kernelnewbies It is a 32-bit system. I have a C program that puts a number in a variable. I then retrieve the physical address of that variable using a system call I added to the kernel. I next seek to that address in /dev/mem and verify that what I find there matches the contents of the variable in my program. All works fine i.e. the values match up except when the physical address returned by the syscall is greater than 935321597. For lower physical addresses there is no error. Once above the threshold I get a "bad address" error when attempting the read from /dev/mem after seeking to the appropriate location. If I specify 512MB of physical memory on the VM then the problem goes away since the physical address returned never exceeds the threshold. So what you are suggesting is that there is a subrange of physical addresses from which it is illegal to read in /dev/mem? Thanks. On 1 October 2016 at 18:45, Mulyadi Santosa <mulyadi.santosa@gmail.com> wrote: > > > On Wed, Sep 28, 2016 at 2:49 AM, Paddie O'Brien <paddieobrien@gmail.com> > wrote: >> >> Hi, >> >> I have a system call that maps virtual to physical addresses. I have >> disabled CONFIG_STRICT_DEVMEM and am reading from /dev/mem to verify >> that the contents of the syscall-returned physical address match the >> contents of the virtual address. It works fine up to a point. Reading >> beyond byte 935321597 in /dev/mem throws a "bad address" error. Not >> sure it's relevant but I'm running on virtual box and specifying 1GB >> of RAM. Tried with 2GB of RAM and hit the same problem. >> >> Any idea why I can't read beyond the above point? >> >> Thanks. >> > > Hi paddie > > Is it 32 bit system? > > If yes, it seems you are about to exceed boundary of kernel linear addres > range, which is 0-896 MiB. The upper 896-1024 MiB (1 GiB) is reserved for > dynamic mapping > > CMIIW people. > > -- > regards, > > Mulyadi Santosa > Freelance Linux trainer and consultant > > blog: the-hydra.blogspot.com > training: mulyaditraining.blogspot.com > > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies at kernelnewbies.org > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Error reading /dev/mem 2016-10-03 10:00 ` Paddie O'Brien @ 2016-10-10 6:55 ` Mulyadi Santosa 0 siblings, 0 replies; 5+ messages in thread From: Mulyadi Santosa @ 2016-10-10 6:55 UTC (permalink / raw) To: kernelnewbies On Mon, Oct 3, 2016 at 5:00 PM, Paddie O'Brien <paddieobrien@gmail.com> wrote: > It is a 32-bit system. > > I have a C program that puts a number in a variable. I then retrieve > the physical address of that variable using a system call I added to > the kernel. I next seek to that address in /dev/mem and verify that > what I find there matches the contents of the variable in my program. > All works fine i.e. the values match up except when the physical > address returned by the syscall is greater than 935321597. For lower > physical addresses there is no error. Once above the threshold I get a > "bad address" error when attempting the read from /dev/mem after > seeking to the appropriate location. > > If I specify 512MB of physical memory on the VM then the problem goes > away since the physical address returned never exceeds the threshold. > > So what you are suggesting is that there is a subrange of physical > addresses from which it is illegal to read in /dev/mem? > > Thanks. > > On 1 October 2016 at 18:45, Mulyadi Santosa <mulyadi.santosa@gmail.com> > wrote: > > > > > > On Wed, Sep 28, 2016 at 2:49 AM, Paddie O'Brien <paddieobrien@gmail.com> > > wrote: > >> > >> Hi, > >> > >> I have a system call that maps virtual to physical addresses. I have > >> disabled CONFIG_STRICT_DEVMEM and am reading from /dev/mem to verify > >> that the contents of the syscall-returned physical address match the > >> contents of the virtual address. It works fine up to a point. Reading > >> beyond byte 935321597 in /dev/mem throws a "bad address" error. Not > >> sure it's relevant but I'm running on virtual box and specifying 1GB > >> of RAM. Tried with 2GB of RAM and hit the same problem. > >> > >> Any idea why I can't read beyond the above point? > >> > >> Thanks. > >> > > > > Hi paddie > > > > Is it 32 bit system? > > > > If yes, it seems you are about to exceed boundary of kernel linear addres > > range, which is 0-896 MiB. The upper 896-1024 MiB (1 GiB) is reserved for > > dynamic mapping > > > > CMIIW people. > > > > -- > > regards, > > > > Mulyadi Santosa > > Freelance Linux trainer and consultant > > > > blog: the-hydra.blogspot.com > > training: mulyaditraining.blogspot.com > > > > _______________________________________________ > > Kernelnewbies mailing list > > Kernelnewbies at kernelnewbies.org > > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > > > Dear Paddie Please don't top post, it's the core rules here :) Anyway, there is no such thing as boundary, but more like what is mapped and what is not and who occupies it. As other poster also said, other than my previous mentioned 896 MB mapping boundary, check /proc/iomem, maybe you hit I/O mapped region -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20161010/9729f1b3/attachment.html ^ permalink raw reply [flat|nested] 5+ messages in thread
* Error reading /dev/mem 2016-09-27 19:49 Error reading /dev/mem Paddie O'Brien 2016-10-01 17:45 ` Mulyadi Santosa @ 2016-10-03 13:00 ` Arun Sudhilal 1 sibling, 0 replies; 5+ messages in thread From: Arun Sudhilal @ 2016-10-03 13:00 UTC (permalink / raw) To: kernelnewbies Hello Paddie, On Wed, Sep 28, 2016 at 1:19 AM, Paddie O'Brien <paddieobrien@gmail.com> wrote: > Hi, > > I have a system call that maps virtual to physical addresses. I have > disabled CONFIG_STRICT_DEVMEM and am reading from /dev/mem to verify > that the contents of the syscall-returned physical address match the > contents of the virtual address. It works fine up to a point. Reading > beyond byte 935321597 in /dev/mem throws a "bad address" error. Not > sure it's relevant but I'm running on virtual box and specifying 1GB > of RAM. Tried with 2GB of RAM and hit the same problem. > > Any idea why I can't read beyond the above point? Can you send the output to cat /proc/iomem? > > Thanks. > > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies at kernelnewbies.org > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-10-10 6:55 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-09-27 19:49 Error reading /dev/mem Paddie O'Brien 2016-10-01 17:45 ` Mulyadi Santosa 2016-10-03 10:00 ` Paddie O'Brien 2016-10-10 6:55 ` Mulyadi Santosa 2016-10-03 13:00 ` Arun Sudhilal
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).