glibc-2.19.patch 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005
  1. diff --git a/Makeconfig b/Makeconfig
  2. index 1908f27..cf34ba1 100644
  3. --- a/Makeconfig
  4. +++ b/Makeconfig
  5. @@ -775,7 +775,8 @@ endif # $(+cflags) == ""
  6. # current directory.
  7. +includes = -I$(..)include $(if $(subdir),$(objpfx:%/=-I%)) \
  8. $(+sysdep-includes) $(includes) \
  9. - $(patsubst %/,-I%,$(..)) $(libio-include) -I. $(sysincludes)
  10. + $(patsubst %/,-I%,$(..)) $(libio-include) -I. $(sysincludes) \
  11. + -I$(common-objpfx)../shim/include
  12. # Since libio has several internal header files, we use a -I instead
  13. # of many little headers in the include directory.
  14. @@ -1033,7 +1034,7 @@ all-subdirs = csu assert ctype locale intl catgets math setjmp signal \
  15. grp pwd posix io termios resource misc socket sysvipc gmon \
  16. gnulib iconv iconvdata wctype manual shadow gshadow po argp \
  17. crypt localedata timezone rt conform debug \
  18. - $(add-on-subdirs) dlfcn elf
  19. + $(add-on-subdirs) dlfcn elf libos
  20. ifndef avoid-generated
  21. # sysd-sorted itself will contain rules making the sysd-sorted target
  22. diff --git a/Makefile b/Makefile
  23. index 51d4690..d72c4b0 100644
  24. --- a/Makefile
  25. +++ b/Makefile
  26. @@ -177,6 +177,8 @@ $(inst_includedir)/gnu/stubs.h: $(+force)
  27. install-others-nosubdir: $(installed-stubs)
  28. endif
  29. +# For Graphene
  30. +CFLAGS-syscalldb.c = -fPIC
  31. # Since stubs.h is never needed when building the library, we simplify the
  32. # hairy installation process by producing it in place only as the last part
  33. diff --git a/Versions.def b/Versions.def
  34. index 759c754..e1a270e 100644
  35. --- a/Versions.def
  36. +++ b/Versions.def
  37. @@ -41,6 +41,7 @@ libc {
  38. GCC_3.0
  39. %endif
  40. GLIBC_PRIVATE
  41. + SHIM
  42. }
  43. libcrypt {
  44. GLIBC_2.0
  45. @@ -50,6 +51,7 @@ libdl {
  46. GLIBC_2.1
  47. GLIBC_2.3.3
  48. GLIBC_2.3.4
  49. + SHIM
  50. }
  51. libm {
  52. GLIBC_2.0
  53. @@ -108,6 +110,7 @@ libpthread {
  54. GLIBC_2.18
  55. GLIBC_2.19
  56. GLIBC_PRIVATE
  57. + SHIM
  58. }
  59. libresolv {
  60. GLIBC_2.0
  61. @@ -135,6 +138,7 @@ ld {
  62. GLIBC_2.3
  63. GLIBC_2.4
  64. GLIBC_PRIVATE
  65. + SHIM
  66. }
  67. libthread_db {
  68. GLIBC_2.1.3
  69. @@ -148,3 +152,6 @@ libanl {
  70. libcidn {
  71. GLIBC_PRIVATE
  72. }
  73. +liblibos {
  74. + GLIBC_2.12
  75. +}
  76. diff --git a/configure b/configure
  77. index fc023d0..b71c1f9 100755
  78. --- a/configure
  79. +++ b/configure
  80. @@ -630,7 +630,8 @@ SED
  81. MAKEINFO
  82. MSGFMT
  83. MAKE
  84. -LD
  85. +LD_GOLD
  86. +LD_BFD
  87. AS
  88. OBJCOPY
  89. OBJDUMP
  90. @@ -4593,17 +4594,22 @@ if test $ac_verc_fail = yes; then
  91. AS=: critic_missing="$critic_missing as"
  92. fi
  93. -for ac_prog in $LD
  94. +LD_BFD=
  95. +LD_GOLD=
  96. +ld_is_gold="`$LD --version | sed -n 's/^GNU \(gold\).*$/\1/p'`"
  97. +if test -z "$ld_is_gold"; then
  98. + LD_BFD=$LD
  99. + for ac_prog in $LD_BFD
  100. do
  101. # Extract the first word of "$ac_prog", so it can be a program name with args.
  102. set dummy $ac_prog; ac_word=$2
  103. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  104. $as_echo_n "checking for $ac_word... " >&6; }
  105. -if ${ac_cv_prog_LD+:} false; then :
  106. +if ${ac_cv_prog_LD_BFD+:} false; then :
  107. $as_echo_n "(cached) " >&6
  108. else
  109. - if test -n "$LD"; then
  110. - ac_cv_prog_LD="$LD" # Let the user override the test.
  111. + if test -n "$LD_BFD"; then
  112. + ac_cv_prog_LD_BFD="$LD_BFD" # Let the user override the test.
  113. else
  114. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  115. for as_dir in $PATH
  116. @@ -4612,7 +4618,7 @@ do
  117. test -z "$as_dir" && as_dir=.
  118. for ac_exec_ext in '' $ac_executable_extensions; do
  119. if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
  120. - ac_cv_prog_LD="$ac_prog"
  121. + ac_cv_prog_LD_BFD="$ac_prog"
  122. $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
  123. break 2
  124. fi
  125. @@ -4622,26 +4628,26 @@ IFS=$as_save_IFS
  126. fi
  127. fi
  128. -LD=$ac_cv_prog_LD
  129. -if test -n "$LD"; then
  130. - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
  131. -$as_echo "$LD" >&6; }
  132. +LD_BFD=$ac_cv_prog_LD_BFD
  133. +if test -n "$LD_BFD"; then
  134. + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD_BFD" >&5
  135. +$as_echo "$LD_BFD" >&6; }
  136. else
  137. { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  138. $as_echo "no" >&6; }
  139. fi
  140. - test -n "$LD" && break
  141. + test -n "$LD_BFD" && break
  142. done
  143. -if test -z "$LD"; then
  144. +if test -z "$LD_BFD"; then
  145. ac_verc_fail=yes
  146. else
  147. # Found it, now check the version.
  148. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $LD" >&5
  149. -$as_echo_n "checking version of $LD... " >&6; }
  150. - ac_prog_version=`$LD --version 2>&1 | sed -n 's/^.*GNU ld.* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'`
  151. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $LD_BFD" >&5
  152. +$as_echo_n "checking version of $LD_BFD... " >&6; }
  153. + ac_prog_version=`$LD_BFD --version 2>&1 | sed -n 's/^.*GNU ld.* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'`
  154. case $ac_prog_version in
  155. '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
  156. 2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*)
  157. @@ -4653,9 +4659,80 @@ $as_echo_n "checking version of $LD... " >&6; }
  158. $as_echo "$ac_prog_version" >&6; }
  159. fi
  160. if test $ac_verc_fail = yes; then
  161. - LD=: critic_missing="$critic_missing ld"
  162. + LD_BFD=:
  163. fi
  164. +else
  165. +# Accept gold 1.11 or higher.
  166. + LD_GOLD=$LD
  167. + for ac_prog in $LD_GOLD
  168. +do
  169. + # Extract the first word of "$ac_prog", so it can be a program name with args.
  170. +set dummy $ac_prog; ac_word=$2
  171. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  172. +$as_echo_n "checking for $ac_word... " >&6; }
  173. +if ${ac_cv_prog_LD_GOLD+:} false; then :
  174. + $as_echo_n "(cached) " >&6
  175. +else
  176. + if test -n "$LD_GOLD"; then
  177. + ac_cv_prog_LD_GOLD="$LD_GOLD" # Let the user override the test.
  178. +else
  179. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  180. +for as_dir in $PATH
  181. +do
  182. + IFS=$as_save_IFS
  183. + test -z "$as_dir" && as_dir=.
  184. + for ac_exec_ext in '' $ac_executable_extensions; do
  185. + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
  186. + ac_cv_prog_LD_GOLD="$ac_prog"
  187. + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
  188. + break 2
  189. + fi
  190. +done
  191. + done
  192. +IFS=$as_save_IFS
  193. +
  194. +fi
  195. +fi
  196. +LD_GOLD=$ac_cv_prog_LD_GOLD
  197. +if test -n "$LD_GOLD"; then
  198. + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD_GOLD" >&5
  199. +$as_echo "$LD_GOLD" >&6; }
  200. +else
  201. + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  202. +$as_echo "no" >&6; }
  203. +fi
  204. +
  205. +
  206. + test -n "$LD_GOLD" && break
  207. +done
  208. +
  209. +if test -z "$LD_GOLD"; then
  210. + ac_verc_fail=yes
  211. +else
  212. + # Found it, now check the version.
  213. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $LD_GOLD" >&5
  214. +$as_echo_n "checking version of $LD_GOLD... " >&6; }
  215. + ac_prog_version=`$LD_GOLD --version 2>&1 | sed -n 's/^.*GNU gold.* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'`
  216. + case $ac_prog_version in
  217. + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
  218. + 1.1[1-9]*|1.[2-9][0-9]*|1.1[0-9][0-9]*|[2-9].*|[1-9][0-9]*)
  219. + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
  220. + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
  221. +
  222. + esac
  223. + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_prog_version" >&5
  224. +$as_echo "$ac_prog_version" >&6; }
  225. +fi
  226. +if test $ac_verc_fail = yes; then
  227. + LD_GOLD=:
  228. +fi
  229. +
  230. +fi
  231. +# Neither ld nor gold are new enough.
  232. +if test -z "$LD_BFD" && test -z "$LD_GOLD"; then
  233. + critic_missing="$critic_missing ld"
  234. +fi
  235. # These programs are version sensitive.
  236. @@ -6391,6 +6468,16 @@ $as_echo "$libc_cv_use_default_link" >&6; }
  237. use_default_link=$libc_cv_use_default_link
  238. fi
  239. +# The gold linker has no builtin default linker script,
  240. +# and the fallback of editing the builtin linker
  241. +# script is not available. Therefore if use_default_link
  242. +# is `no' then we can't use gold. This check is independent
  243. +# of gold's version and is used to sanity check that the
  244. +# linker continues to produce a useful shared link.
  245. +if test "$ld_is_gold" && test "$use_default_link" = "no"; then
  246. + as_fn_error $? "$LD did not generate a useful shared link. Try using GNU ld.bfd?" "$LINENO" 5
  247. +fi
  248. +
  249. { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker output format" >&5
  250. $as_echo_n "checking linker output format... " >&6; }
  251. if ${libc_cv_output_format+:} false; then :
  252. @@ -6409,6 +6496,17 @@ fi
  253. $as_echo "$libc_cv_output_format" >&6; }
  254. +# The gold linker has no builtin default linker script,
  255. +# and the fallback of parsing the builtin linker
  256. +# script to determine the target is not available.
  257. +# Therefore if libc_cv_output_format is `unknown' then
  258. +# we can't use gold. This check is independent of gold's
  259. +# version and is used to sanity check that the linker
  260. +# continues to support --print-output-format.
  261. +if test "$ld_is_gold" && test "$libc_cv_output_format" = "unknown"; then
  262. + as_fn_error $? "$LD did not support --print-output-format. Try using GNU ld.bfd?" "$LINENO" 5
  263. +fi
  264. +
  265. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fno-toplevel-reorder -fno-section-anchors" >&5
  266. $as_echo_n "checking for -fno-toplevel-reorder -fno-section-anchors... " >&6; }
  267. if ${libc_cv_fno_toplevel_reorder+:} false; then :
  268. diff --git a/dlfcn/Versions b/dlfcn/Versions
  269. index 97902f0..c1874c1 100644
  270. --- a/dlfcn/Versions
  271. +++ b/dlfcn/Versions
  272. @@ -14,4 +14,7 @@ libdl {
  273. GLIBC_PRIVATE {
  274. _dlfcn_hook;
  275. }
  276. + SHIM {
  277. + syscalldb;
  278. + }
  279. }
  280. diff --git a/elf/Makefile b/elf/Makefile
  281. index 4c58fc9..0ae2fa8 100644
  282. --- a/elf/Makefile
  283. +++ b/elf/Makefile
  284. @@ -21,7 +21,7 @@ subdir := elf
  285. include ../Makeconfig
  286. -headers = elf.h bits/elfclass.h link.h bits/link.h
  287. +headers = elf.h bits/elfclass.h link.h bits/link.h syscalldb.h
  288. routines = $(dl-routines) dl-support dl-iteratephdr \
  289. dl-addr enbl-secure dl-profstub \
  290. dl-origin dl-libc dl-sym dl-tsd dl-sysdep
  291. @@ -31,7 +31,8 @@ routines = $(dl-routines) dl-support dl-iteratephdr \
  292. dl-routines = $(addprefix dl-,load lookup object reloc deps hwcaps \
  293. runtime error init fini debug misc \
  294. version profile conflict tls origin scope \
  295. - execstack caller open close trampoline)
  296. + execstack caller open close trampoline) \
  297. + syscalldb syscallas
  298. ifeq (yes,$(use-ldconfig))
  299. dl-routines += dl-cache
  300. endif
  301. diff --git a/elf/Versions b/elf/Versions
  302. index 2383992..98687f6 100644
  303. --- a/elf/Versions
  304. +++ b/elf/Versions
  305. @@ -24,14 +24,15 @@ libc {
  306. _dl_sym; _dl_vsym;
  307. __libc_dlclose; __libc_dlopen_mode; __libc_dlsym;
  308. }
  309. + SHIM {
  310. + syscalldb; glibc_option;
  311. + }
  312. }
  313. ld {
  314. GLIBC_2.0 {
  315. # Function from libc.so which must be shared with libc.
  316. __libc_memalign; calloc; free; malloc; realloc;
  317. -
  318. - _r_debug;
  319. }
  320. GLIBC_2.1 {
  321. # functions used in other libraries
  322. @@ -57,9 +58,12 @@ ld {
  323. _rtld_global; _rtld_global_ro;
  324. # Only here for gdb while a better method is developed.
  325. - _dl_debug_state;
  326. + __libc_r_debug; __libc_dl_debug_state;
  327. # Pointer protection.
  328. __pointer_chk_guard;
  329. }
  330. + SHIM {
  331. + syscalldb; glibc_version; glibc_option; register_library;
  332. + }
  333. }
  334. diff --git a/elf/circleload1.c b/elf/circleload1.c
  335. index 990ff84..ccf92d3 100644
  336. --- a/elf/circleload1.c
  337. +++ b/elf/circleload1.c
  338. @@ -5,7 +5,7 @@
  339. #include <stdlib.h>
  340. #include <string.h>
  341. -#define MAPS ((struct link_map *) _r_debug.r_map)
  342. +#define MAPS ((struct link_map *) __libc_r_debug.r_map)
  343. static int
  344. check_loaded_objects (const char **loaded)
  345. diff --git a/elf/dl-close.c b/elf/dl-close.c
  346. index 5bf1de7..a887133 100644
  347. --- a/elf/dl-close.c
  348. +++ b/elf/dl-close.c
  349. @@ -473,7 +473,7 @@ _dl_close_worker (struct link_map *map)
  350. /* Notify the debugger we are about to remove some loaded objects. */
  351. struct r_debug *r = _dl_debug_initialize (0, nsid);
  352. r->r_state = RT_DELETE;
  353. - _dl_debug_state ();
  354. + __libc_dl_debug_state ();
  355. LIBC_PROBE (unmap_start, 2, nsid, r);
  356. if (unload_global)
  357. @@ -739,7 +739,7 @@ _dl_close_worker (struct link_map *map)
  358. /* Notify the debugger those objects are finalized and gone. */
  359. r->r_state = RT_CONSISTENT;
  360. - _dl_debug_state ();
  361. + __libc_dl_debug_state ();
  362. LIBC_PROBE (unmap_complete, 2, nsid, r);
  363. /* Recheck if we need to retry, release the lock. */
  364. diff --git a/elf/dl-debug.c b/elf/dl-debug.c
  365. index 4e7c593..3e0bff4 100644
  366. --- a/elf/dl-debug.c
  367. +++ b/elf/dl-debug.c
  368. @@ -34,7 +34,7 @@ extern const int verify_link_map_members[(VERIFY_MEMBER (l_addr)
  369. normally finds it via the DT_DEBUG entry in the dynamic section, but in
  370. a statically-linked program there is no dynamic section for the debugger
  371. to examine and it looks for this particular symbol name. */
  372. -struct r_debug _r_debug;
  373. +struct r_debug __libc_r_debug __attribute__((weak));
  374. /* Initialize _r_debug if it has not already been done. The argument is
  375. @@ -48,7 +48,7 @@ _dl_debug_initialize (ElfW(Addr) ldbase, Lmid_t ns)
  376. struct r_debug *r;
  377. if (ns == LM_ID_BASE)
  378. - r = &_r_debug;
  379. + r = &__libc_r_debug;
  380. else
  381. r = &GL(dl_ns)[ns]._ns_debug;
  382. @@ -56,9 +56,9 @@ _dl_debug_initialize (ElfW(Addr) ldbase, Lmid_t ns)
  383. {
  384. /* Tell the debugger where to find the map of loaded objects. */
  385. r->r_version = 1 /* R_DEBUG_VERSION XXX */;
  386. - r->r_ldbase = ldbase ?: _r_debug.r_ldbase;
  387. + r->r_ldbase = ldbase ?: __libc_r_debug.r_ldbase;
  388. r->r_map = (void *) GL(dl_ns)[ns]._ns_loaded;
  389. - r->r_brk = (ElfW(Addr)) &_dl_debug_state;
  390. + r->r_brk = (ElfW(Addr)) &__libc_dl_debug_state;
  391. }
  392. return r;
  393. @@ -70,7 +70,7 @@ _dl_debug_initialize (ElfW(Addr) ldbase, Lmid_t ns)
  394. examining the r_brk member of struct r_debug, but GDB 4.15 in fact looks
  395. for this particular symbol name in the PT_INTERP file. */
  396. void
  397. -_dl_debug_state (void)
  398. +__libc_dl_debug_state (void)
  399. {
  400. }
  401. -rtld_hidden_def (_dl_debug_state)
  402. +__attribute__((weak));
  403. diff --git a/elf/dl-load.c b/elf/dl-load.c
  404. index 1be7a3c..c560ec1 100644
  405. --- a/elf/dl-load.c
  406. +++ b/elf/dl-load.c
  407. @@ -39,6 +39,8 @@
  408. #include <dl-dst.h>
  409. +#include <glibc-version.h>
  410. +
  411. /* On some systems, no flag bits are given to specify file mapping. */
  412. #ifndef MAP_FILE
  413. # define MAP_FILE 0
  414. @@ -902,7 +904,7 @@ lose (int code, int fd, const char *name, char *realname, struct link_map *l,
  415. if (r != NULL)
  416. {
  417. r->r_state = RT_CONSISTENT;
  418. - _dl_debug_state ();
  419. + __libc_dl_debug_state ();
  420. LIBC_PROBE (map_failed, 2, nsid, r);
  421. }
  422. @@ -1048,7 +1050,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
  423. call _dl_debug_initialize in a static program in case dynamic
  424. linking has not been used before. */
  425. r->r_state = RT_ADD;
  426. - _dl_debug_state ();
  427. + __libc_dl_debug_state ();
  428. LIBC_PROBE (map_start, 2, nsid, r);
  429. make_consistent = true;
  430. }
  431. @@ -1595,6 +1597,9 @@ cannot enable executable stack as shared object requires");
  432. DL_AFTER_LOAD (l);
  433. #endif
  434. + /* register the library to SHIM */
  435. + register_library(l->l_name, l->l_addr);
  436. +
  437. /* Now that the object is fully initialized add it to the object list. */
  438. _dl_add_to_namespace_list (l, nsid);
  439. diff --git a/elf/dl-open.c b/elf/dl-open.c
  440. index a9ca6b3..829d212 100644
  441. --- a/elf/dl-open.c
  442. +++ b/elf/dl-open.c
  443. @@ -290,7 +290,7 @@ dl_open_worker (void *a)
  444. /* Notify the debugger all new objects are now ready to go. */
  445. struct r_debug *r = _dl_debug_initialize (0, args->nsid);
  446. r->r_state = RT_CONSISTENT;
  447. - _dl_debug_state ();
  448. + __libc_dl_debug_state ();
  449. LIBC_PROBE (map_complete, 3, args->nsid, r, new);
  450. /* Print scope information. */
  451. diff --git a/elf/link.h b/elf/link.h
  452. index d5905d1..f4e108a 100644
  453. --- a/elf/link.h
  454. +++ b/elf/link.h
  455. @@ -64,7 +64,7 @@ struct r_debug
  456. };
  457. /* This is the instance of that structure used by the dynamic linker. */
  458. -extern struct r_debug _r_debug;
  459. +extern struct r_debug __libc_r_debug;
  460. /* This symbol refers to the "dynamic structure" in the `.dynamic' section
  461. of whatever module refers to `_DYNAMIC'. So, to find its own
  462. diff --git a/elf/loadtest.c b/elf/loadtest.c
  463. index 727469b..568ddef 100644
  464. --- a/elf/loadtest.c
  465. +++ b/elf/loadtest.c
  466. @@ -70,7 +70,7 @@ static const struct
  467. #include <include/link.h>
  468. -#define MAPS ((struct link_map *) _r_debug.r_map)
  469. +#define MAPS ((struct link_map *) __libc_r_debug.r_map)
  470. #define OUT \
  471. for (map = MAPS; map != NULL; map = map->l_next) \
  472. diff --git a/elf/neededtest.c b/elf/neededtest.c
  473. index 3cea499..e098d48 100644
  474. --- a/elf/neededtest.c
  475. +++ b/elf/neededtest.c
  476. @@ -5,7 +5,7 @@
  477. #include <stdlib.h>
  478. #include <string.h>
  479. -#define MAPS ((struct link_map *) _r_debug.r_map)
  480. +#define MAPS ((struct link_map *) __libc_r_debug.r_map)
  481. static int
  482. check_loaded_objects (const char **loaded)
  483. diff --git a/elf/neededtest2.c b/elf/neededtest2.c
  484. index 17c75f2..5a73a95 100644
  485. --- a/elf/neededtest2.c
  486. +++ b/elf/neededtest2.c
  487. @@ -5,7 +5,7 @@
  488. #include <stdlib.h>
  489. #include <string.h>
  490. -#define MAPS ((struct link_map *) _r_debug.r_map)
  491. +#define MAPS ((struct link_map *) __libc_r_debug.r_map)
  492. static int
  493. check_loaded_objects (const char **loaded)
  494. diff --git a/elf/neededtest3.c b/elf/neededtest3.c
  495. index 41970cf..5126615 100644
  496. --- a/elf/neededtest3.c
  497. +++ b/elf/neededtest3.c
  498. @@ -5,7 +5,7 @@
  499. #include <stdlib.h>
  500. #include <string.h>
  501. -#define MAPS ((struct link_map *) _r_debug.r_map)
  502. +#define MAPS ((struct link_map *) __libc_r_debug.r_map)
  503. static int
  504. check_loaded_objects (const char **loaded)
  505. diff --git a/elf/neededtest4.c b/elf/neededtest4.c
  506. index 0ae0b7f..f883910 100644
  507. --- a/elf/neededtest4.c
  508. +++ b/elf/neededtest4.c
  509. @@ -5,7 +5,7 @@
  510. #include <stdlib.h>
  511. #include <string.h>
  512. -#define MAPS ((struct link_map *) _r_debug.r_map)
  513. +#define MAPS ((struct link_map *) __libc_r_debug.r_map)
  514. static int
  515. check_loaded_objects (const char **loaded)
  516. diff --git a/elf/rtld.c b/elf/rtld.c
  517. index 6dcbabc..c87c773 100644
  518. --- a/elf/rtld.c
  519. +++ b/elf/rtld.c
  520. @@ -356,6 +356,23 @@ _dl_start_final (void *arg, struct dl_start_final_info *info)
  521. return start_addr;
  522. }
  523. +/* For graphene, check if glibc version match to the compatible SHIM
  524. + library. If not, tell the user to update glibc. */
  525. +#include "glibc-version.h"
  526. +
  527. +volatile const int glibc_version __attribute__((weak)) = GLIBC_VERSION;
  528. +
  529. +static void __attribute__((noinline,optimize("-O0")))
  530. +check_glibc_version (void)
  531. +{
  532. + if (glibc_version != GLIBC_VERSION)
  533. + {
  534. + _dl_fatal_printf ("Warning from Graphene: "
  535. + "Glibc version is incorrect. Please rebuild Glibc.\n");
  536. + _exit (1);
  537. + }
  538. +}
  539. +
  540. static ElfW(Addr) __attribute_used__ internal_function
  541. _dl_start (void *arg)
  542. {
  543. @@ -546,6 +563,9 @@ _dl_start (void *arg)
  544. therefore need not test whether we have to allocate the array
  545. for the relocation results (as done in dl-reloc.c). */
  546. + /* For Graphene, check if the glibc version is correct. */
  547. + check_glibc_version();
  548. +
  549. /* Now life is sane; we can call functions and access global data.
  550. Set up to use the operating system facilities, and find out from
  551. the operating system's program loader where to find the program
  552. @@ -1233,9 +1253,20 @@ of this helper program; chances are you did not intend to run this program.\n\
  553. main_map->l_map_end = allocend;
  554. if ((ph->p_flags & PF_X) && allocend > main_map->l_text_end)
  555. main_map->l_text_end = allocend;
  556. +
  557. +#if 0
  558. + ElfW(Addr) mapend = (allocend + GLRO(dl_pagesize) - 1)
  559. + & ~(GLRO(dl_pagesize) - 1);
  560. + int prot = ((ph->p_flags & PF_R) ? PROT_READ : 0)|
  561. + ((ph->p_flags & PF_W) ? PROT_WRITE : 0)|
  562. + ((ph->p_flags & PF_X) ? PROT_EXEC : 0);
  563. + __mmap ((void *) mapstart, mapend - mapstart,
  564. + prot,
  565. + MAP_ANON|MAP_PRIVATE|MAP_FIXED|0x20000000,
  566. + -1, 0);
  567. +#endif
  568. }
  569. break;
  570. -
  571. case PT_TLS:
  572. if (ph->p_memsz > 0)
  573. {
  574. @@ -1381,13 +1412,31 @@ of this helper program; chances are you did not intend to run this program.\n\
  575. /* PT_GNU_RELRO is usually the last phdr. */
  576. size_t cnt = rtld_ehdr->e_phnum;
  577. while (cnt-- > 0)
  578. + {
  579. if (rtld_phdr[cnt].p_type == PT_GNU_RELRO)
  580. {
  581. GL(dl_rtld_map).l_relro_addr = rtld_phdr[cnt].p_vaddr;
  582. GL(dl_rtld_map).l_relro_size = rtld_phdr[cnt].p_memsz;
  583. - break;
  584. }
  585. +#if 0
  586. + if (rtld_phdr[cnt].p_type == PT_LOAD)
  587. + {
  588. + ElfW(Addr) mapstart = rtld_phdr[cnt].p_vaddr & ~(GLRO(dl_pagesize) - 1);
  589. + ElfW(Addr) mapend = (rtld_phdr[cnt].p_vaddr + rtld_phdr[cnt].p_memsz
  590. + + GLRO(dl_pagesize) - 1)
  591. + & ~(GLRO(dl_pagesize) - 1);
  592. + int prot = ((rtld_phdr[cnt].p_flags & PF_R) ? PROT_READ : 0)|
  593. + ((rtld_phdr[cnt].p_flags & PF_W) ? PROT_WRITE : 0)|
  594. + ((rtld_phdr[cnt].p_flags & PF_X) ? PROT_EXEC : 0);
  595. + __mmap ((void *) mapstart, mapend - mapstart,
  596. + prot,
  597. + MAP_ANON|MAP_PRIVATE|MAP_FIXED|0x20000000,
  598. + -1, 0);
  599. + }
  600. +#endif
  601. + }
  602. +
  603. /* Add the dynamic linker to the TLS list if it also uses TLS. */
  604. if (GL(dl_rtld_map).l_tls_blocksize != 0)
  605. /* Assign a module ID. Do this before loading any audit modules. */
  606. @@ -1588,7 +1637,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
  607. /* We start adding objects. */
  608. r->r_state = RT_ADD;
  609. - _dl_debug_state ();
  610. + __libc_dl_debug_state ();
  611. LIBC_PROBE (init_start, 2, LM_ID_BASE, r);
  612. /* Auditing checkpoint: we are ready to signal that the initial map
  613. @@ -1636,89 +1654,6 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
  614. }
  615. }
  616. - /* There usually is no ld.so.preload file, it should only be used
  617. - for emergencies and testing. So the open call etc should usually
  618. - fail. Using access() on a non-existing file is faster than using
  619. - open(). So we do this first. If it succeeds we do almost twice
  620. - the work but this does not matter, since it is not for production
  621. - use. */
  622. - static const char preload_file[] = "/etc/ld.so.preload";
  623. - if (__builtin_expect (__access (preload_file, R_OK) == 0, 0))
  624. - {
  625. - /* Read the contents of the file. */
  626. - file = _dl_sysdep_read_whole_file (preload_file, &file_size,
  627. - PROT_READ | PROT_WRITE);
  628. - if (__builtin_expect (file != MAP_FAILED, 0))
  629. - {
  630. - /* Parse the file. It contains names of libraries to be loaded,
  631. - separated by white spaces or `:'. It may also contain
  632. - comments introduced by `#'. */
  633. - char *problem;
  634. - char *runp;
  635. - size_t rest;
  636. -
  637. - /* Eliminate comments. */
  638. - runp = file;
  639. - rest = file_size;
  640. - while (rest > 0)
  641. - {
  642. - char *comment = memchr (runp, '#', rest);
  643. - if (comment == NULL)
  644. - break;
  645. -
  646. - rest -= comment - runp;
  647. - do
  648. - *comment = ' ';
  649. - while (--rest > 0 && *++comment != '\n');
  650. - }
  651. -
  652. - /* We have one problematic case: if we have a name at the end of
  653. - the file without a trailing terminating characters, we cannot
  654. - place the \0. Handle the case separately. */
  655. - if (file[file_size - 1] != ' ' && file[file_size - 1] != '\t'
  656. - && file[file_size - 1] != '\n' && file[file_size - 1] != ':')
  657. - {
  658. - problem = &file[file_size];
  659. - while (problem > file && problem[-1] != ' '
  660. - && problem[-1] != '\t'
  661. - && problem[-1] != '\n' && problem[-1] != ':')
  662. - --problem;
  663. -
  664. - if (problem > file)
  665. - problem[-1] = '\0';
  666. - }
  667. - else
  668. - {
  669. - problem = NULL;
  670. - file[file_size - 1] = '\0';
  671. - }
  672. -
  673. - HP_TIMING_NOW (start);
  674. -
  675. - if (file != problem)
  676. - {
  677. - char *p;
  678. - runp = file;
  679. - while ((p = strsep (&runp, ": \t\n")) != NULL)
  680. - if (p[0] != '\0')
  681. - npreloads += do_preload (p, main_map, preload_file);
  682. - }
  683. -
  684. - if (problem != NULL)
  685. - {
  686. - char *p = strndupa (problem, file_size - (problem - file));
  687. -
  688. - npreloads += do_preload (p, main_map, preload_file);
  689. - }
  690. -
  691. - HP_TIMING_NOW (stop);
  692. - HP_TIMING_DIFF (diff, start, stop);
  693. - HP_TIMING_ACCUM_NT (load_time, diff);
  694. -
  695. - /* We don't need the file anymore. */
  696. - __munmap (file, file_size);
  697. - }
  698. - }
  699. if (__builtin_expect (*first_preload != NULL, 0))
  700. {
  701. @@ -2301,7 +2221,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
  702. the address since by now the variable might be in another object. */
  703. r = _dl_debug_initialize (0, LM_ID_BASE);
  704. r->r_state = RT_CONSISTENT;
  705. - _dl_debug_state ();
  706. + __libc_dl_debug_state ();
  707. LIBC_PROBE (init_complete, 2, LM_ID_BASE, r);
  708. #if defined USE_LDCONFIG && !defined MAP_COPY
  709. diff --git a/elf/unload.c b/elf/unload.c
  710. index 4566f22..73046de 100644
  711. --- a/elf/unload.c
  712. +++ b/elf/unload.c
  713. @@ -9,7 +9,7 @@
  714. #include <stdio.h>
  715. #include <stdlib.h>
  716. -#define MAPS ((struct link_map *) _r_debug.r_map)
  717. +#define MAPS ((struct link_map *) __libc_r_debug.r_map)
  718. #define OUT \
  719. for (map = MAPS; map != NULL; map = map->l_next) \
  720. diff --git a/elf/unload2.c b/elf/unload2.c
  721. index eef2bfd..a21d2ac 100644
  722. --- a/elf/unload2.c
  723. +++ b/elf/unload2.c
  724. @@ -6,7 +6,7 @@
  725. #include <stdio.h>
  726. #include <stdlib.h>
  727. -#define MAPS ((struct link_map *) _r_debug.r_map)
  728. +#define MAPS ((struct link_map *) __libc_r_debug.r_map)
  729. #define OUT \
  730. for (map = MAPS; map != NULL; map = map->l_next) \
  731. diff --git a/malloc/arena.c b/malloc/arena.c
  732. index 5088a25..33a3879 100644
  733. --- a/malloc/arena.c
  734. +++ b/malloc/arena.c
  735. @@ -21,6 +21,27 @@
  736. /* Compile-time constants. */
  737. +#ifndef HEAP_MAX_SIZE
  738. +# ifdef DEFAULT_MMAP_THRESHOLD_MAX
  739. +# define DEFAULT_HEAP_MAX_SIZE (2 * DEFAULT_MMAP_THRESHOLD_MAX)
  740. +# else
  741. +# define DEFAULT_HEAP_MAX_SIZE (1024 * 1024) /* must be a power of two */
  742. +# endif
  743. +# include <sysdep.h>
  744. +static long int heap_max_size = 0;
  745. +# define HEAP_MAX_SIZE \
  746. + ({ \
  747. + if (!heap_max_size) { \
  748. + long int size = glibc_option("heap_size"); \
  749. + if (size > 0) \
  750. + heap_max_size = size; \
  751. + else \
  752. + heap_max_size = DEFAULT_HEAP_MAX_SIZE; \
  753. + } \
  754. + heap_max_size; \
  755. + })
  756. +#endif
  757. +
  758. #define HEAP_MIN_SIZE (32 * 1024)
  759. #ifndef HEAP_MAX_SIZE
  760. # ifdef DEFAULT_MMAP_THRESHOLD_MAX
  761. @@ -545,17 +566,6 @@ new_heap (size_t size, size_t top_pad)
  762. mapping (on Linux, this is the case for all non-writable mappings
  763. anyway). */
  764. p2 = MAP_FAILED;
  765. - if (aligned_heap_area)
  766. - {
  767. - p2 = (char *) MMAP (aligned_heap_area, HEAP_MAX_SIZE, PROT_NONE,
  768. - MAP_NORESERVE);
  769. - aligned_heap_area = NULL;
  770. - if (p2 != MAP_FAILED && ((unsigned long) p2 & (HEAP_MAX_SIZE - 1)))
  771. - {
  772. - __munmap (p2, HEAP_MAX_SIZE);
  773. - p2 = MAP_FAILED;
  774. - }
  775. - }
  776. if (p2 == MAP_FAILED)
  777. {
  778. p1 = (char *) MMAP (0, HEAP_MAX_SIZE << 1, PROT_NONE, MAP_NORESERVE);
  779. @@ -566,8 +576,6 @@ new_heap (size_t size, size_t top_pad)
  780. ul = p2 - p1;
  781. if (ul)
  782. __munmap (p1, ul);
  783. - else
  784. - aligned_heap_area = p2 + HEAP_MAX_SIZE;
  785. __munmap (p2 + HEAP_MAX_SIZE, HEAP_MAX_SIZE - ul);
  786. }
  787. else
  788. diff --git a/nptl/Makefile b/nptl/Makefile
  789. index 57cc8c6..81f1bf4 100644
  790. --- a/nptl/Makefile
  791. +++ b/nptl/Makefile
  792. @@ -20,7 +20,7 @@
  793. #
  794. subdir := nptl
  795. -headers := pthread.h semaphore.h bits/semaphore.h
  796. +headers := pthread.h semaphore.h bits/semaphore.h syscalldb.h
  797. extra-libs := libpthread
  798. extra-libs-others := $(extra-libs)
  799. diff --git a/nptl/Versions b/nptl/Versions
  800. index bb11277..354149a 100644
  801. --- a/nptl/Versions
  802. +++ b/nptl/Versions
  803. @@ -31,6 +31,9 @@ libc {
  804. # Internal libc interface to libpthread
  805. __libc_dl_error_tsd;
  806. }
  807. + SHIM {
  808. + syscalldb; glibc_option;
  809. + }
  810. }
  811. libpthread {
  812. @@ -262,4 +265,8 @@ libpthread {
  813. __pthread_clock_gettime; __pthread_clock_settime;
  814. __pthread_unwind; __pthread_get_minstack;
  815. }
  816. +
  817. + SHIM {
  818. + syscalldb; glibc_option;
  819. + }
  820. }
  821. diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
  822. index 9d7f52f..72d50ae 100644
  823. --- a/nptl/pthread_create.c
  824. +++ b/nptl/pthread_create.c
  825. @@ -405,8 +405,11 @@ start_thread (void *arg)
  826. # error "to do"
  827. #endif
  828. assert (freesize < pd->stackblock_size);
  829. + /* XXX: may not be necessary */
  830. +#if 0
  831. if (freesize > PTHREAD_STACK_MIN)
  832. __madvise (pd->stackblock, freesize - PTHREAD_STACK_MIN, MADV_DONTNEED);
  833. +#endif
  834. /* If the thread is detached free the TCB. */
  835. if (IS_DETACHED (pd))
  836. diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S b/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S
  837. index 89fda5e..f6963f6 100644
  838. --- a/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S
  839. +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S
  840. @@ -111,7 +111,8 @@ ENTRY(__pthread_disable_asynccancel)
  841. xorq %r10, %r10
  842. addq $CANCELHANDLING, %rdi
  843. LOAD_PRIVATE_FUTEX_WAIT (%esi)
  844. - syscall
  845. + SYSCALLDB
  846. +
  847. movl %fs:CANCELHANDLING, %eax
  848. jmp 3b
  849. END(__pthread_disable_asynccancel)
  850. diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/fork.c b/nptl/sysdeps/unix/sysv/linux/x86_64/fork.c
  851. index a036b92..40a1eaf 100644
  852. --- a/nptl/sysdeps/unix/sysv/linux/x86_64/fork.c
  853. +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/fork.c
  854. @@ -21,10 +21,20 @@
  855. #include <sysdep.h>
  856. #include <tls.h>
  857. -
  858. -#define ARCH_FORK() \
  859. +/* In Graphene, we prefer to call fork system call directly than clone */
  860. +#if USE_clone_FOR_fork
  861. +# define ARCH_FORK() \
  862. INLINE_SYSCALL (clone, 4, \
  863. CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID | SIGCHLD, 0, \
  864. NULL, &THREAD_SELF->tid)
  865. +#else
  866. +# define ARCH_FORK() \
  867. + ({ unsigned long ret = INLINE_SYSCALL (fork, 0); \
  868. + if (!ret) { \
  869. + pid_t pid = INLINE_SYSCALL (getpid, 0); \
  870. + THREAD_SETMEM (THREAD_SELF, pid, pid); \
  871. + THREAD_SETMEM (THREAD_SELF, tid, pid); \
  872. + } ret; })
  873. +#endif
  874. #include "../fork.c"
  875. diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
  876. index f2dca07..0ce7c67 100644
  877. --- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
  878. +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
  879. @@ -90,7 +90,7 @@ __lll_lock_wait_private:
  880. 1: LIBC_PROBE (lll_lock_wait_private, 1, %rdi)
  881. movl $SYS_futex, %eax
  882. - syscall
  883. + SYSCALLDB
  884. 2: movl %edx, %eax
  885. xchgl %eax, (%rdi) /* NB: lock is implied */
  886. @@ -130,7 +130,7 @@ __lll_lock_wait:
  887. 1: LIBC_PROBE (lll_lock_wait, 2, %rdi, %rsi)
  888. movl $SYS_futex, %eax
  889. - syscall
  890. + SYSCALLDB
  891. 2: movl %edx, %eax
  892. xchgl %eax, (%rdi) /* NB: lock is implied */
  893. @@ -185,7 +185,7 @@ __lll_timedlock_wait:
  894. 1: movl $SYS_futex, %eax
  895. movl $2, %edx
  896. - syscall
  897. + SYSCALLDB
  898. 2: xchgl %edx, (%rdi) /* NB: lock is implied */
  899. @@ -279,7 +279,7 @@ __lll_timedlock_wait:
  900. LOAD_FUTEX_WAIT (%esi)
  901. movq %r12, %rdi
  902. movl $SYS_futex, %eax
  903. - syscall
  904. + SYSCALLDB
  905. /* NB: %edx == 2 */
  906. xchgl %edx, (%r12)
  907. @@ -336,7 +336,7 @@ __lll_unlock_wake_private:
  908. LOAD_PRIVATE_FUTEX_WAKE (%esi)
  909. movl $1, %edx /* Wake one thread. */
  910. movl $SYS_futex, %eax
  911. - syscall
  912. + SYSCALLDB
  913. popq %rdx
  914. cfi_adjust_cfa_offset(-8)
  915. @@ -366,7 +366,7 @@ __lll_unlock_wake:
  916. LOAD_FUTEX_WAKE (%esi)
  917. movl $1, %edx /* Wake one thread. */
  918. movl $SYS_futex, %eax
  919. - syscall
  920. + SYSCALLDB
  921. popq %rdx
  922. cfi_adjust_cfa_offset(-8)
  923. @@ -435,7 +435,7 @@ __lll_timedwait_tid:
  924. #endif
  925. movq %r12, %rdi
  926. movl $SYS_futex, %eax
  927. - syscall
  928. + SYSCALLDB
  929. cmpl $0, (%rdi)
  930. jne 1f
  931. diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
  932. index 0a26739..8aae14a 100644
  933. --- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
  934. +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
  935. @@ -214,7 +214,7 @@ LLL_STUB_UNWIND_INFO_END
  936. register const struct timespec *__to __asm ("r10") = timeout; \
  937. int __status; \
  938. register __typeof (val) _val __asm ("edx") = (val); \
  939. - __asm __volatile ("syscall" \
  940. + __asm __volatile (SYSCALLDB \
  941. : "=a" (__status) \
  942. : "0" (SYS_futex), "D" (futex), \
  943. "S" (__lll_private_flag (FUTEX_WAIT, private)), \
  944. @@ -229,7 +229,7 @@ LLL_STUB_UNWIND_INFO_END
  945. int __status; \
  946. register __typeof (nr) _nr __asm ("edx") = (nr); \
  947. LIBC_PROBE (lll_futex_wake, 3, futex, nr, private); \
  948. - __asm __volatile ("syscall" \
  949. + __asm __volatile (SYSCALLDB \
  950. : "=a" (__status) \
  951. : "0" (SYS_futex), "D" (futex), \
  952. "S" (__lll_private_flag (FUTEX_WAKE, private)), \
  953. @@ -540,7 +540,7 @@ extern int __lll_timedlock_elision (int *futex, short *adapt_count,
  954. { \
  955. int ignore; \
  956. __asm __volatile (LOCK_INSTR "orl %3, (%2)\n\t" \
  957. - "syscall" \
  958. + SYSCALLDB \
  959. : "=m" (futex), "=a" (ignore) \
  960. : "D" (&(futex)), "i" (FUTEX_OWNER_DIED), \
  961. "S" (__lll_private_flag (FUTEX_WAKE, private)), \
  962. @@ -555,7 +555,7 @@ extern int __lll_timedlock_elision (int *futex, short *adapt_count,
  963. register int __nr_move __asm ("r10") = nr_move; \
  964. register void *__mutex __asm ("r8") = mutex; \
  965. register int __val __asm ("r9") = val; \
  966. - __asm __volatile ("syscall" \
  967. + __asm __volatile (SYSCALLDB \
  968. : "=a" (__res) \
  969. : "0" (__NR_futex), "D" ((void *) ftx), \
  970. "S" (__lll_private_flag (FUTEX_CMP_REQUEUE, \
  971. @@ -581,7 +581,7 @@ extern int __lll_timedlock_elision (int *futex, short *adapt_count,
  972. if (_tid != 0) \
  973. __asm __volatile ("xorq %%r10, %%r10\n\t" \
  974. "1:\tmovq %2, %%rax\n\t" \
  975. - "syscall\n\t" \
  976. + SYSCALLDB \
  977. "cmpl $0, (%%rdi)\n\t" \
  978. "jne 1b" \
  979. : "=&a" (__ignore) \
  980. diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S
  981. index 990b6f9..b01214d 100644
  982. --- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S
  983. +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S
  984. @@ -80,7 +80,7 @@ __lll_robust_lock_wait:
  985. jnz 2f
  986. 1: movl $SYS_futex, %eax
  987. - syscall
  988. + SYSCALLDB
  989. movl (%rdi), %eax
  990. @@ -145,7 +145,7 @@ __lll_robust_timedlock_wait:
  991. jnz 6f
  992. 5: movl $SYS_futex, %eax
  993. - syscall
  994. + SYSCALLDB
  995. movl %eax, %ecx
  996. movl (%rdi), %eax
  997. @@ -257,7 +257,7 @@ __lll_robust_timedlock_wait:
  998. LOAD_FUTEX_WAIT (%esi)
  999. movq %r12, %rdi
  1000. movl $SYS_futex, %eax
  1001. - syscall
  1002. + SYSCALLDB
  1003. movq %rax, %rcx
  1004. movl (%r12), %eax
  1005. diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S
  1006. index eec17f2..a350340 100644
  1007. --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S
  1008. +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S
  1009. @@ -62,7 +62,7 @@ pthread_barrier_wait:
  1010. #endif
  1011. xorq %r10, %r10
  1012. 8: movl $SYS_futex, %eax
  1013. - syscall
  1014. + SYSCALLDB
  1015. /* Don't return on spurious wakeups. The syscall does not change
  1016. any register except %eax so there is no need to reload any of
  1017. @@ -109,7 +109,7 @@ pthread_barrier_wait:
  1018. movl $FUTEX_WAKE, %esi
  1019. orl PRIVATE(%rdi), %esi
  1020. movl $SYS_futex, %eax
  1021. - syscall
  1022. + SYSCALLDB
  1023. /* Increment LEFT. If this brings the count back to the
  1024. initial count unlock the object. */
  1025. diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
  1026. index 985e0f1..d559456 100644
  1027. --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
  1028. +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
  1029. @@ -90,7 +90,7 @@ __pthread_cond_broadcast:
  1030. movl $SYS_futex, %eax
  1031. movl $1, %edx
  1032. movl $0x7fffffff, %r10d
  1033. - syscall
  1034. + SYSCALLDB
  1035. /* For any kind of error, which mainly is EAGAIN, we try again
  1036. with WAKE. The general test also covers running on old
  1037. @@ -106,7 +106,7 @@ __pthread_cond_broadcast:
  1038. movl $SYS_futex, %eax
  1039. movl $1, %edx
  1040. movl $0x7fffffff, %r10d
  1041. - syscall
  1042. + SYSCALLDB
  1043. /* For any kind of error, which mainly is EAGAIN, we try again
  1044. with WAKE. The general test also covers running on old
  1045. @@ -172,7 +172,7 @@ __pthread_cond_broadcast:
  1046. orl $FUTEX_WAKE, %esi
  1047. #endif
  1048. movl $SYS_futex, %eax
  1049. - syscall
  1050. + SYSCALLDB
  1051. jmp 10b
  1052. .size __pthread_cond_broadcast, .-__pthread_cond_broadcast
  1053. versioned_symbol (libpthread, __pthread_cond_broadcast, pthread_cond_broadcast,
  1054. diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
  1055. index 53d65b6..16df581 100644
  1056. --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
  1057. +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
  1058. @@ -82,7 +82,7 @@ __pthread_cond_signal:
  1059. addq $cond_lock, %r8
  1060. #endif
  1061. movl $FUTEX_OP_CLEAR_WAKE_IF_GT_ONE, %r9d
  1062. - syscall
  1063. + SYSCALLDB
  1064. #if cond_lock != 0
  1065. subq $cond_lock, %r8
  1066. #endif
  1067. @@ -99,7 +99,7 @@ __pthread_cond_signal:
  1068. movq %rcx, %r8
  1069. xorq %r10, %r10
  1070. movl (%rdi), %r9d // XXX Can this be right?
  1071. - syscall
  1072. + SYSCALLDB
  1073. leaq -cond_futex(%rdi), %r8
  1074. @@ -118,7 +118,7 @@ __pthread_cond_signal:
  1075. movl $SYS_futex, %eax
  1076. /* %rdx should be 1 already from $FUTEX_WAKE_OP syscall.
  1077. movl $1, %edx */
  1078. - syscall
  1079. + SYSCALLDB
  1080. /* Unlock. */
  1081. 4: LOCK
  1082. diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
  1083. index 0dc2340..8aff242 100644
  1084. --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
  1085. +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
  1086. @@ -188,7 +188,7 @@ __pthread_cond_timedwait:
  1087. movq %r12, %rdx
  1088. addq $cond_futex, %rdi
  1089. movl $SYS_futex, %eax
  1090. - syscall
  1091. + SYSCALLDB
  1092. cmpl $0, %eax
  1093. sete %r15b
  1094. @@ -234,7 +234,7 @@ __pthread_cond_timedwait:
  1095. movq %r12, %rdx
  1096. addq $cond_futex, %rdi
  1097. movl $SYS_futex, %eax
  1098. - syscall
  1099. + SYSCALLDB
  1100. 62: movq %rax, %r14
  1101. movl (%rsp), %edi
  1102. @@ -321,7 +321,7 @@ __pthread_cond_timedwait:
  1103. orl $FUTEX_WAKE, %esi
  1104. #endif
  1105. movl $SYS_futex, %eax
  1106. - syscall
  1107. + SYSCALLDB
  1108. subq $cond_nwaiters, %rdi
  1109. 55: LOCK
  1110. @@ -485,15 +485,8 @@ __pthread_cond_timedwait:
  1111. /* Only clocks 0 and 1 are allowed so far. Both are handled in the
  1112. kernel. */
  1113. leaq 32(%rsp), %rsi
  1114. -# ifdef SHARED
  1115. - mov __vdso_clock_gettime@GOTPCREL(%rip), %RAX_LP
  1116. - mov (%rax), %RAX_LP
  1117. - PTR_DEMANGLE (%RAX_LP)
  1118. - call *%rax
  1119. -# else
  1120. movl $__NR_clock_gettime, %eax
  1121. - syscall
  1122. -# endif
  1123. + SYSCALLDB
  1124. /* Compute relative timeout. */
  1125. movq (%r13), %rcx
  1126. @@ -560,7 +553,7 @@ __pthread_cond_timedwait:
  1127. # endif
  1128. addq $cond_futex, %rdi
  1129. movl $SYS_futex, %eax
  1130. - syscall
  1131. + SYSCALLDB
  1132. movq %rax, %r14
  1133. movl (%rsp), %edi
  1134. @@ -732,7 +725,7 @@ __condvar_cleanup2:
  1135. orl $FUTEX_WAKE, %esi
  1136. #endif
  1137. movl $SYS_futex, %eax
  1138. - syscall
  1139. + SYSCALLDB
  1140. subq $cond_nwaiters, %rdi
  1141. movl $1, %r12d
  1142. @@ -769,7 +762,7 @@ __condvar_cleanup2:
  1143. orl $FUTEX_WAKE, %esi
  1144. #endif
  1145. movl $SYS_futex, %eax
  1146. - syscall
  1147. + SYSCALLDB
  1148. /* Lock the mutex only if we don't own it already. This only happens
  1149. in case of PI mutexes, if we got cancelled after a successful
  1150. diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
  1151. index 0e61d0a..b4bcc15 100644
  1152. --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
  1153. +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
  1154. @@ -138,7 +138,7 @@ __pthread_cond_wait:
  1155. movl $(FUTEX_WAIT_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %esi
  1156. movl $SYS_futex, %eax
  1157. - syscall
  1158. + SYSCALLDB
  1159. cmpl $0, %eax
  1160. sete %r8b
  1161. @@ -180,7 +180,7 @@ __pthread_cond_wait:
  1162. #endif
  1163. 60: xorb %r8b, %r8b
  1164. movl $SYS_futex, %eax
  1165. - syscall
  1166. + SYSCALLDB
  1167. 62: movl (%rsp), %edi
  1168. callq __pthread_disable_asynccancel
  1169. @@ -239,7 +239,7 @@ __pthread_cond_wait:
  1170. orl $FUTEX_WAKE, %esi
  1171. #endif
  1172. movl $SYS_futex, %eax
  1173. - syscall
  1174. + SYSCALLDB
  1175. subq $cond_nwaiters, %rdi
  1176. 17: LOCK
  1177. @@ -455,7 +455,7 @@ __condvar_cleanup1:
  1178. orl $FUTEX_WAKE, %esi
  1179. #endif
  1180. movl $SYS_futex, %eax
  1181. - syscall
  1182. + SYSCALLDB
  1183. subq $cond_nwaiters, %rdi
  1184. movl $1, %ecx
  1185. @@ -493,7 +493,7 @@ __condvar_cleanup1:
  1186. orl $FUTEX_WAKE, %esi
  1187. #endif
  1188. movl $SYS_futex, %eax
  1189. - syscall
  1190. + SYSCALLDB
  1191. /* Lock the mutex only if we don't own it already. This only happens
  1192. in case of PI mutexes, if we got cancelled after a successful
  1193. diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S
  1194. index 2cbe2fa..489998a 100644
  1195. --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S
  1196. +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S
  1197. @@ -90,7 +90,7 @@ __pthread_once:
  1198. # endif
  1199. #endif
  1200. movl $SYS_futex, %eax
  1201. - syscall
  1202. + SYSCALLDB
  1203. jmp 6b
  1204. /* Preserve the pointer to the control variable. */
  1205. @@ -123,7 +123,7 @@ __pthread_once:
  1206. orl %fs:PRIVATE_FUTEX, %esi
  1207. #endif
  1208. movl $SYS_futex, %eax
  1209. - syscall
  1210. + SYSCALLDB
  1211. 4: addq $8, %rsp
  1212. cfi_adjust_cfa_offset(-8)
  1213. @@ -152,7 +152,7 @@ clear_once_control:
  1214. orl %fs:PRIVATE_FUTEX, %esi
  1215. #endif
  1216. movl $SYS_futex, %eax
  1217. - syscall
  1218. + SYSCALLDB
  1219. movq %r8, %rdi
  1220. .LcallUR:
  1221. diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S
  1222. index 3bbb4c7..53d5ca6 100644
  1223. --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S
  1224. +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S
  1225. @@ -82,7 +82,7 @@ __pthread_rwlock_rdlock:
  1226. #endif
  1227. addq $READERS_WAKEUP, %rdi
  1228. movl $SYS_futex, %eax
  1229. - syscall
  1230. + SYSCALLDB
  1231. subq $READERS_WAKEUP, %rdi
  1232. diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S
  1233. index 40bcc04..348170e 100644
  1234. --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S
  1235. +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S
  1236. @@ -109,7 +109,7 @@ pthread_rwlock_timedrdlock:
  1237. #endif
  1238. 21: leaq READERS_WAKEUP(%r12), %rdi
  1239. movl $SYS_futex, %eax
  1240. - syscall
  1241. + SYSCALLDB
  1242. movq %rax, %rdx
  1243. #ifndef __ASSUME_FUTEX_CLOCK_REALTIME
  1244. diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
  1245. index f57ef52..e9ac77f 100644
  1246. --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
  1247. +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
  1248. @@ -106,7 +106,7 @@ pthread_rwlock_timedwrlock:
  1249. #endif
  1250. 21: leaq WRITERS_WAKEUP(%r12), %rdi
  1251. movl $SYS_futex, %eax
  1252. - syscall
  1253. + SYSCALLDB
  1254. movq %rax, %rdx
  1255. #ifndef __ASSUME_FUTEX_CLOCK_REALTIME
  1256. diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S
  1257. index d779f7b..849c74f 100644
  1258. --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S
  1259. +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S
  1260. @@ -79,7 +79,7 @@ __pthread_rwlock_unlock:
  1261. #endif
  1262. movl $SYS_futex, %eax
  1263. movq %r10, %rdi
  1264. - syscall
  1265. + SYSCALLDB
  1266. xorl %eax, %eax
  1267. retq
  1268. diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S
  1269. index e444def..fd94930 100644
  1270. --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S
  1271. +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S
  1272. @@ -80,7 +80,7 @@ __pthread_rwlock_wrlock:
  1273. #endif
  1274. addq $WRITERS_WAKEUP, %rdi
  1275. movl $SYS_futex, %eax
  1276. - syscall
  1277. + SYSCALLDB
  1278. subq $WRITERS_WAKEUP, %rdi
  1279. diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S
  1280. index 1c11600..bd166cf 100644
  1281. --- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S
  1282. +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S
  1283. @@ -52,7 +52,7 @@ sem_post:
  1284. movl $FUTEX_WAKE, %esi
  1285. orl PRIVATE(%rdi), %esi
  1286. movl $1, %edx
  1287. - syscall
  1288. + SYSCALLDB
  1289. testq %rax, %rax
  1290. js 1f
  1291. diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
  1292. index 880610e..e520049 100644
  1293. --- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
  1294. +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
  1295. @@ -97,7 +97,7 @@ sem_timedwait:
  1296. orl PRIVATE(%rdi), %esi
  1297. movl $SYS_futex, %eax
  1298. xorl %edx, %edx
  1299. - syscall
  1300. + SYSCALLDB
  1301. movq %rax, %r9
  1302. #if VALUE != 0
  1303. leaq -VALUE(%rdi), %rdi
  1304. @@ -233,7 +233,7 @@ sem_timedwait:
  1305. # endif
  1306. movl $SYS_futex, %eax
  1307. xorl %edx, %edx
  1308. - syscall
  1309. + SYSCALLDB
  1310. movq %rax, %r14
  1311. movl 16(%rsp), %edi
  1312. diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
  1313. index 8f4d068..fe6dfbf 100644
  1314. --- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
  1315. +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
  1316. @@ -81,7 +81,7 @@ sem_wait:
  1317. orl PRIVATE(%rdi), %esi
  1318. #endif
  1319. xorl %edx, %edx
  1320. - syscall
  1321. + SYSCALLDB
  1322. movq %rax, %rcx
  1323. xchgq %r8, %rdi
  1324. diff --git a/nptl/sysdeps/x86_64/pthreaddef.h b/nptl/sysdeps/x86_64/pthreaddef.h
  1325. index 18a15a1..f050241 100644
  1326. --- a/nptl/sysdeps/x86_64/pthreaddef.h
  1327. +++ b/nptl/sysdeps/x86_64/pthreaddef.h
  1328. @@ -48,4 +48,4 @@
  1329. /* While there is no such syscall. */
  1330. #define __exit_thread_inline(val) \
  1331. - asm volatile ("syscall" :: "a" (__NR_exit), "D" (val))
  1332. + asm volatile (SYSCALLDB :: "a" (__NR_exit), "D" (val))
  1333. diff --git a/nptl/sysdeps/x86_64/tls.h b/nptl/sysdeps/x86_64/tls.h
  1334. index cbb5e9e..9b87e25 100644
  1335. --- a/nptl/sysdeps/x86_64/tls.h
  1336. +++ b/nptl/sysdeps/x86_64/tls.h
  1337. @@ -28,6 +28,8 @@
  1338. # include <sysdep.h>
  1339. # include <libc-internal.h>
  1340. # include <kernel-features.h>
  1341. +# include <shim_tls.h>
  1342. +# include <syscalldb.h>
  1343. /* Replacement type for __m128 since this file is included by ld.so,
  1344. which is compiled with -mno-sse. It must not change the alignment
  1345. @@ -67,6 +69,10 @@ typedef struct
  1346. # else
  1347. int __glibc_reserved1;
  1348. # endif
  1349. +
  1350. + shim_tcb_t shim_tcb; /* For graphene, we allocate a shim_tcb
  1351. + in the real tcb. */
  1352. +
  1353. int rtld_must_xmm_save;
  1354. /* Reservation of some values for the TM ABI. */
  1355. void *__private_tm[4];
  1356. @@ -137,7 +143,6 @@ typedef struct
  1357. # define GET_DTV(descr) \
  1358. (((tcbhead_t *) (descr))->dtv)
  1359. -
  1360. /* Code to initially initialize the thread pointer. This might need
  1361. special attention since 'errno' is not yet available and if the
  1362. operation can cause a failure 'errno' must not be touched.
  1363. @@ -154,7 +159,7 @@ typedef struct
  1364. _head->self = _thrdescr; \
  1365. \
  1366. /* It is a simple syscall to set the %fs value for the thread. */ \
  1367. - asm volatile ("syscall" \
  1368. + asm volatile (SYSCALLDB \
  1369. : "=a" (_result) \
  1370. : "0" ((unsigned long int) __NR_arch_prctl), \
  1371. "D" ((unsigned long int) ARCH_SET_FS), \
  1372. diff --git a/scripts/mkinstalldirs b/scripts/mkinstalldirs
  1373. index 55d537f..57bf12b 100755
  1374. --- a/scripts/mkinstalldirs
  1375. +++ b/scripts/mkinstalldirs
  1376. @@ -126,9 +126,9 @@ do
  1377. esac
  1378. if test ! -d "$pathcomp"; then
  1379. - echo "mkdir $pathcomp"
  1380. + echo "mkdir -p $pathcomp"
  1381. - mkdir "$pathcomp" || lasterr=$?
  1382. + mkdir -p "$pathcomp" || lasterr=$?
  1383. if test ! -d "$pathcomp"; then
  1384. errstatus=$lasterr
  1385. diff --git a/shlib-versions b/shlib-versions
  1386. index 78b0ad7..5c3dcf2 100644
  1387. --- a/shlib-versions
  1388. +++ b/shlib-versions
  1389. @@ -108,3 +108,5 @@ sparc64.*-.*-.* libBrokenLocale=1 GLIBC_2.2
  1390. # This defines the libgcc soname version this glibc is to load for
  1391. # asynchronous cancellation to work correctly.
  1392. .*-.*-.* libgcc_s=1
  1393. +
  1394. +.*-.*-.* liblibos=1
  1395. diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
  1396. index ffeb093..7a9fbcb 100644
  1397. --- a/sysdeps/generic/ldsodefs.h
  1398. +++ b/sysdeps/generic/ldsodefs.h
  1399. @@ -881,8 +881,7 @@ extern void _dl_sort_fini (struct link_map **maps, size_t nmaps, char *used,
  1400. any shared object mappings. The `r_state' member of `struct r_debug'
  1401. says what change is taking place. This function's address is
  1402. the value of the `r_brk' member. */
  1403. -extern void _dl_debug_state (void);
  1404. -rtld_hidden_proto (_dl_debug_state)
  1405. +extern void __libc_dl_debug_state (void) __attribute__((weak));
  1406. /* Initialize `struct r_debug' if it has not already been done. The
  1407. argument is the run-time load address of the dynamic linker, to be put
  1408. diff --git a/sysdeps/unix/sysv/linux/_exit.c b/sysdeps/unix/sysv/linux/_exit.c
  1409. index 2468228..a9f1cd6 100644
  1410. --- a/sysdeps/unix/sysv/linux/_exit.c
  1411. +++ b/sysdeps/unix/sysv/linux/_exit.c
  1412. @@ -29,9 +29,9 @@ _exit (status)
  1413. while (1)
  1414. {
  1415. #ifdef __NR_exit_group
  1416. - INLINE_SYSCALL (exit_group, 1, status);
  1417. + INLINE_SYSCALL_ASM (exit_group, 1, status);
  1418. #endif
  1419. - INLINE_SYSCALL (exit, 1, status);
  1420. + INLINE_SYSCALL_ASM (exit, 1, status);
  1421. #ifdef ABORT_INSTRUCTION
  1422. ABORT_INSTRUCTION;
  1423. diff --git a/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S b/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
  1424. index 49f0384..6b1a975 100644
  1425. --- a/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
  1426. +++ b/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
  1427. @@ -84,7 +84,8 @@ ENTRY(____longjmp_chk)
  1428. xorl %edi, %edi
  1429. lea -sizeSS(%rsp), %RSI_LP
  1430. movl $__NR_sigaltstack, %eax
  1431. - syscall
  1432. + SYSCALLDB
  1433. +
  1434. /* Without working sigaltstack we cannot perform the test. */
  1435. testl %eax, %eax
  1436. jne .Lok2
  1437. diff --git a/sysdeps/unix/sysv/linux/x86_64/clock_gettime.c b/sysdeps/unix/sysv/linux/x86_64/clock_gettime.c
  1438. index f712110..f6bad14 100644
  1439. --- a/sysdeps/unix/sysv/linux/x86_64/clock_gettime.c
  1440. +++ b/sysdeps/unix/sysv/linux/x86_64/clock_gettime.c
  1441. @@ -1,5 +1,6 @@
  1442. #include "bits/libc-vdso.h"
  1443. +#if 0 /* in Graphene, disallow VDSO calls */
  1444. #ifdef SHARED
  1445. # define SYSCALL_GETTIME(id, tp) \
  1446. ({ long int (*f) (clockid_t, struct timespec *) = __vdso_clock_gettime; \
  1447. @@ -16,5 +17,6 @@
  1448. PTR_DEMANGLE (f); \
  1449. f (id, tp); })
  1450. #endif
  1451. +#endif
  1452. #include "../clock_gettime.c"
  1453. diff --git a/sysdeps/unix/sysv/linux/x86_64/clone.S b/sysdeps/unix/sysv/linux/x86_64/clone.S
  1454. index 0508730..e1b35ec 100644
  1455. --- a/sysdeps/unix/sysv/linux/x86_64/clone.S
  1456. +++ b/sysdeps/unix/sysv/linux/x86_64/clone.S
  1457. @@ -59,11 +59,15 @@ ENTRY (__clone)
  1458. jz SYSCALL_ERROR_LABEL
  1459. /* Insert the argument onto the new stack. */
  1460. - subq $16,%rsi
  1461. - movq %rcx,8(%rsi)
  1462. + subq $24,%rsi
  1463. + movq %rcx,16(%rsi)
  1464. /* Save the function pointer. It will be popped off in the
  1465. child in the ebx frobbing below. */
  1466. + movq %rdi,8(%rsi)
  1467. +
  1468. + /* Push an additional pointer as return address into the stack */
  1469. + leaq L(clone_return)(%rip),%rdi
  1470. movq %rdi,0(%rsi)
  1471. /* Do the system call. */
  1472. @@ -76,8 +80,9 @@ ENTRY (__clone)
  1473. /* End FDE now, because in the child the unwind info will be
  1474. wrong. */
  1475. cfi_endproc;
  1476. - syscall
  1477. + SYSCALLDB
  1478. +L(clone_return):
  1479. testq %rax,%rax
  1480. jl SYSCALL_ERROR_LABEL
  1481. jz L(thread_start)
  1482. @@ -99,13 +104,14 @@ L(thread_start):
  1483. movl $-1, %eax
  1484. jne 2f
  1485. movl $SYS_ify(getpid), %eax
  1486. - syscall
  1487. + SYSCALLDB
  1488. 2: movl %eax, %fs:PID
  1489. movl %eax, %fs:TID
  1490. 1:
  1491. #endif
  1492. /* Set up arguments for the function call. */
  1493. + addq $8,%rsp /* Skip the return address */
  1494. popq %rax /* Function to call. */
  1495. popq %rdi /* Argument. */
  1496. call *%rax
  1497. diff --git a/sysdeps/unix/sysv/linux/x86_64/getcontext.S b/sysdeps/unix/sysv/linux/x86_64/getcontext.S
  1498. index 140db03..6967f10 100644
  1499. --- a/sysdeps/unix/sysv/linux/x86_64/getcontext.S
  1500. +++ b/sysdeps/unix/sysv/linux/x86_64/getcontext.S
  1501. @@ -75,7 +75,7 @@ ENTRY(__getcontext)
  1502. #endif
  1503. movl $_NSIG8,%r10d
  1504. movl $__NR_rt_sigprocmask, %eax
  1505. - syscall
  1506. + SYSCALLDB
  1507. cmpq $-4095, %rax /* Check %rax for error. */
  1508. jae SYSCALL_ERROR_LABEL /* Jump to error handler if error. */
  1509. diff --git a/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c b/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c
  1510. index 440ca7f..571125d 100644
  1511. --- a/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c
  1512. +++ b/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c
  1513. @@ -17,6 +17,7 @@
  1514. #include <sys/time.h>
  1515. +#if 0 /* In graphene, do not use vsyscall or VDSO call */
  1516. #ifdef SHARED
  1517. # include <dl-vdso.h>
  1518. @@ -42,7 +43,8 @@ asm (".type __gettimeofday, %gnu_indirect_function");
  1519. asm (".globl __GI___gettimeofday\n"
  1520. "__GI___gettimeofday = __gettimeofday");
  1521. -#else
  1522. +#endif
  1523. +#endif
  1524. # include <sysdep.h>
  1525. # include <errno.h>
  1526. @@ -54,6 +56,5 @@ __gettimeofday (struct timeval *tv, struct timezone *tz)
  1527. }
  1528. libc_hidden_def (__gettimeofday)
  1529. -#endif
  1530. weak_alias (__gettimeofday, gettimeofday)
  1531. libc_hidden_weak (gettimeofday)
  1532. diff --git a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S b/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
  1533. index 0fd47f2..7a82975 100644
  1534. --- a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
  1535. +++ b/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
  1536. @@ -30,6 +30,7 @@ ENTRY (sched_getcpu)
  1537. sub $0x8, %rsp
  1538. cfi_adjust_cfa_offset(8)
  1539. +#if 0 /* for Graphene, never do VDSO calls */
  1540. movq %rsp, %rdi
  1541. xorl %esi, %esi
  1542. movl $VGETCPU_CACHE_OFFSET, %edx
  1543. @@ -39,16 +40,19 @@ ENTRY (sched_getcpu)
  1544. movq __vdso_getcpu(%rip), %rax
  1545. PTR_DEMANGLE (%rax)
  1546. callq *%rax
  1547. -#else
  1548. -# ifdef __NR_getcpu
  1549. +#endif
  1550. +#endif
  1551. +
  1552. +#ifdef __NR_getcpu
  1553. movl $__NR_getcpu, %eax
  1554. - syscall
  1555. -# ifndef __ASSUME_GETCPU_SYSCALL
  1556. + SYSCALLDB
  1557. +#endif
  1558. +
  1559. +#if 0 /* for Graphene, never do vsyscall */
  1560. +# ifndef __ASSUME_GETCPU_SYSCALL
  1561. cmpq $-ENOSYS, %rax
  1562. jne 1f
  1563. -# endif
  1564. -# endif
  1565. -# ifndef __ASSUME_GETCPU_SYSCALL
  1566. +
  1567. movq $VSYSCALL_ADDR_vgetcpu, %rax
  1568. callq *%rax
  1569. 1:
  1570. diff --git a/sysdeps/unix/sysv/linux/x86_64/setcontext.S b/sysdeps/unix/sysv/linux/x86_64/setcontext.S
  1571. index b726fa0..bb3ae34 100644
  1572. --- a/sysdeps/unix/sysv/linux/x86_64/setcontext.S
  1573. +++ b/sysdeps/unix/sysv/linux/x86_64/setcontext.S
  1574. @@ -43,7 +43,7 @@ ENTRY(__setcontext)
  1575. movl $SIG_SETMASK, %edi
  1576. movl $_NSIG8,%r10d
  1577. movl $__NR_rt_sigprocmask, %eax
  1578. - syscall
  1579. + SYSCALLDB
  1580. popq %rdi /* Reload %rdi, adjust stack. */
  1581. cfi_adjust_cfa_offset(-8)
  1582. cmpq $-4095, %rax /* Check %rax for error. */
  1583. diff --git a/sysdeps/unix/sysv/linux/x86_64/sigaction.c b/sysdeps/unix/sysv/linux/x86_64/sigaction.c
  1584. index ab23985..38a6b69 100644
  1585. --- a/sysdeps/unix/sysv/linux/x86_64/sigaction.c
  1586. +++ b/sysdeps/unix/sysv/linux/x86_64/sigaction.c
  1587. @@ -129,7 +129,7 @@ asm \
  1588. " .type __" #name ",@function\n" \
  1589. "__" #name ":\n" \
  1590. " movq $" #syscall ", %rax\n" \
  1591. - " syscall\n" \
  1592. + SYSCALLDB_ASM \
  1593. ".LEND_" #name ":\n" \
  1594. ".section .eh_frame,\"a\",@progbits\n" \
  1595. ".LSTARTFRAME_" #name ":\n" \
  1596. diff --git a/sysdeps/unix/sysv/linux/x86_64/swapcontext.S b/sysdeps/unix/sysv/linux/x86_64/swapcontext.S
  1597. index b3854fa..6369bfe 100644
  1598. --- a/sysdeps/unix/sysv/linux/x86_64/swapcontext.S
  1599. +++ b/sysdeps/unix/sysv/linux/x86_64/swapcontext.S
  1600. @@ -75,7 +75,7 @@ ENTRY(__swapcontext)
  1601. movl $SIG_SETMASK, %edi
  1602. movl $_NSIG8,%r10d
  1603. movl $__NR_rt_sigprocmask, %eax
  1604. - syscall
  1605. + SYSCALLDB
  1606. cmpq $-4095, %rax /* Check %rax for error. */
  1607. jae SYSCALL_ERROR_LABEL /* Jump to error handler if error. */
  1608. diff --git a/sysdeps/unix/sysv/linux/x86_64/syscall.S b/sysdeps/unix/sysv/linux/x86_64/syscall.S
  1609. index 92c2f5b..e32ebb2 100644
  1610. --- a/sysdeps/unix/sysv/linux/x86_64/syscall.S
  1611. +++ b/sysdeps/unix/sysv/linux/x86_64/syscall.S
  1612. @@ -31,10 +31,12 @@
  1613. movq %rsi, %rdi /* shift arg1 - arg5. */
  1614. movq %rdx, %rsi
  1615. movq %rcx, %rdx
  1616. + /* DEP 8/17/17: Keep kernel calling
  1617. + * convention and fix in libOS */
  1618. movq %r8, %r10
  1619. movq %r9, %r8
  1620. movq 8(%rsp),%r9 /* arg6 is on the stack. */
  1621. - syscall /* Do the system call. */
  1622. + SYSCALLDB /* Do the system call. */
  1623. cmpq $-4095, %rax /* Check %rax for error. */
  1624. jae SYSCALL_ERROR_LABEL /* Jump to error handler if error. */
  1625. ret /* Return to caller. */
  1626. diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
  1627. index 4a9a9d9..dc452ed 100644
  1628. --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
  1629. +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
  1630. @@ -21,6 +21,7 @@
  1631. /* There is some commonality. */
  1632. #include <sysdeps/unix/x86_64/sysdep.h>
  1633. #include <tls.h>
  1634. +#include "syscalldb.h"
  1635. #ifdef IS_IN_rtld
  1636. # include <dl-sysdep.h> /* Defines RTLD_PRIVATE_ERRNO. */
  1637. @@ -176,7 +177,7 @@
  1638. # define DO_CALL(syscall_name, args) \
  1639. DOARGS_##args \
  1640. movl $SYS_ify (syscall_name), %eax; \
  1641. - syscall;
  1642. + SYSCALLDB
  1643. # define DOARGS_0 /* nothing */
  1644. # define DOARGS_1 /* nothing */
  1645. @@ -190,9 +191,20 @@
  1646. /* Define a macro which expands inline into the wrapper code for a system
  1647. call. */
  1648. # undef INLINE_SYSCALL
  1649. -# define INLINE_SYSCALL(name, nr, args...) \
  1650. +# define INLINE_SYSCALL(name, nr_args...) \
  1651. ({ \
  1652. - unsigned long int resultvar = INTERNAL_SYSCALL (name, , nr, args); \
  1653. + unsigned long int resultvar = INTERNAL_SYSCALL (name, , ##nr_args); \
  1654. + if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0)) \
  1655. + { \
  1656. + __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \
  1657. + resultvar = (unsigned long int) -1; \
  1658. + } \
  1659. + (long int) resultvar; })
  1660. +
  1661. +# undef INLINE_SYSCALL_ASM
  1662. +# define INLINE_SYSCALL_ASM(name, nr_args...) \
  1663. + ({ \
  1664. + unsigned long int resultvar = INTERNAL_SYSCALL_ASM (name, , ##nr_args); \
  1665. if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0)) \
  1666. { \
  1667. __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \
  1668. @@ -204,9 +216,9 @@
  1669. into the wrapper code for a system call. It should be used when size
  1670. of any argument > size of long int. */
  1671. # undef INLINE_SYSCALL_TYPES
  1672. -# define INLINE_SYSCALL_TYPES(name, nr, args...) \
  1673. +# define INLINE_SYSCALL_TYPES(name, nr_args...) \
  1674. ({ \
  1675. - unsigned long int resultvar = INTERNAL_SYSCALL_TYPES (name, , nr, args); \
  1676. + unsigned long int resultvar = INTERNAL_SYSCALL_TYPES (name, , ##nr_args); \
  1677. if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0)) \
  1678. { \
  1679. __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \
  1680. @@ -223,13 +235,19 @@
  1681. LOAD_ARGS_##nr (args) \
  1682. LOAD_REGS_##nr \
  1683. asm volatile ( \
  1684. - "syscall\n\t" \
  1685. + SYSCALLDB \
  1686. : "=a" (resultvar) \
  1687. : "0" (name) ASM_ARGS_##nr : "memory", "cc", "r11", "cx"); \
  1688. (long int) resultvar; })
  1689. +# define INTERNAL_SYSCALL_NCS_ASM INTERNAL_SYSCALL_NCS
  1690. +
  1691. # undef INTERNAL_SYSCALL
  1692. -# define INTERNAL_SYSCALL(name, err, nr, args...) \
  1693. - INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args)
  1694. +# define INTERNAL_SYSCALL(name, err, nr_args...) \
  1695. + INTERNAL_SYSCALL_NCS (__NR_##name, err, ##nr_args)
  1696. +
  1697. +# undef INTERNAL_SYSCALL_ASM
  1698. +# define INTERNAL_SYSCALL_ASM(name, err, nr_args...) \
  1699. + INTERNAL_SYSCALL_NCS_ASM (__NR_##name, err, ##nr_args)
  1700. # define INTERNAL_SYSCALL_NCS_TYPES(name, err, nr, args...) \
  1701. ({ \
  1702. @@ -237,7 +255,7 @@
  1703. LOAD_ARGS_TYPES_##nr (args) \
  1704. LOAD_REGS_TYPES_##nr (args) \
  1705. asm volatile ( \
  1706. - "syscall\n\t" \
  1707. + SYSCALLDB \
  1708. : "=a" (resultvar) \
  1709. : "0" (name) ASM_ARGS_##nr : "memory", "cc", "r11", "cx"); \
  1710. (long int) resultvar; })
  1711. @@ -252,6 +270,7 @@
  1712. # undef INTERNAL_SYSCALL_ERRNO
  1713. # define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
  1714. +# if 0 /* for Graphene, never do vsyscall */
  1715. # ifdef SHARED
  1716. # define INLINE_VSYSCALL(name, nr, args...) \
  1717. ({ \
  1718. @@ -300,12 +319,13 @@
  1719. v_ret; \
  1720. })
  1721. -# else
  1722. -# define INLINE_VSYSCALL(name, nr, args...) \
  1723. - INLINE_SYSCALL (name, nr, ##args)
  1724. -# define INTERNAL_VSYSCALL(name, err, nr, args...) \
  1725. - INTERNAL_SYSCALL (name, err, nr, ##args)
  1726. # endif
  1727. +# endif
  1728. +
  1729. +# define INLINE_VSYSCALL(name, nr_args...) \
  1730. + INLINE_SYSCALL (name, ##nr_args)
  1731. +# define INTERNAL_VSYSCALL(name, err, nr_args...) \
  1732. + INTERNAL_SYSCALL (name, err, ##nr_args)
  1733. # define LOAD_ARGS_0()
  1734. # define LOAD_REGS_0
  1735. diff --git a/sysdeps/unix/sysv/linux/x86_64/time.c b/sysdeps/unix/sysv/linux/x86_64/time.c
  1736. deleted file mode 100644
  1737. index 79f1fab..0000000
  1738. --- a/sysdeps/unix/sysv/linux/x86_64/time.c
  1739. +++ /dev/null
  1740. @@ -1,60 +0,0 @@
  1741. -/* Copyright (C) 2001-2014 Free Software Foundation, Inc.
  1742. - This file is part of the GNU C Library.
  1743. -
  1744. - The GNU C Library is free software; you can redistribute it and/or
  1745. - modify it under the terms of the GNU Lesser General Public
  1746. - License as published by the Free Software Foundation; either
  1747. - version 2.1 of the License, or (at your option) any later version.
  1748. -
  1749. - The GNU C Library is distributed in the hope that it will be useful,
  1750. - but WITHOUT ANY WARRANTY; without even the implied warranty of
  1751. - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  1752. - Lesser General Public License for more details.
  1753. -
  1754. - You should have received a copy of the GNU Lesser General Public
  1755. - License along with the GNU C Library; if not, see
  1756. - <http://www.gnu.org/licenses/>. */
  1757. -
  1758. -#ifdef SHARED
  1759. -/* Redefine time so that the compiler won't complain about the type
  1760. - mismatch with the IFUNC selector in strong_alias, below. */
  1761. -#undef time
  1762. -#define time __redirect_time
  1763. -#include <time.h>
  1764. -
  1765. -#include <dl-vdso.h>
  1766. -
  1767. -#define VSYSCALL_ADDR_vtime 0xffffffffff600400
  1768. -
  1769. -/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
  1770. - ifunc symbol properly. */
  1771. -extern __typeof (__redirect_time) __libc_time;
  1772. -void *time_ifunc (void) __asm__ ("__libc_time");
  1773. -
  1774. -void *
  1775. -time_ifunc (void)
  1776. -{
  1777. - PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
  1778. -
  1779. - /* If the vDSO is not available we fall back on the old vsyscall. */
  1780. - return _dl_vdso_vsym ("__vdso_time", &linux26) ?: (void *) VSYSCALL_ADDR_vtime;
  1781. -}
  1782. -__asm (".type __libc_time, %gnu_indirect_function");
  1783. -
  1784. -#undef time
  1785. -strong_alias (__libc_time, time)
  1786. -libc_hidden_ver (__libc_time, time)
  1787. -
  1788. -#else
  1789. -
  1790. -# include <time.h>
  1791. -# include <sysdep.h>
  1792. -
  1793. -time_t
  1794. -time (time_t *t)
  1795. -{
  1796. - INTERNAL_SYSCALL_DECL (err);
  1797. - return INTERNAL_SYSCALL (time, err, 1, t);
  1798. -}
  1799. -
  1800. -#endif
  1801. diff --git a/sysdeps/unix/sysv/linux/x86_64/vfork.S b/sysdeps/unix/sysv/linux/x86_64/vfork.S
  1802. index d3b450a..75a63e1 100644
  1803. --- a/sysdeps/unix/sysv/linux/x86_64/vfork.S
  1804. +++ b/sysdeps/unix/sysv/linux/x86_64/vfork.S
  1805. @@ -38,7 +38,7 @@ ENTRY (__vfork)
  1806. /* Stuff the syscall number in RAX and enter into the kernel. */
  1807. movl $SYS_ify (vfork), %eax
  1808. - syscall
  1809. + SYSCALLDB
  1810. /* Push back the return PC. */
  1811. pushq %rdi
  1812. diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
  1813. index 504c95f..dcfc259 100644
  1814. --- a/sysdeps/x86_64/dl-machine.h
  1815. +++ b/sysdeps/x86_64/dl-machine.h
  1816. @@ -529,7 +529,8 @@ elf_machine_lazy_rel (struct link_map *map,
  1817. value = ((ElfW(Addr) (*) (void)) value) ();
  1818. *reloc_addr = value;
  1819. }
  1820. - else
  1821. + /* for graphene, get around R_X86_64_NONE */
  1822. + else if (__builtin_expect (r_type != R_X86_64_NONE, 1))
  1823. _dl_reloc_bad_type (map, r_type, 1);
  1824. }
  1825. diff --git a/sysdeps/x86_64/hp-timing.h b/sysdeps/x86_64/hp-timing.h
  1826. index d88206c..886c500 100644
  1827. --- a/sysdeps/x86_64/hp-timing.h
  1828. +++ b/sysdeps/x86_64/hp-timing.h
  1829. @@ -18,23 +18,6 @@
  1830. #ifndef _HP_TIMING_H
  1831. -/* We can use some of the i686 implementation without changes. */
  1832. -# include <sysdeps/i386/i686/hp-timing.h>
  1833. -
  1834. -/* The "=A" constraint used in 32-bit mode does not work in 64-bit mode. */
  1835. -# undef HP_TIMING_NOW
  1836. -# define HP_TIMING_NOW(Var) \
  1837. - ({ unsigned int _hi, _lo; \
  1838. - asm volatile ("rdtsc" : "=a" (_lo), "=d" (_hi)); \
  1839. - (Var) = ((unsigned long long int) _hi << 32) | _lo; })
  1840. -
  1841. -/* The funny business for 32-bit mode is not required here. */
  1842. -# undef HP_TIMING_ACCUM
  1843. -# define HP_TIMING_ACCUM(Sum, Diff) \
  1844. - do { \
  1845. - hp_timing_t __diff = (Diff) - GLRO(dl_hp_timing_overhead); \
  1846. - __asm__ __volatile__ ("lock; addq %1, %0" \
  1847. - : "=m" (Sum) : "r" (__diff), "m" (Sum)); \
  1848. - } while (0)
  1849. +# include <sysdeps/generic/hp-timing.h>
  1850. #endif /* hp-timing.h */