The "asm/unistd.h" file may not be in the top-level /usr/include tree
on multi-arch capable distributions (Debian, Ubuntu). Instead of
hard-coding the path, use gcc's internal path resolution to find the
include file.

Signed-off-by: Kees Cook <[email protected]>
---
Index: libseccomp-1.0.1/tools/sys_resolver
===================================================================
--- libseccomp-1.0.1.orig/tools/sys_resolver    2012-11-12 13:36:58.000000000 
-0800
+++ libseccomp-1.0.1/tools/sys_resolver 2013-01-23 13:48:14.996626944 -0800
@@ -21,8 +21,6 @@
 # along with this library; if not, see <http://www.gnu.org/licenses>.
 #
 
-syscall_h="/usr/include/asm/unistd.h"
-
 ####
 # functions
 
@@ -50,7 +48,8 @@
 fi
 
 # inspect the syscall header file and do the resolution
-sys_def="$(gcc $CFLAGS -E -dM "$syscall_h" | grep " __NR_$1 ")"
+sys_def="$(echo '#include <asm/unistd.h>' | \
+          gcc $CFLAGS -E -dM - | grep " __NR_$1 ")"
 if [[ -n "$sys_def" ]]; then
        if [[ $sys_def =~ .*__NR_[a-zA-Z_]+" "*\+" "*[0-9]+ ]]; then
                # the value is calculated using an offset from another syscall

-- 
Kees Cook
Chrome OS Security

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
libseccomp-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libseccomp-discuss

Reply via email to