machine/param.h Leak of non-standard methods to Application Space

Joel Sherrill joel at rtems.org
Wed Oct 17 15:04:42 UTC 2018


Hi

We are updating the port of a large third party framework and ran
into an issue where what I would think are BSD kernel methods
leak into application space. All but one of the methods is used
by rtems-libbsd code.

I think the following in <machine/param.h> needs to be protected by
an _KERNEL ifdef.

Does that sound OK?

============================
/*
 * Mach derived conversion macros
 */
#define round_page(x)           (((unsigned long)(x) + PAGE_MASK) &
~PAGE_MASK)
#define trunc_page(x)           ((unsigned long)(x) & ~PAGE_MASK)

#define atop(x)                 ((unsigned long)(x) >> PAGE_SHIFT)
#define ptoa(x)                 ((unsigned long)(x) << PAGE_SHIFT)

#define pgtok(x)                ((unsigned long)(x) * (PAGE_SIZE / 1024))
============================

--joel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20181017/d956657b/attachment.html>


More information about the devel mailing list