Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skip shadow call when euid > 0 on linux #6

Open
wants to merge 1 commit into
base: blead
Choose a base branch
from
Open

Conversation

atoomic
Copy link
Owner

@atoomic atoomic commented Jul 16, 2018

maybe linux is not restrictive enough
and we could consider using a hint sh file
to enable it only on some specific distro?

@atoomic
Copy link
Owner Author

atoomic commented Jul 16, 2018

benchmark test file

[
 'getpwuid' =>
 {
  desc => "getpwuid",
  code => q[my @out = getpwuid(0);],
 },
 'getpwent' =>
 {
  desc => "getpwent",
  code => q[my @out = getpwent();],
 },
 'getpwnam' =>
 {
  desc => "getpwnam(root)",
  code => q[my @out = getpwnam('root');],
 },
]

@atoomic
Copy link
Owner Author

atoomic commented Jul 16, 2018

Run as root user

./perl -Ilib Porting/bench.pl --benchfile=/tmp/bench-getpw ../perl2/perl=blead ./perl=blead+patch
Key:
    Ir   Instruction read
    Dr   Data read
    Dw   Data write
    COND conditional branches
    IND  indirect branches
    _m   branch predict miss
    _m1  level 1 cache miss
    _mm  last cache (e.g. L3) miss
    -    indeterminate percentage (e.g. 1/0)

The numbers represent relative counts per loop iteration, compared to
blead at 100.0%.
Higher is better: for example, using half as many instructions gives 200%,
while using twice as many gives 50%.

getpwuid
getpwuid

        blead blead+patch
       ------ -----------
    Ir 100.00       99.92
    Dr 100.00       99.92
    Dw 100.00       99.93
  COND 100.00       99.94
   IND 100.00       98.99

COND_m 100.00      104.34
 IND_m 100.00       97.37

 Ir_m1 100.00       99.45
 Dr_m1 100.00      100.00
 Dw_m1 100.00      100.00

 Ir_mm 100.00      100.00
 Dr_mm 100.00      100.00
 Dw_mm 100.00      100.00

getpwent
getpwent

        blead blead+patch
       ------ -----------
    Ir 100.00       99.97
    Dr 100.00       99.97
    Dw 100.00       99.97
  COND 100.00       99.98
   IND 100.00       99.39

COND_m 100.00      100.57
 IND_m 100.00       97.29

 Ir_m1 100.00       99.95
 Dr_m1 100.00      110.53
 Dw_m1 100.00      100.00

 Ir_mm 100.00      100.00
 Dr_mm 100.00      100.00
 Dw_mm 100.00      100.00

getpwnam
getpwnam(root)

        blead blead+patch
       ------ -----------
    Ir 100.00       99.93
    Dr 100.00       99.92
    Dw 100.00       99.94
  COND 100.00       99.95
   IND 100.00       98.99

COND_m 100.00      102.59
 IND_m 100.00       97.37

 Ir_m1 100.00       99.95
 Dr_m1 100.00      100.00
 Dw_m1 100.00      100.00

 Ir_mm 100.00      100.00
 Dr_mm 100.00      100.00
 Dw_mm 100.00      100.00

AVERAGE

        blead blead+patch
       ------ -----------
    Ir 100.00       99.94
    Dr 100.00       99.94
    Dw 100.00       99.94
  COND 100.00       99.96
   IND 100.00       99.12

COND_m 100.00      102.48
 IND_m 100.00       97.34

 Ir_m1 100.00       99.79
 Dr_m1 100.00      103.28
 Dw_m1 100.00      100.00

 Ir_mm 100.00      100.00
 Dr_mm 100.00      100.00
 Dw_mm 100.00      100.00

@atoomic
Copy link
Owner Author

atoomic commented Jul 16, 2018

Run as non root user

./perl -Ilib Porting/bench.pl --benchfile=/tmp/bench-getpw ../perl2/perl=blead ./perl=blead+patch
Key:
    Ir   Instruction read
    Dr   Data read
    Dw   Data write
    COND conditional branches
    IND  indirect branches
    _m   branch predict miss
    _m1  level 1 cache miss
    _mm  last cache (e.g. L3) miss
    -    indeterminate percentage (e.g. 1/0)

The numbers represent relative counts per loop iteration, compared to
blead at 100.0%.
Higher is better: for example, using half as many instructions gives 200%,
while using twice as many gives 50%.

getpwuid
getpwuid

        blead blead+patch
       ------ -----------
    Ir 100.00      137.64
    Dr 100.00      130.24
    Dw 100.00      146.70
  COND 100.00      137.26
   IND 100.00      117.57

COND_m 100.00      211.55
 IND_m 100.00      117.24

 Ir_m1 100.00     1200.00
 Dr_m1 100.00      100.00
 Dw_m1 100.00      100.00

 Ir_mm 100.00      100.00
 Dr_mm 100.00      100.00
 Dw_mm 100.00      100.00

getpwent
getpwent

        blead blead+patch
       ------ -----------
    Ir 100.00      117.19
    Dr 100.00      117.45
    Dw 100.00      122.08
  COND 100.00      116.20
   IND 100.00      115.85

COND_m 100.00      123.67
 IND_m 100.00      114.08

 Ir_m1 100.00      717.86
 Dr_m1 100.00      130.00
 Dw_m1 100.00       33.33

 Ir_mm 100.00           -
 Dr_mm 100.00      100.00
 Dw_mm 100.00      100.00

getpwnam
getpwnam(root)

        blead blead+patch
       ------ -----------
    Ir 100.00      137.34
    Dr 100.00      129.98
    Dw 100.00      146.59
  COND 100.00      136.53
   IND 100.00      117.57

COND_m 100.00      211.11
 IND_m 100.00      117.24

 Ir_m1 100.00     1040.00
 Dr_m1 100.00      100.00
 Dw_m1 100.00      100.00

 Ir_mm 100.00      100.00
 Dr_mm 100.00      100.00
 Dw_mm 100.00      100.00

AVERAGE

        blead blead+patch
       ------ -----------
    Ir 100.00      129.99
    Dr 100.00      125.60
    Dw 100.00      137.43
  COND 100.00      129.22
   IND 100.00      116.99

COND_m 100.00      170.94
 IND_m 100.00      116.17

 Ir_m1 100.00      941.06
 Dr_m1 100.00      108.33
 Dw_m1 100.00       60.00

 Ir_mm 100.00      100.00
 Dr_mm 100.00      100.00
 Dw_mm 100.00      100.00

note blead=032639c40ae7d62f157b23237aae655d49115a56

@atoomic
Copy link
Owner Author

atoomic commented Jul 16, 2018

probably needs its own RT ticket to open a discussion about it

@khwilliamson
Copy link

Agreed that it needs RT

Resolves Perl#16637

maybe __linux__ is not restrictive enough
and we could consider using a hint sh file
to enable it only on some specific distro?
@atoomic atoomic force-pushed the blead branch 2 times, most recently from 338287a to 514b901 Compare October 20, 2019 15:40
@atoomic atoomic force-pushed the blead branch 2 times, most recently from 217a174 to bcfd415 Compare December 21, 2019 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants