how to suppress mmap warning in /var/log/messages

I have an application that needs to map several ranges of physical memory at an offset in order to talk to some RAID controllers. (It is a x86_64 type image if it makes any difference) The code works, but it gives a tainted kernel message that I wish to suppress every time it executes:
mmap(NULL,256,PROT_READ|PROT_WRITE,MAP_SHARED,handle,portPhysOffset);

I'm not up on setting a parameter at boot time so the targeted kernel can get this message suppressed before the code is invoked. How would I do it?

Depending on how many cards / ports there are multiple ports will be mapped. I want to play nice and just block out the specific areas I need, but don't mind taking the easy way out and trying to suppress reporting for a few MB to cover all the bases.

Thanks, but I don't have luxury of being able to modify the kernel. One thing that is necessary, the software needs to look at several memory locations in order to determine the correct offset, which is a function of how many controllers are in the system.

Is there a way to probe the memory w/o creating the message? (The port->memPhys changes within a loop)

perhaps. You could try mmap of entire pages for instance. See the Linux code below - you have to craft your mmap() call to pass the test.
Otherwise the mmap() doesn't work so you are looking at bogus data anyway. Pages are 4096 bytes usually AFAIK

Thanks, yes, I know it gets the actual pagesize anyway, which doesn't even have to be 4096, just hardcoded the example for sake of brevity. Glad you threw that in there however. Nice to have you looking out for such things.

Got a problem. How in the heck do I do the headers, so I can compile? The app runs in user space, not kernel space. I found the vm_area_struct in
/usr/src/linux-headers-2.6-xxxx/include/linux/mm.h

But it is just not as simple as adding -I/usr/src/linux-headers.2.6.32-24/include as one of the gcc options, and I suspect I'll have more headaches with pci_resource_len when it comes to linknig.

Is there a way to see if I can see if the mmap() call will work some other way before invoking it with different parameters first, to prevent me from attempting something that won't work and put the message in the /var/log/messages file?

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

In general you will get errors when including headers from kernel source directly. Some of these headers appear in "sanitised" form in /usr/include/linux - mm.h is not one of them but you may be able to apply the process to it.
At 2.6.33.4, the structure is actually defined in mm_types.h - you don't need to define __KERNEL__ to use it

What I would try:
In one window, step through your code with gdb
in another window, tail -f /var/log/messages or some better log (see below)
You should find that each log message corresponds with a particular source line, especially if you force synchronous logging. Carefully consider the source lines thus exposed

# From my /etc/syslog:
# Everything is logged here.
*.debug -/var/log/debug
# Remove the minus sign for your test. It causes buffered logging, so messages can be delayed.
# Reinstate it afterwards if you like - otherwise it can cause excessive disk thrashing

It does work, I want to see how to suppress this message w/o building a new kernel. After digging, the message is there not because the address is no good, or at the wrong offset, but because the mapping creates a security hole.

Any way to suppress it with echoing something to one of the modules, or routing 100% of the kernel warning messages into the bitbucket? If there is no way to do it other than rebuild the kernel, so be it. I was hoping that there was a mechanism to suppress specific mapping warnings and thought earlier that root cause was programmer error.

Featured Post

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…

Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…