Skip to content

Commit 6cff79f

Browse files
committed
Merge tag 'uml-for-linus-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux
Pull UML updates from Richard Weinberger: - Clang coverage support - Many cleanups from Benjamin Berg - Various minor fixes * tag 'uml-for-linus-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux: um: Mark 32bit syscall helpers as clobbering memory um: Remove unused register save/restore functions um: Rely on PTRACE_SETREGSET to set FS/GS base registers Documentation: kunit: Add clang UML coverage example arch: um: Add Clang coverage support um: time-travel: fix time corruption um: net: Fix return type of uml_net_start_xmit() um: Always inline stub functions um: Do not use printk in userspace trampoline um: Reap winch thread if it fails um: Do not use printk in SIGWINCH helper thread um: Don't use vfprintf() for os_info() um: Make errors to stop ptraced child fatal during startup um: Drop NULL check from start_userspace um: Drop support for hosts without SYSEMU_SINGLESTEP support um: document arch_futex_atomic_op_inuser um: mmu: remove stub_pages um: Fix naming clash between UML and scheduler um: virt-pci: fix platform map offset
2 parents 0c6bc37 + 83aec96 commit 6cff79f

34 files changed

+212
-459
lines changed

Documentation/dev-tools/kunit/running_tips.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,17 @@ If your installed version of gcc doesn't work, you can tweak the steps:
139139
$ ./tools/testing/kunit/kunit.py run --make_options=CC=/usr/bin/gcc-6
140140
$ lcov -t "my_kunit_tests" -o coverage.info -c -d .kunit/ --gcov-tool=/usr/bin/gcov-6
141141
142+
Alternatively, LLVM-based toolchains can also be used:
143+
144+
.. code-block:: bash
145+
146+
# Build with LLVM and append coverage options to the current config
147+
$ ./tools/testing/kunit/kunit.py run --make_options LLVM=1 --kunitconfig=.kunit/ --kunitconfig=tools/testing/kunit/configs/coverage_uml.config
148+
$ llvm-profdata merge -sparse default.profraw -o default.profdata
149+
$ llvm-cov export --format=lcov .kunit/vmlinux -instr-profile default.profdata > coverage.info
150+
# The coverage.info file is in lcov-compatible format and it can be used to e.g. generate HTML report
151+
$ genhtml -o /tmp/coverage_html coverage.info
152+
142153
143154
Running tests manually
144155
======================

arch/um/Makefile-skas

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
#
55

66
GPROF_OPT += -pg
7+
8+
ifdef CONFIG_CC_IS_CLANG
9+
GCOV_OPT += -fprofile-instr-generate -fcoverage-mapping
10+
else
711
GCOV_OPT += -fprofile-arcs -ftest-coverage
12+
endif
813

914
CFLAGS-$(CONFIG_GCOV) += $(GCOV_OPT)
1015
CFLAGS-$(CONFIG_GPROF) += $(GPROF_OPT)

arch/um/drivers/chan_user.c

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ struct winch_data {
141141
int pipe_fd;
142142
};
143143

