mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
kernel: check that a task has a network namespace
task.GetNetworkNamespace has to be used when we try to access a remote task. PiperOrigin-RevId: 552593738
This commit is contained in:
@@ -43,7 +43,12 @@ func (fs *filesystem) newTaskNetDir(ctx context.Context, task *kernel.Task) kern
|
||||
root := auth.NewRootCredentials(pidns.UserNamespace())
|
||||
|
||||
var contents map[string]kernfs.Inode
|
||||
if stack := task.NetworkNamespace().Stack(); stack != nil {
|
||||
var stack inet.Stack
|
||||
if netns := task.GetNetworkNamespace(); netns != nil {
|
||||
netns.DecRef(ctx)
|
||||
stack = netns.Stack()
|
||||
}
|
||||
if stack != nil {
|
||||
const (
|
||||
arp = "IP address HW type Flags HW address Mask Device\n"
|
||||
netlink = "sk Eth Pid Groups Rmem Wmem Dump Locks Drops Inode\n"
|
||||
|
||||
Reference in New Issue
Block a user