diff options
Diffstat (limited to 'patches/fakeroot-1.29/0002-Fix-prototype-generation-for-openat.patch')
-rw-r--r-- | patches/fakeroot-1.29/0002-Fix-prototype-generation-for-openat.patch | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/patches/fakeroot-1.29/0002-Fix-prototype-generation-for-openat.patch b/patches/fakeroot-1.29/0002-Fix-prototype-generation-for-openat.patch new file mode 100644 index 000000000..3e091379d --- /dev/null +++ b/patches/fakeroot-1.29/0002-Fix-prototype-generation-for-openat.patch @@ -0,0 +1,70 @@ +From: Christian Melki <christian.melki@t2data.com> +Date: Wed, 11 May 2022 10:25:59 +0200 +Subject: [PATCH] Fix prototype generation for openat + +Patch by: Christoph Biedl <debian.axhn@manchmal.in-ulm.de> +Bug-Debian: https://bugs.debian.org/995393 + +As jrtc27 pointed out in IRC, ppc64el is more strict than other +architectures when it comes to va_arg handling: + + it's that ppc64le uses the elfv2 abi, and for variadic calls you + must reserve space for a parameter save area + +So enhance wrapawk to create a proper prototype and argument +handling although it's specific to the openat call. Also add the +missing documentation for the sixth column to wrapfunc.inp. + +Signed-off-by: Christian Melki <christian.melki@t2data.com> +--- + wrapawk | 20 +++++++++++++++++++- + wrapfunc.inp | 4 +++- + 2 files changed, 22 insertions(+), 2 deletions(-) + +diff --git a/wrapawk b/wrapawk +index a2fd220a6fcb..9b2c285c257b 100644 +--- a/wrapawk ++++ b/wrapawk +@@ -37,7 +37,25 @@ BEGIN{ + argtype=$3; + argname=$4; + MACRO=$5; +- if(MACRO){ ++ openat_extra=$6; ++ if(openat_extra){ ++ print " {(void(*))&next_" name ", \"" name "\"}," > structfile; ++ print "extern " ret " (*next_" name ")" openat_extra ";" > headerfile; ++ print ret " (*next_" name ")" openat_extra "=tmp_" name ";"> deffile; ++ ++ print ret " tmp_" name, openat_extra "{" > tmpffile; ++ print " mode_t mode = 0;" > tmpffile; ++ print " if (flags & O_CREAT) {" > tmpffile; ++ print " va_list args;" > tmpffile; ++ print " va_start(args, flags);" > tmpffile; ++ print " mode = va_arg(args, int);" > tmpffile; ++ print " va_end(args);" > tmpffile; ++ print " }" > tmpffile; ++ print " load_library_symbols();" > tmpffile; ++ print " return next_" name, argname ";" > tmpffile; ++ print "}" > tmpffile; ++ print "" > tmpffile; ++ } else if(MACRO){ + print " {(void(*))&NEXT_" MACRO "_NOARG, " name "_QUOTE}," > structfile; + print "extern " ret " (*NEXT_" MACRO "_NOARG)" argtype ";" > headerfile; + print ret " (*NEXT_" MACRO "_NOARG)" argtype "=TMP_" MACRO ";"> deffile; +diff --git a/wrapfunc.inp b/wrapfunc.inp +index 556af34579b0..f5bd4063152c 100644 +--- a/wrapfunc.inp ++++ b/wrapfunc.inp +@@ -9,8 +9,10 @@ + /**/ */ + /* each line of this file lists 4 fields, seperated by a ";". */ + /* The first field is the name of the wrapped function, then it's return */ +-/* value. After that come the function arguments with types, and the last */ ++/* value. After that come the function arguments with types, and the fifth */ + /* field contains the function arguments without types. */ ++/* A sixth field is a special needed when wrapping the openat syscall. */ ++/* Otherwise it's like the third (function arguments with types). */ + /**/ + + /* __*xstat are used on glibc systems instead of just *xstat. */ |