linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Shuah Khan <skhan@linuxfoundation.org>
Cc: jpoimboe@redhat.com, jikos@kernel.org, mbenes@suse.cz,
	joe.lawrence@redhat.com, shuah@kernel.org,
	live-patching@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests: livepatch: Fix it to do root uid check and skip
Date: Mon, 16 Dec 2019 09:37:54 +0100	[thread overview]
Message-ID: <20191216083754.hsmdd6jt2zzjmksz@pathway.suse.cz> (raw)
In-Reply-To: <bda9819d-a054-232b-e973-41d41dfffc5a@linuxfoundation.org>

On Fri 2019-12-13 10:52:32, Shuah Khan wrote:
> On 12/13/19 1:34 AM, Petr Mladek wrote:
> > On Thu 2019-12-12 18:56:17, Shuah Khan wrote:
> > > livepatch test configures the system and debug environment to run
> > > tests. Some of these actions fail without root access and test
> > > dumps several permission denied messages before it exits.
> > > 
> > > Fix it to check root uid and exit with skip code instead.
> > 
> > It works when I run the tests directly, e.g.
> > 
> > $> cd tools/testing/selftests/livepatch
> > $> ./test-livepatch.sh
> > 
> > But I still get an error from the selftest framework when running
> > make run_tests:
> > 
> > $> make run_tests
> > TAP version 13
> > 1..5
> > # selftests: livepatch: test-livepatch.sh
> > /mnt/kernel/linux/tools/testing/selftests/kselftest/runner.sh: line 43: /dev/stdout: Permission denied
> > not ok 1 selftests: livepatch: test-livepatch.sh # exit=1
> > # selftests: livepatch: test-callbacks.sh
> > /mnt/kernel/linux/tools/testing/selftests/kselftest/runner.sh: line 43: /dev/stdout: Permission denied
> > not ok 2 selftests: livepatch: test-callbacks.sh # exit=1
> > # selftests: livepatch: test-shadow-vars.sh
> > /mnt/kernel/linux/tools/testing/selftests/kselftest/runner.sh: line 43: /dev/stdout: Permission denied
> > not ok 3 selftests: livepatch: test-shadow-vars.sh # exit=1
> > # selftests: livepatch: test-state.sh
> > /mnt/kernel/linux/tools/testing/selftests/kselftest/runner.sh: line 43: /dev/stdout: Permission denied
> > not ok 4 selftests: livepatch: test-state.sh # exit=1
> > # selftests: livepatch: test-ftrace.sh
> > /mnt/kernel/linux/tools/testing/selftests/kselftest/runner.sh: line 43: /dev/stdout: Permission denied
> > not ok 5 selftests: livepatch: test-ftrace.sh # exit=1
> > 
> > The same problem is also in linux-next. Is this a know problem, please?
> > 
> > 
> 
> This isn't a known issue.
> 
> I am not seeing this problem on 5.5-rc1 and on linux-next with top
> commit 32b8acf85223448973ca0bf0ee8149a01410f3a0 (HEAD -> master, tag:
> next-20191213
> 
> I am curious what could be diffent in your env. that is causing it.

I did the test in kvm. I was connected there via ssh as "root".
I tested the normal user with "su - user".

It seems that in this case /dev/stdout still points to a
pseudo-terminal that is accessible only by root:

#> su - user
$> echo hello >/dev/stdout
-bash: /dev/stdout: Permission denied
$> ls -l /dev/stdout
lrwxrwxrwx 1 root root 15 Dec 13 16:08 /dev/stdout -> /proc/self/fd/1
$> ls -l /proc/self/fd/1
lrwx------. 1 user users 64 Dec 16 09:27 /proc/self/fd/1 -> /dev/pts/1
$> ls -l /dev/pts/1
crw--w---- 1 root tty 136, 1 Dec 16 09:27 /dev/pts/1

I do not see this problem when I ssh to the machine as
the normal "user".


Best Regards,
Petr

      reply	other threads:[~2019-12-16  8:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-13  1:56 [PATCH] selftests: livepatch: Fix it to do root uid check and skip Shuah Khan
2019-12-13  8:34 ` Petr Mladek
2019-12-13 17:52   ` Shuah Khan
2019-12-16  8:37     ` Petr Mladek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191216083754.hsmdd6jt2zzjmksz@pathway.suse.cz \
    --to=pmladek@suse.com \
    --cc=jikos@kernel.org \
    --cc=joe.lawrence@redhat.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).