Re: [uml-devel] [PATCH v3 0/6] um: Output messages to stderr and support quiet option

2017-07-05 Thread Richard Weinberger
Masami,

On Wed, May 17, 2017 at 7:13 PM, Masami Hiramatsu  wrote:
> Hello,
>
> Here is version 3 of um-quiet series. In this version
> I just fixed some printf format issues.
>
> V2 is here.
>
>  https://lkml.org/lkml/2017/5/8/35
>
> This series fixes some boot time printf output to stderr
> by adding os_info() and os_warn(). The information-level
> messages via os_info() are suppressed when "quiet" kernel
> option is specified.
> Also the last one allows user to pass "console=" option
> to kernel.
>
> Note that the output of --help and --version are still
> sent to stdout since they are intentionally shown by
> the user.
>
> Changes from v2:
>   - Cast rlim_min/max to unsigned long long explicitly
> for avoiding printf-format warning.
>   - Fix printf format in physmem.c so that it matches
> the type of arguments.
>
> Thank you,
>
> ---
>
> Masami Hiramatsu (6):
>   um: Use printk instead of printf in make_uml_dir
>   um: Add os_info() for pre-boot information messages
>   um: Use os_info for the messages on normal path
>   um: Add os_warn() for pre-boot warning/error messages
>   um: Use os_warn to print out pre-boot warning/error messages
>   um: console: Ignore console= option
>
>

Series applied. Thanks!

-- 
Thanks,
//richard

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] [PATCH 1/3] um: stub-data.h: remove superfluous include

2017-07-05 Thread Richard Weinberger
Thomas,

On Sun, May 14, 2017 at 5:03 PM, Thomas Meyer  wrote:
> Signed-off-by: Thomas Meyer 
> ---
>  arch/um/include/shared/skas/stub-data.h | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/arch/um/include/shared/skas/stub-data.h
> b/arch/um/include/shared/skas/stub-data.h
> index a9deece..13f404e 100644
> --- a/arch/um/include/shared/skas/stub-data.h
> +++ b/arch/um/include/shared/skas/stub-data.h
> @@ -8,8 +8,6 @@
>  #ifndef __STUB_DATA_H
>  #define __STUB_DATA_H
>
> -#include 
> -
>  struct stub_data {
>   unsigned long offset;
>   int fd;
>

All three patches are malformed and don't apply. :-(

-- 
Thanks,
//richard

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] [PATCH] um: userspace - be more verbose in ptrace set regs error

2017-07-05 Thread Richard Weinberger
Thomas,

On Wed, May 24, 2017 at 12:45 AM, Thomas Meyer  wrote:
> When ptrace fails to set GP/FP regs for the target process,
> log the error before crashing the UML kernel.
>
> Signed-off-by: Thomas Meyer 
> ---
>  arch/um/os-Linux/skas/process.c | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
> index 4530867..819d686 100644
> --- a/arch/um/os-Linux/skas/process.c
> +++ b/arch/um/os-Linux/skas/process.c
> @@ -352,11 +352,17 @@ void userspace(struct uml_pt_regs *regs)
>  * fail.  In this case, there is nothing to do but
>  * just kill the process.
>  */
> -   if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp))
> +   if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp)) {
> +   printk(UM_KERN_ERR "userspace - ptrace set regs "
> +  "failed, errno = %d\n", errno);
> fatal_sigsegv();
> +   }
>
> -   if (put_fp_registers(pid, regs->fp))
> +   if (put_fp_registers(pid, regs->fp)) {
> +   printk(UM_KERN_ERR "userspace - ptrace set fp regs "
> +  "failed, errno = %d\n", errno);
> fatal_sigsegv();
> +   }
>
> /* Now we set local_using_sysemu to be used for one loop */
> local_using_sysemu = get_using_sysemu();
>
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> User-mode-linux-devel mailing list
> User-mode-linux-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

This patch is also malformed. :-(

-- 
Thanks,
//richard

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] [PATCH] um: userspace - be more verbose in ptrace set regs error

