Re: [PATCH v5 06/10] KVM: selftests: Add NX huge pages test

From: Sean Christopherson
Date: Thu Apr 14 2022 - 17:36:41 EST


On Thu, Apr 14, 2022, Ben Gardon wrote:
> On Wed, Apr 13, 2022 at 3:35 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
> > > diff --git a/tools/testing/selftests/kvm/x86_64/nx_huge_pages_test.sh b/tools/testing/selftests/kvm/x86_64/nx_huge_pages_test.sh
> > > new file mode 100755
> > > index 000000000000..19fc95723fcb
> > > --- /dev/null
> > > +++ b/tools/testing/selftests/kvm/x86_64/nx_huge_pages_test.sh
> > > @@ -0,0 +1,25 @@
> > > +#!/bin/bash
> > > +# SPDX-License-Identifier: GPL-2.0-only */
> > > +
> > > +# tools/testing/selftests/kvm/nx_huge_page_test.sh
> > > +# Copyright (C) 2022, Google LLC.
> >
> > This should either check for root or use sudo.
>
> Is there not any scenario where the below setup commands could work
> without root?

Technically, yes, someone could be running the test as a non-root user with
the necessary permissions. Practically speaking, I would be surprised if anyone
configures module params in that way.

That said, there's certainly no harm in using sudo as a fall back.