Skip to contentSkip to conversation

runqemu: drop RPC ports

PATCH In review Robert Yang 3 participants 6 messages Jun 22, 2017 – Jun 23, 2017

lore
Share & tools
lore
#0 lore raw

cover runqemu: drop RPC ports

The following changes since commit 9ea5a31776440abd6468f003c5e1905f079446d3:

ovmf: fix secureboot PACKAGECONFIG + OpenSSL update (2017-06-16 10:58:23 +0100)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib rbt/runqemu
http://cgit.openembedded.org/openembedded-core-contrib/log/?h=rbt/runqemu

Robert Yang (1):
runqemu: drop RPC ports

 scripts/runqemu | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 runqemu: drop RPC ports

The following commit has removed rpc ports from runqemu-export-rootfs, so runqemu should also remove them, otherwise "runqemu nfs" doesn't work. And use abspath for nfsroot, otherwise it doesn't work when it is a relative path.

commit 6bb9860ef7ba9c84fe9bd3a81aa6555f67ebd38e

Author: Cody P Schafer <[email protected]>
Date:   Tue Jun 6 18:30:49 2017 -0400

runqemu-export-rootfs: don't change RPC ports

[YOCTO #11687]

---
 scripts/runqemu | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
scripts/runqemu +2 -6
index 26328e5b512..41b870c9f7c 100755
@@ -784,16 +784,12 @@ class BaseConfig(object):
             all_instances.sort(key=int)
             self.nfs_instance = int(all_instances.pop()) + 1
 
-        mountd_rpcport = 21111 + self.nfs_instance
-        nfsd_rpcport = 11111 + self.nfs_instance
         nfsd_port = 3049 + 2 * self.nfs_instance
         mountd_port = 3048 + 2 * self.nfs_instance
 
         # Export vars for runqemu-export-rootfs
         export_dict = {
             'NFS_INSTANCE': self.nfs_instance,
-            'MOUNTD_RPCPORT': mountd_rpcport,
-            'NFSD_RPCPORT': nfsd_rpcport,
             'NFSD_PORT': nfsd_port,
             'MOUNTD_PORT': mountd_port,
         }
@@ -801,7 +797,7 @@ class BaseConfig(object):
             # Use '%s' since they are integers
             os.putenv(k, '%s' % v)
 
-        self.unfs_opts="nfsvers=3,port=%s,mountprog=%s,nfsprog=%s,udp,mountport=%s" % (nfsd_port, mountd_rpcport, nfsd_rpcport, mountd_port)
+        self.unfs_opts="nfsvers=3,port=%s,udp,mountport=%s" % (nfsd_port, mountd_port)
 
         # Extract .tar.bz2 or .tar.bz if no nfs dir
         if not (self.rootfs and os.path.isdir(self.rootfs)):
@@ -1006,7 +1002,7 @@ class BaseConfig(object):
 
         if self.fstype == 'nfs':
             self.rootfs_options = ''
-            k_root = '/dev/nfs nfsroot=%s:%s,%s' % (self.nfs_server, self.rootfs, self.unfs_opts)
+            k_root = '/dev/nfs nfsroot=%s:%s,%s' % (self.nfs_server, os.path.abspath(self.rootfs), self.unfs_opts)
             self.kernel_cmdline = 'root=%s rw highres=off' % k_root
 
         if self.fstype == 'none':
Signature · 1 line
2.11.0
#2 lore raw

looks good 2 me!
ty,
b
an intel employee

Quoted 70 lines · Robert Yang

The following commit has removed rpc ports from runqemu-export-rootfs, so runqemu should also remove them, otherwise "runqemu nfs" doesn't work. And use
abspath for nfsroot, otherwise it doesn't work when it is a relative path.

commit 6bb9860ef7ba9c84fe9bd3a81aa6555f67ebd38e

Author: Cody P Schafer <[email protected]>
Date:   Tue Jun 6 18:30:49 2017 -0400

runqemu-export-rootfs: don't change RPC ports

[YOCTO #11687]

---
 scripts/runqemu | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
scripts/runqemu +1 -5
index 26328e5b512..41b870c9f7c 100755
@@ -784,16 +784,12 @@ class BaseConfig(object):
             all_instances.sort(key=int)
             self.nfs_instance = int(all_instances.pop()) + 1
 
-        mountd_rpcport = 21111 + self.nfs_instance
-        nfsd_rpcport = 11111 + self.nfs_instance
         nfsd_port = 3049 + 2 * self.nfs_instance
         mountd_port = 3048 + 2 * self.nfs_instance
 
         # Export vars for runqemu-export-rootfs
         export_dict = {
             'NFS_INSTANCE': self.nfs_instance,
-            'MOUNTD_RPCPORT': mountd_rpcport,
-            'NFSD_RPCPORT': nfsd_rpcport,
             'NFSD_PORT': nfsd_port,
             'MOUNTD_PORT': mountd_port,
         }
@@ -801,7 +797,7 @@ class BaseConfig(object):
             # Use '%s' since they are integers
             os.putenv(k, '%s' % v)
 
-        self.unfs_opts="nfsvers=3,port=%s,mountprog=%s,nfsprog=%s,udp,mountport=%s"
 % (nfsd_port, mountd_rpcport, nfsd_rpcport, mountd_port)
+        self.unfs_opts="nfsvers=3,port=%s,udp,mountport=%s" %
 (nfsd_port, mountd_port)
 

# Extract .tar.bz2 or .tar.bz if no nfs dir if not (self.rootfs and os.path.isdir(self.rootfs)):

scripts/runqemu +1 -1
@@ -1006,7 +1002,7 @@ class BaseConfig(object):
 
         if self.fstype == 'nfs':
             self.rootfs_options = ''
-            k_root = '/dev/nfs nfsroot=%s:%s,%s' % (self.nfs_server,
 self.rootfs, self.unfs_opts)
+            k_root = '/dev/nfs nfsroot=%s:%s,%s' % (self.nfs_server,
 os.path.abspath(self.rootfs), self.unfs_opts)
             self.kernel_cmdline = 'root=%s rw highres=off' % k_root
         if self.fstype == 'none':

--
2.11.0

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#3 lore raw
In reply to Robert Yang
Quoted 6 lines · Robert Yang

The following commit has removed rpc ports from runqemu-export-rootfs, so runqemu should also remove them, otherwise "runqemu nfs" doesn't work. And use
abspath for nfsroot, otherwise it doesn't work when it is a relative path.

That change in question was discussed on list and was supposed to be optional.

Can you confirm that a non-root user can still do a NFS root with both of these changes applied ?

Bruce

Quoted 65 lines

commit 6bb9860ef7ba9c84fe9bd3a81aa6555f67ebd38e

Author: Cody P Schafer <[email protected]>
Date:   Tue Jun 6 18:30:49 2017 -0400

runqemu-export-rootfs: don't change RPC ports

[YOCTO #11687]

---
 scripts/runqemu | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
scripts/runqemu +1 -5
index 26328e5b512..41b870c9f7c 100755
@@ -784,16 +784,12 @@ class BaseConfig(object):
             all_instances.sort(key=int)
             self.nfs_instance = int(all_instances.pop()) + 1
 
-        mountd_rpcport = 21111 + self.nfs_instance
-        nfsd_rpcport = 11111 + self.nfs_instance
         nfsd_port = 3049 + 2 * self.nfs_instance
         mountd_port = 3048 + 2 * self.nfs_instance
 
         # Export vars for runqemu-export-rootfs
         export_dict = {
             'NFS_INSTANCE': self.nfs_instance,
-            'MOUNTD_RPCPORT': mountd_rpcport,
-            'NFSD_RPCPORT': nfsd_rpcport,
             'NFSD_PORT': nfsd_port,
             'MOUNTD_PORT': mountd_port,
         }
@@ -801,7 +797,7 @@ class BaseConfig(object):
             # Use '%s' since they are integers
             os.putenv(k, '%s' % v)
 
-        self.unfs_opts="nfsvers=3,port=%s,mountprog=%s,nfsprog=%s,udp,mountport=%s"
 % (nfsd_port, mountd_rpcport, nfsd_rpcport, mountd_port)
+        self.unfs_opts="nfsvers=3,port=%s,udp,mountport=%s" %
 (nfsd_port, mountd_port)
 

# Extract .tar.bz2 or .tar.bz if no nfs dir if not (self.rootfs and os.path.isdir(self.rootfs)):

scripts/runqemu +1 -1
@@ -1006,7 +1002,7 @@ class BaseConfig(object):
 
         if self.fstype == 'nfs':
             self.rootfs_options = ''
-            k_root = '/dev/nfs nfsroot=%s:%s,%s' % (self.nfs_server,
 self.rootfs, self.unfs_opts)
+            k_root = '/dev/nfs nfsroot=%s:%s,%s' % (self.nfs_server,
 os.path.abspath(self.rootfs), self.unfs_opts)
             self.kernel_cmdline = 'root=%s rw highres=off' % k_root
         if self.fstype == 'none':

--
2.11.0

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end"
#4 lore raw
Quoted 10 lines · Bruce Ashfield

On Thu, Jun 22, 2017 at 4:30 AM, Robert Yang <[email protected] <mailto:[email protected]>> wrote:

The following commit has removed rpc ports from runqemu-export-rootfs, so runqemu should also remove them, otherwise "runqemu nfs" doesn't work. And use abspath for nfsroot, otherwise it doesn't work when it is a relative path.

Quoted 4 lines

That change in question was discussed on list and was supposed to be optional.

Can you confirm that a non-root user can still do a NFS root with both of these changes applied ?

The runqemu-export-rootfs uses UNFS, no root privilege is required, I can confirm that both "runqemu slirp nfs" and "runqemu nfs" work well, so I assume the answer is yes.

// Robert

Quoted 79 lines

Bruce

    commit 6bb9860ef7ba9c84fe9bd3a81aa6555f67ebd38e
    Author: Cody P Schafer <[email protected] <mailto:[email protected]>>
    Date:   Tue Jun 6 18:30:49 2017 -0400

        runqemu-export-rootfs: don't change RPC ports

    [YOCTO #11687]

    Signed-off-by: Robert Yang <[email protected]
    <mailto:[email protected]>>
    ---
     scripts/runqemu | 8 ++------
     1 file changed, 2 insertions(+), 6 deletions(-)

    diff --git a/scripts/runqemu b/scripts/runqemu
    index 26328e5b512..41b870c9f7c 100755
    --- a/scripts/runqemu
    +++ b/scripts/runqemu
    @@ -784,16 +784,12 @@ class BaseConfig(object):
                 all_instances.sort(key=int)
                 self.nfs_instance = int(all_instances.pop()) + 1

    -        mountd_rpcport = 21111 + self.nfs_instance
    -        nfsd_rpcport = 11111 + self.nfs_instance
             nfsd_port = 3049 + 2 * self.nfs_instance
             mountd_port = 3048 + 2 * self.nfs_instance

             # Export vars for runqemu-export-rootfs
             export_dict = {
                 'NFS_INSTANCE': self.nfs_instance,
    -            'MOUNTD_RPCPORT': mountd_rpcport,
    -            'NFSD_RPCPORT': nfsd_rpcport,
                 'NFSD_PORT': nfsd_port,
                 'MOUNTD_PORT': mountd_port,
             }
    @@ -801,7 +797,7 @@ class BaseConfig(object):
                 # Use '%s' since they are integers
                 os.putenv(k, '%s' % v)

    -
    self.unfs_opts="nfsvers=3,port=%s,mountprog=%s,nfsprog=%s,udp,mountport=%s"
    % (nfsd_port, mountd_rpcport, nfsd_rpcport, mountd_port)
    +        self.unfs_opts="nfsvers=3,port=%s,udp,mountport=%s" % (nfsd_port,
    mountd_port)

             # Extract .tar.bz2 or .tar.bz <http://tar.bz> if no nfs dir
             if not (self.rootfs and os.path.isdir(self.rootfs)):
    @@ -1006,7 +1002,7 @@ class BaseConfig(object):

             if self.fstype == 'nfs':
                 self.rootfs_options = ''
    -            k_root = '/dev/nfs nfsroot=%s:%s,%s' % (self.nfs_server,
    self.rootfs, self.unfs_opts)
    +            k_root = '/dev/nfs nfsroot=%s:%s,%s' % (self.nfs_server,
    os.path.abspath(self.rootfs), self.unfs_opts)
                 self.kernel_cmdline = 'root=%s rw highres=off' % k_root

             if self.fstype == 'none':
    --
    2.11.0

    --
    _______________________________________________
    Openembedded-core mailing list
    [email protected]
    <mailto:[email protected]>
    http://lists.openembedded.org/mailman/listinfo/openembedded-core
    <http://lists.openembedded.org/mailman/listinfo/openembedded-core>

--
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"

#5 lore raw
Quoted 25 lines · Robert Yang
Quoted 13 lines · Bruce Ashfield

On Thu, Jun 22, 2017 at 4:30 AM, Robert Yang <[email protected] <mailto:[email protected]>> wrote:

The following commit has removed rpc ports from
runqemu-export-rootfs, so
runqemu should also remove them, otherwise "runqemu nfs" doesn't
work. And use
abspath for nfsroot, otherwise it doesn't work when it is a relative
path.

Quoted 7 lines

That change in question was discussed on list and was supposed to be optional.

Can you confirm that a non-root user can still do a NFS root with both of these
changes applied ?

Quoted 5 lines

The runqemu-export-rootfs uses UNFS, no root privilege is required, I can confirm that both "runqemu slirp nfs" and "runqemu nfs" work well, so I assume
the answer is yes.

Yes, that's good enough to confirm the old functionality. As long as non-privileged ports can be used, we should be fine.

Bruce

Quoted 88 lines

// Robert

Quoted 83 lines

Bruce

    commit 6bb9860ef7ba9c84fe9bd3a81aa6555f67ebd38e
    Author: Cody P Schafer <[email protected] <mailto:[email protected]>>
    Date:   Tue Jun 6 18:30:49 2017 -0400

        runqemu-export-rootfs: don't change RPC ports

    [YOCTO #11687]

    Signed-off-by: Robert Yang <[email protected]
    <mailto:[email protected]>>

    ---
     scripts/runqemu | 8 ++------
     1 file changed, 2 insertions(+), 6 deletions(-)

    diff --git a/scripts/runqemu b/scripts/runqemu
    index 26328e5b512..41b870c9f7c 100755
    --- a/scripts/runqemu
    +++ b/scripts/runqemu
    @@ -784,16 +784,12 @@ class BaseConfig(object):
                 all_instances.sort(key=int)
                 self.nfs_instance = int(all_instances.pop()) + 1

    -        mountd_rpcport = 21111 + self.nfs_instance
    -        nfsd_rpcport = 11111 + self.nfs_instance
             nfsd_port = 3049 + 2 * self.nfs_instance
             mountd_port = 3048 + 2 * self.nfs_instance

             # Export vars for runqemu-export-rootfs
             export_dict = {
                 'NFS_INSTANCE': self.nfs_instance,
    -            'MOUNTD_RPCPORT': mountd_rpcport,
    -            'NFSD_RPCPORT': nfsd_rpcport,
                 'NFSD_PORT': nfsd_port,
                 'MOUNTD_PORT': mountd_port,
             }
    @@ -801,7 +797,7 @@ class BaseConfig(object):
                 # Use '%s' since they are integers
                 os.putenv(k, '%s' % v)

    -
    self.unfs_opts="nfsvers=3,port=%s,mountprog=%s,nfsprog=%s,

udp,mountport=%s"
% (nfsd_port, mountd_rpcport, nfsd_rpcport, mountd_port)
+ self.unfs_opts="nfsvers=3,port=%s,udp,mountport=%s" %
(nfsd_port,
mountd_port)

# Extract .tar.bz2 or .tar.bz <http://tar.bz> if no nfs dir if not (self.rootfs and os.path.isdir(self.rootfs)):
@@ -1006,7 +1002,7 @@ class BaseConfig(object):

if self.fstype == 'nfs':
self.rootfs_options = ''
- k_root = '/dev/nfs nfsroot=%s:%s,%s' % (self.nfs_server,
self.rootfs, self.unfs_opts)
+ k_root = '/dev/nfs nfsroot=%s:%s,%s' % (self.nfs_server,
os.path.abspath(self.rootfs), self.unfs_opts)
self.kernel_cmdline = 'root=%s rw highres=off' % k_root

if self.fstype == 'none':
--
2.11.0

--
_______________________________________________
Openembedded-core mailing list [email protected] <mailto:[email protected]>
http://lists.openembedded.org/mailman/listinfo/openembedded-core
<http://lists.openembedded.org/mailman/listinfo/openembedded-core>

--
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its
end"

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end"