2017-07-05 Thread Thomas Meyer
Am Mittwoch, den 05.07.2017, 23:34 +0200 schrieb Richard Weinberger:
> Thomas,
> 
> On Wed, May 24, 2017 at 12:45 AM, Thomas Meyer 
> wrote:
> > When ptrace fails to set GP/FP regs for the target process,
> > log the error before crashing the UML kernel.
> > 
> > Signed-off-by: Thomas Meyer 
> > ---
> >  arch/um/os-Linux/skas/process.c | 10 --
> >  1 file changed, 8 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-
> > Linux/skas/process.c
> > index 4530867..819d686 100644
> > --- a/arch/um/os-Linux/skas/process.c
> > +++ b/arch/um/os-Linux/skas/process.c
> > @@ -352,11 +352,17 @@ void userspace(struct uml_pt_regs *regs)
> >  * fail.  In this case, there is nothing to do but
> >  * just kill the process.
> >  */
> > -   if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp))
> > +   if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp)) {
> > +   printk(UM_KERN_ERR "userspace - ptrace set
> > regs "
> > +  "failed, errno = %d\n", errno);
> > fatal_sigsegv();
> > +   }
> > 
> > -   if (put_fp_registers(pid, regs->fp))
> > +   if (put_fp_registers(pid, regs->fp)) {
> > +   printk(UM_KERN_ERR "userspace - ptrace set
> > fp regs "
> > +  "failed, errno = %d\n", errno);
> > fatal_sigsegv();
> > +   }
> > 
> > /* Now we set local_using_sysemu to be used for one
> > loop */
> > local_using_sysemu = get_using_sysemu();
> > 
> > -
> > -
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > ___
> > User-mode-linux-devel mailing list
> > User-mode-linux-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
> 
> This patch is also malformed. :-(

I wonder why evolution is messing up my emails...

will check and resend...

sorry and kind regards
thomas

> 

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] [PATCH] um: userspace - be more verbose in ptrace set regs error

2017-07-05 Thread Richard Weinberger
Thomas,

Am 06.07.2017 um 00:06 schrieb Thomas Meyer:
>> This patch is also malformed. :-(
> 
> I wonder why evolution is messing up my emails...
> 
> will check and resend...

Just use git send-email :)

Thanks,
//richard

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH] um: userspace - be more verbose in ptrace set regs error

2017-07-05 Thread Thomas Meyer
When ptrace fails to set GP/FP regs for the target process,
log the error before crashing the UML kernel.

Signed-off-by: Thomas Meyer 
---
 arch/um/os-Linux/skas/process.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index 4530867..819d686 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -352,11 +352,17 @@ void userspace(struct uml_pt_regs *regs)
 * fail.  In this case, there is nothing to do but
 * just kill the process.
 */
-   if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp))
+   if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp)) {
+   printk(UM_KERN_ERR "userspace - ptrace set regs "
+  "failed, errno = %d\n", errno);
fatal_sigsegv();
+   }
 
-   if (put_fp_registers(pid, regs->fp))
+   if (put_fp_registers(pid, regs->fp)) {
+   printk(UM_KERN_ERR "userspace - ptrace set fp regs "
+  "failed, errno = %d\n", errno);
fatal_sigsegv();
+   }
 
/* Now we set local_using_sysemu to be used for one loop */
local_using_sysemu = get_using_sysemu();
-- 
2.9.4


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 1/3] um: stub-data.h: remove superfluous include

2017-07-05 Thread Thomas Meyer
Signed-off-by: Thomas Meyer 
---
 arch/um/include/shared/skas/stub-data.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/um/include/shared/skas/stub-data.h 
b/arch/um/include/shared/skas/stub-data.h
index a9deece..13f404e 100644
--- a/arch/um/include/shared/skas/stub-data.h
+++ b/arch/um/include/shared/skas/stub-data.h
@@ -8,8 +8,6 @@
 #ifndef __STUB_DATA_H
 #define __STUB_DATA_H
 
