@@ -972,10 +972,15 @@ func (g *Generator) AddBindMount(bind string) error {
972972// SetupPrivileged sets up the priviledge-related fields inside g.spec.
973973func (g * Generator ) SetupPrivileged (privileged bool ) {
974974 if privileged {
975+ last := capability .CAP_LAST_CAP
976+ // hack for RHEL6 which has no /proc/sys/kernel/cap_last_cap
977+ if last == capability .Cap (63 ) {
978+ last = capability .CAP_BLOCK_SUSPEND
979+ }
975980 // Add all capabilities in privileged mode.
976981 var finalCapList []string
977982 for _ , cap := range capability .List () {
978- if g .HostSpecific && cap > capability . CAP_LAST_CAP {
983+ if g .HostSpecific && cap > last {
979984 continue
980985 }
981986 finalCapList = append (finalCapList , fmt .Sprintf ("CAP_%s" , strings .ToUpper (cap .String ())))
@@ -992,9 +997,14 @@ func checkCap(c string, hostSpecific bool) error {
992997 isValid := false
993998 cp := strings .ToUpper (c )
994999
1000+ last := capability .CAP_LAST_CAP
1001+ // hack for RHEL6 which has no /proc/sys/kernel/cap_last_cap
1002+ if last == capability .Cap (63 ) {
1003+ last = capability .CAP_BLOCK_SUSPEND
1004+ }
9951005 for _ , cap := range capability .List () {
9961006 if cp == strings .ToUpper (cap .String ()) {
997- if hostSpecific && cap > capability . CAP_LAST_CAP {
1007+ if hostSpecific && cap > last {
9981008 return fmt .Errorf ("CAP_%s is not supported on the current host" , cp )
9991009 }
10001010 isValid = true
0 commit comments