144-
static int winch_thread(void *arg)
144+
static __noreturn int winch_thread(void *arg)
145145
{
146146
struct winch_data *data = arg;
147147
sigset_t sigs;
@@ -153,8 +153,8 @@ static int winch_thread(void *arg)
153153
pipe_fd = data->pipe_fd;
154154
count = write(pipe_fd, &c, sizeof(c));
155155
if (count != sizeof(c))
156-
printk(UM_KERN_ERR "winch_thread : failed to write "
157-
"synchronization byte, err = %d\n", -count);
156+
os_info("winch_thread : failed to write synchronization byte, err = %d\n",
157+
-count);
158158

159159
/*
160160
* We are not using SIG_IGN on purpose, so don't fix it as I thought to
@@ -166,29 +166,29 @@ static int winch_thread(void *arg)
166166
sigfillset(&sigs);
167167
/* Block all signals possible. */
168168
if (sigprocmask(SIG_SETMASK, &sigs, NULL) < 0) {
169-
printk(UM_KERN_ERR "winch_thread : sigprocmask failed, "
170-
"errno = %d\n", errno);
171-
exit(1);
169+
os_info("winch_thread : sigprocmask failed, errno = %d\n",
170+
errno);
171+
goto wait_kill;
172172
}
173173
/* In sigsuspend(), block anything else than SIGWINCH. */
174174
sigdelset(&sigs, SIGWINCH);
175175

176176
if (setsid() < 0) {
177-
printk(UM_KERN_ERR "winch_thread : setsid failed, errno = %d\n",
177+
os_info("winch_thread : setsid failed, errno = %d\n",
178178
errno);
179-
exit(1);
179+
goto wait_kill;
180180
}
181181

182182
if (ioctl(pty_fd, TIOCSCTTY, 0) < 0) {
183-
printk(UM_KERN_ERR "winch_thread : TIOCSCTTY failed on "
184-
"fd %d err = %d\n", pty_fd, errno);
185-
exit(1);
183+
os_info("winch_thread : TIOCSCTTY failed on "
184+
"fd %d err = %d\n", pty_fd, errno);
185+
goto wait_kill;
186186
}
187187

188188
if (tcsetpgrp(pty_fd, os_getpid()) < 0) {
189-
printk(UM_KERN_ERR "winch_thread : tcsetpgrp failed on "
190-
"fd %d err = %d\n", pty_fd, errno);
191-
exit(1);
189+
os_info("winch_thread : tcsetpgrp failed on fd %d err = %d\n",
190+
pty_fd, errno);
191+
goto wait_kill;
192192
}
193193

194194
/*
@@ -199,8 +199,8 @@ static int winch_thread(void *arg)
199199
*/
200200
count = read(pipe_fd, &c, sizeof(c));
201201
if (count != sizeof(c))
202-
printk(UM_KERN_ERR "winch_thread : failed to read "
203-
"synchronization byte, err = %d\n", errno);
202+
os_info("winch_thread : failed to read synchronization byte, err = %d\n",
203+
errno);
204204

205205
while(1) {
206206
/*
@@ -211,9 +211,15 @@ static int winch_thread(void *arg)
211211

212212
count = write(pipe_fd, &c, sizeof(c));
213213
if (count != sizeof(c))
214-
printk(UM_KERN_ERR "winch_thread : write failed, "
215-
"err = %d\n", errno);
214+
os_info("winch_thread : write failed, err = %d\n",
215+
errno);
216216
}
217+
218+
wait_kill:
219+
c = 2;
220+
count = write(pipe_fd, &c, sizeof(c));
221+
while (1)
222+
pause();
217223
}
218224

219225
static int winch_tramp(int fd, struct tty_port *port, int *fd_out,

arch/um/drivers/line.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -629,15 +629,18 @@ static irqreturn_t winch_interrupt(int irq, void *data)
629629

630630
if (fd != -1) {
631631
err = generic_read(fd, &c, NULL);
632-
if (err < 0) {
632+
/* A read of 2 means the winch thread failed and has warned */
633+
if (err < 0 || (err == 1 && c == 2)) {
633634
if (err != -EAGAIN) {
634635
winch->fd = -1;
635636
list_del(&winch->list);
636637
os_close_file(fd);
637-
printk(KERN_ERR "winch_interrupt : "
638-
"read failed, errno = %d\n", -err);
639-
printk(KERN_ERR "fd %d is losing SIGWINCH "
640-
"support\n", winch->tty_fd);
638+
if (err < 0) {
639+
printk(KERN_ERR "winch_interrupt : read failed, errno = %d\n",
640+
-err);
641+
printk(KERN_ERR "fd %d is losing SIGWINCH support\n",
642+
winch->tty_fd);
643+
}
641644
INIT_WORK(&winch->work, __free_winch);
642645
schedule_work(&winch->work);
643646
return IRQ_HANDLED;

arch/um/drivers/net_kern.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ static int uml_net_close(struct net_device *dev)
204204
return 0;
205205
}
206206

207-
static int uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
207+
static netdev_tx_t uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
208208
{
209209
struct uml_net_private *lp = netdev_priv(dev);
210210
unsigned long flags;

arch/um/drivers/virt-pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ static long um_pci_map_platform(unsigned long offset, size_t size,
971971
*ops = &um_pci_device_bar_ops;
972972
*priv = &um_pci_platform_device->resptr[0];
973973

974-
return 0;
974+
return offset;
975975
}
976976

977977
static const struct logic_iomem_region_ops um_pci_platform_ops = {

arch/um/include/asm/mmu.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
typedef struct mm_context {
1313
struct mm_id id;
1414
struct uml_arch_mm_context arch;
15-
struct page *stub_pages[2];
1615
} mm_context_t;
1716

1817
extern void __switch_mm(struct mm_id * mm_idp);

arch/um/include/asm/processor-generic.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ struct mm_struct;
2222
struct thread_struct {
2323
struct pt_regs regs;
2424
struct pt_regs *segv_regs;
25-
int singlestep_syscall;
2625
void *fault_addr;
2726
jmp_buf *fault_catcher;
2827
struct task_struct *prev_sched;

arch/um/include/shared/kern_util.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ extern int handle_page_fault(unsigned long address, unsigned long ip,
3434

3535
extern unsigned int do_IRQ(int irq, struct uml_pt_regs *regs);
3636
extern void initial_thread_cb(void (*proc)(void *), void *arg);
37-
extern int is_syscall(unsigned long addr);
3837

3938
extern void timer_handler(int sig, struct siginfo *unused_si, struct uml_pt_regs *regs);
4039

@@ -50,15 +49,15 @@ extern void do_uml_exitcalls(void);
5049
* Are we disallowed to sleep? Used to choose between GFP_KERNEL and
5150
* GFP_ATOMIC.
5251
*/
53-
extern int __cant_sleep(void);
52+
extern int __uml_cant_sleep(void);
5453
extern int get_current_pid(void);
5554
extern int copy_from_user_proc(void *to, void *from, int size);
5655
extern char *uml_strdup(const char *string);
5756

5857
extern unsigned long to_irq_stack(unsigned long *mask_out);
5958
extern unsigned long from_irq_stack(int nested);
6059

61-
extern int singlestepping(void *t);
60+
extern int singlestepping(void);
6261

6362
extern void segv_handler(int sig, struct siginfo *unused_si, struct uml_pt_regs *regs);
6463
extern void bus_handler(int sig, struct siginfo *si, struct uml_pt_regs *regs);

arch/um/include/shared/os.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,6 @@ extern void sigio_broken(int fd);
323323
extern int __add_sigio_fd(int fd);
324324
extern int __ignore_sigio_fd(int fd);
325325

326-
/* prctl.c */
327-
extern int os_arch_prctl(int pid, int option, unsigned long *arg2);
328-
329326
/* tty.c */
330327
extern int get_pty(void);
331328

0 commit comments

Comments
 (0)