-#include 
-
 struct stub_data {
unsigned long offset;
int fd;
-- 
2.9.3


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 2/3] um: Add kerneldoc for segv_handler

2017-07-05 Thread Thomas Meyer
Signed-off-by: Thomas Meyer 
---
 arch/um/kernel/trap.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c
index 5915887..4e6fcb3 100644
--- a/arch/um/kernel/trap.c
+++ b/arch/um/kernel/trap.c
@@ -183,6 +183,16 @@ void fatal_sigsegv(void)
os_dump_core();
 }
 
+/**
+ * segv_handler() - the SIGSEGV handler
+ * @sig:   the signal number
+ * @unused_si: the signal info struct; unused in this handler
+ * @regs:  the ptrace register information
+ *
+ * The handler first extracts the faultinfo from the UML ptrace regs struct.
+ * If the userfault did not happen in an UML userspace process, bad_segv is 
called.
+ * Otherwise the signal did happen in a cloned userspace process, handle it.
+ */
 void segv_handler(int sig, struct siginfo *unused_si, struct uml_pt_regs *regs)
 {
struct faultinfo * fi = UPT_FAULTINFO(regs);
-- 
2.9.3


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 3/3] um: Add kerneldoc for userspace_tramp() and start_userspace()

2017-07-05 Thread Thomas Meyer
Also use correct function name spelling (stub_segv_handler) for better grepping

Signed-off-by: Thomas Meyer 
---
 arch/um/os-Linux/skas/process.c | 31 ++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index 03b3c4c..4530867 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -108,7 +108,7 @@ static void get_skas_faultinfo(int pid, struct faultinfo 
*fi)
wait_stub_done(pid);
 
/*
-* faultinfo is prepared by the stub-segv-handler at start of
+* faultinfo is prepared by the stub_segv_handler at start of
 * the stub stack page. We just have to copy it.
 */
