runc: add libpathrs info to --version and features

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
(cherry picked from commit 1e20abef19)
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
This commit is contained in:
Aleksa Sarai
2026-06-18 10:49:35 +02:00
parent c3e97da541
commit e650692bc2
7 changed files with 38 additions and 1 deletions
+4
View File
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased 1.4.z] ## [Unreleased 1.4.z]
### Added ###
- `runc version` and `runc features` now provide version information about
libpathrs when runc is built with the `libpathrs` build tag. (#5291, #5328)
### Changed ### ### Changed ###
- For users making use of the `libpathrs` build tag, runc now depends on - For users making use of the `libpathrs` build tag, runc now depends on
[libpathrs v0.2.5] or later, and attempting to build with older versions will [libpathrs v0.2.5] or later, and attempting to build with older versions will
+4
View File
@@ -93,6 +93,10 @@ var featuresCommand = cli.Command{
feat.Annotations[runcfeatures.AnnotationLibseccompVersion] = fmt.Sprintf("%d.%d.%d", major, minor, patch) feat.Annotations[runcfeatures.AnnotationLibseccompVersion] = fmt.Sprintf("%d.%d.%d", major, minor, patch)
} }
if v := pathrsVersionString(); v != "" {
feat.Annotations[runcfeatures.AnnotationLibpathrsVersion] = v
}
enc := json.NewEncoder(context.App.Writer) enc := json.NewEncoder(context.App.Writer)
enc.SetIndent("", " ") enc.SetIndent("", " ")
return enc.Encode(feat) return enc.Encode(feat)
+15
View File
@@ -0,0 +1,15 @@
//go:build libpathrs
package main
import (
"cyphar.com/go-pathrs"
)
func pathrsVersionString() string {
info, err := pathrs.LibraryVersion()
if err != nil {
panic(err) // should never happen
}
return info.VersionString
}
+7
View File
@@ -0,0 +1,7 @@
//go:build !libpathrs
package main
func pathrsVersionString() string {
return ""
}
+1 -1
View File
@@ -3,6 +3,7 @@ module github.com/opencontainers/runc
go 1.24.0 go 1.24.0
require ( require (
cyphar.com/go-pathrs v0.2.5
github.com/checkpoint-restore/go-criu/v7 v7.2.0 github.com/checkpoint-restore/go-criu/v7 v7.2.0
github.com/containerd/console v1.0.5 github.com/containerd/console v1.0.5
github.com/coreos/go-systemd/v22 v22.7.0 github.com/coreos/go-systemd/v22 v22.7.0
@@ -28,7 +29,6 @@ require (
) )
require ( require (
cyphar.com/go-pathrs v0.2.5 // indirect
github.com/cilium/ebpf v0.17.3 // indirect github.com/cilium/ebpf v0.17.3 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect
+4
View File
@@ -48,6 +48,10 @@ func printVersion(c *cli.Context) {
if major+minor+micro > 0 { if major+minor+micro > 0 {
fmt.Fprintf(w, "libseccomp: %d.%d.%d\n", major, minor, micro) fmt.Fprintf(w, "libseccomp: %d.%d.%d\n", major, minor, micro)
} }
if v := pathrsVersionString(); v != "" {
fmt.Fprintf(w, "libpathrs: %s\n", v)
}
} }
const ( const (
+3
View File
@@ -22,4 +22,7 @@ const (
// AnnotationLibseccompVersion is the version of libseccomp, e.g., "2.5.1". // AnnotationLibseccompVersion is the version of libseccomp, e.g., "2.5.1".
// Note that the runtime MAY support seccomp even when this annotation is not present. // Note that the runtime MAY support seccomp even when this annotation is not present.
AnnotationLibseccompVersion = "io.github.seccomp.libseccomp.version" AnnotationLibseccompVersion = "io.github.seccomp.libseccomp.version"
// AnnotationLibpathrsVersion is the runtime version of libpathrs.
AnnotationLibpathrsVersion = "com.cyphar.pathrs.libpathrs.version"
) )