memcpy(fi, (void *)current_stub_stack(), sizeof(*fi));
@@ -175,6 +175,21 @@ static void handle_trap(int pid, struct uml_pt_regs *regs,
 
 extern char __syscall_stub_start[];
 
+/**
+ * userspace_tramp() - userspace trampoline
+ * @stack: pointer to the new userspace stack page, can be NULL, if? FIXME:
+ *
+ * The userspace trampoline is used to setup a new userspace process in 
start_userspace() after it was clone()'ed.
+ * This function will run on a temporary stack page.
+ * It ptrace()'es itself, then
+ * Two pages are mapped into the userspace address space:
+ * - STUB_CODE (with EXEC), which contains the skas stub code
+ * - STUB_DATA (with R/W), which contains a data page that is used to transfer 
certain data between the UML userspace process and the UML kernel.
+ * Also for the userspace process a SIGSEGV handler is installed to catch 
pagefaults in the userspace process.
+ * And last the process stops itself to give control to the UML kernel for 
this userspace process.
+ *
+ * Return: Always zero, otherwise the current userspace process is ended with 
non null exit() call
+ */
 static int userspace_tramp(void *stack)
 {
void *addr;
@@ -236,12 +251,24 @@ static int userspace_tramp(void *stack)
 
 int userspace_pid[NR_CPUS];
 
+/**
+ * start_userspace() - prepare a new userspace process
+ * @stub_stack:pointer to the stub stack. Can be NULL, if? FIXME:
+ *
+ * Setups a new temporary stack page that is used while userspace_tramp() runs
+ * Clones the kernel process into a new userspace process, with FDs only.
+ *
+ * Return: When positive: the process id of the new userspace process,
+ * when negative: an error number.
+ * FIXME: can PIDs become negative?!
+ */
 int start_userspace(unsigned long stub_stack)
 {
void *stack;
unsigned long sp;
int pid, status, n, flags, err;
 
+   /* setup a temporary stack page */
stack = mmap(NULL, UM_KERN_PAGE_SIZE,
 PROT_READ | PROT_WRITE | PROT_EXEC,
 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
@@ -252,10 +279,12 @@ int start_userspace(unsigned long stub_stack)
return err;
}
 
+   /* set stack pointer to the end of the stack page, so it can grow 
downwards */
sp = (unsigned long) stack + UM_KERN_PAGE_SIZE - sizeof(void *);
 
flags = CLONE_FILES | SIGCHLD;
 
+   /* clone into new userspace process */
pid = clone(userspace_tramp, (void *) sp, flags, (void *) stub_stack);
if (pid < 0) {
err = -errno;
-- 
2.9.3


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [uml:linux-next 7/9] arch/um/os-Linux/skas/process.c:579:1: warning: control reaches end of non-void function

2017-07-05 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/rw/uml.git linux-next
head:   1bcbfbfdeb0091036db7a32e1cd31b49cce5983a
commit: f44f1e7da7c8e3f4575d5d61c4df978496903fcc [7/9] um: Avoid longjmp/setjmp 
symbol clashes with libpthread.a
config: um-x86_64_defconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
git checkout f44f1e7da7c8e3f4575d5d61c4df978496903fcc
# save the attached .config to linux build tree
make ARCH=um SUBARCH=x86_64

All warnings (new ones prefixed by >>):

   arch/um/os-Linux/skas/process.c: In function 'start_idle_thread':
>> arch/um/os-Linux/skas/process.c:579:1: warning: control reaches end of 
>> non-void function [-Wreturn-type]
}
^

vim +579 arch/um/os-Linux/skas/process.c

abaf6977 Gennady Sharapov 2006-01-18  563   case INIT_JMP_CALLBACK:
abaf6977 Gennady Sharapov 2006-01-18  564   (*cb_proc)(cb_arg);
77f6af77 Jeff Dike2007-05-06  565   longjmp(*cb_back, 1);
abaf6977 Gennady Sharapov 2006-01-18  566   break;
abaf6977 Gennady Sharapov 2006-01-18  567   case INIT_JMP_HALT:
abaf6977 Gennady Sharapov 2006-01-18  568   kmalloc_ok = 0;
ba180fd4 Jeff Dike2007-10-16  569   return 0;
abaf6977 Gennady Sharapov 2006-01-18  570   case INIT_JMP_REBOOT:
abaf6977 Gennady Sharapov 2006-01-18  571   kmalloc_ok = 0;
ba180fd4 Jeff Dike2007-10-16  572   return 1;
abaf6977 Gennady Sharapov 2006-01-18  573   default:
3e6f2ac4 Jeff Dike2008-02-04  574   printk(UM_KERN_ERR "Bad 
sigsetjmp return in "
3e6f2ac4 Jeff Dike2008-02-04  575  
"start_idle_thread - %d\n", n);
3e6f2ac4 Jeff Dike2008-02-04  576   fatal_sigsegv();
abaf6977 Gennady Sharapov 2006-01-18  577   }
77f6af77 Jeff Dike2007-05-06  578   longjmp(*switch_buf, 1);
abaf6977 Gennady Sharapov 2006-01-18 @579  }
abaf6977 Gennady Sharapov 2006-01-18  580  
abaf6977 Gennady Sharapov 2006-01-18  581  void initial_thread_cb_skas(void 
(*proc)(void *), void *arg)
abaf6977 Gennady Sharapov 2006-01-18  582  {
ad28e029 Jeff Dike2006-04-18  583   jmp_buf here;
abaf6977 Gennady Sharapov 2006-01-18  584  
abaf6977 Gennady Sharapov 2006-01-18  585   cb_proc = proc;
abaf6977 Gennady Sharapov 2006-01-18  586   cb_arg = arg;
abaf6977 Gennady Sharapov 2006-01-18  587   cb_back = &here;

:: The code at line 579 was first introduced by commit
:: abaf69773d8dda98b917d94c07757f6520da7bec [PATCH] uml: move 
libc-dependent skas process handling

:: TO: Gennady Sharapov 
:: CC: Linus Torvalds 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel