yixuaz/6.1810-2023

Some bugs: kernel/proc.c: In function 'find_swapping_page':

Closed this issue · 1 comments

I downloaded the repository and executed the following commands

cd xv6-all/
chmod +x grade-lab-net
./grade-lab-net

The following bugs occurred

riscv64-unknown-elf-gcc    -c -o kernel/entry.o kernel/entry.S
...
kernel/proc.c: In function 'find_swapping_page':
kernel/proc.c:1008:3: error: a label can only be part of a statement and a declaration is not a statement
1008 |   struct proc *p;
    |   ^~~~~~
kernel/proc.c:1009:3: error: expected expression before 'pte_t'
1009 |   pte_t *pte, *ret = 0;
    |   ^~~~~
kernel/proc.c:1020:13: error: 'pte' undeclared (first use in this function)
1020 |         if((pte = walk(p->pagetable, a, 0)) == 0)
    |             ^~~
kernel/proc.c:1020:13: note: each undeclared identifier is reported only once for each function it appears in
kernel/proc.c:1033:11: error: 'ret' undeclared (first use in this function); did you mean 'res'?
1033 |           ret = pte;
    |           ^~~
    |           res
make: *** [Makefile:139: kernel/proc.o] Error 1

cannot reproduce. suspect there exists some issue for your env

(base) yixuan:~/mit$ git clone https://github.com/yixuaz/6.1810-2023.git
Cloning into '6.1810-2023'...
remote: Enumerating objects: 397, done.
remote: Counting objects: 100% (397/397), done.
remote: Compressing objects: 100% (357/357), done.
remote: Total 397 (delta 174), reused 247 (delta 33), pack-reused 0
Receiving objects: 100% (397/397), 221.89 KiB | 1.53 MiB/s, done.
Resolving deltas: 100% (174/174), done.
(base) yixuan:~/mit$ cd 6.1810-2023/xv6-all/
(base) yixuan:~/mit/6.1810-2023/xv6-all$ chmod +x grade-lab-net
(base) yixuan:~/mit/6.1810-2023/xv6-all$ ./grade-lab-net
riscv64-linux-gnu-gcc    -c -o kernel/entry.o kernel/entry.S
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/kalloc.o kernel/kalloc.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/string.o kernel/string.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/main.o kernel/main.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/vm.o kernel/vm.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/proc.o kernel/proc.c
riscv64-linux-gnu-gcc    -c -o kernel/swtch.o kernel/swtch.S
riscv64-linux-gnu-gcc    -c -o kernel/trampoline.o kernel/trampoline.S
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/trap.o kernel/trap.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/syscall.o kernel/syscall.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/sysproc.o kernel/sysproc.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/bio.o kernel/bio.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/fs.o kernel/fs.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/log.o kernel/log.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/sleeplock.o kernel/sleeplock.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/file.o kernel/file.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/pipe.o kernel/pipe.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/exec.o kernel/exec.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/sysfile.o kernel/sysfile.c
riscv64-linux-gnu-gcc    -c -o kernel/kernelvec.o kernel/kernelvec.S
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/plic.o kernel/plic.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/mmap.o kernel/mmap.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/swap.o kernel/swap.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/signal.o kernel/signal.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/procfs.o kernel/procfs.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/virtio_disk.o kernel/virtio_disk.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/debugtbl.o kernel/debugtbl.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/sprintf.o kernel/sprintf.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/stats.o kernel/stats.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/e1000.o kernel/e1000.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/net.o kernel/net.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/sysnet.o kernel/sysnet.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/syssock.o kernel/syssock.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/tcp.o kernel/tcp.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/icmp.o kernel/icmp.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/rand.o kernel/rand.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/pci.o kernel/pci.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/start.o kernel/start.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/console.o kernel/console.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/printf.o kernel/printf.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/uart.o kernel/uart.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie  -c -o kernel/spinlock.o kernel/spinlock.c
riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2 -DSOL_LOCK -DLAB_LOCK -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -DNET_TESTS_PORT=26099 -fno-pie -no-pie -march=rv64g -nostdinc -I. -Ikernel -c user/initcode.S -o user/initcode.o
riscv64-linux-gnu-ld -z max-page-size=4096 -N -e start -Ttext 0 -o user/initcode.out user/initcode.o
riscv64-linux-gnu-objcopy -S -O binary user/initcode.out user/initcode
riscv64-linux-gnu-objdump -S user/initcode.o > user/initcode.asm
riscv64-linux-gnu-ld -z max-page-size=4096 -T kernel/kernel.ld -o kernel/kernel kernel/entry.o kernel/kalloc.o kernel/string.o kernel/main.o kernel/vm.o kernel/proc.o kernel/swtch.o kernel/trampoline.o kernel/trap.o kernel/syscall.o kernel/sysproc.o kernel/bio.o kernel/fs.o kernel/log.o kernel/sleeplock.o kernel/file.o kernel/pipe.o kernel/exec.o kernel/sysfile.o kernel/kernelvec.o kernel/plic.o kernel/mmap.o kernel/swap.o kernel/signal.o kernel/procfs.o kernel/virtio_disk.o kernel/debugtbl.o kernel/sprintf.o  kernel/stats.o kernel/e1000.o kernel/net.o kernel/sysnet.o kernel/syssock.o kernel/tcp.o kernel/icmp.o kernel/rand.o kernel/pci.o kernel/start.o kernel/console.o kernel/printf.o kernel/uart.o kernel/spinlock.o
riscv64-linux-gnu-objdump -S kernel/kernel > kernel/kernel.asm
riscv64-linux-gnu-objdump -S kernel/kernel | sed -n 's/^    \(8[0-9a-f]*\).*/\1/p' > kernel/kernel_address
addr2line -e kernel/kernel -f < kernel/kernel_address | paste - - > kernel/kernel_lines
awk 'BEGIN{OFS="\t"} NR==FNR{a[NR]=$0; next} {if($0!=prev){print a[FNR], $0} prev=$0}' kernel/kernel_address kernel/kernel_lines > debugtbl && rm kernel/kernel_address kernel/kernel_lines
riscv64-linux-gnu-objdump -t kernel/kernel | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$/d' > kernel/kernel.sym
== Test running nettests == (4.6s)
== Test   nettest: ping ==
  nettest: ping: OK
== Test   nettest: single process ==
  nettest: single process: OK
== Test   nettest: multi-process ==
  nettest: multi-process: OK
== Test   nettest: DNS ==
  nettest: DNS: OK
== Test time ==
time: OK
Score: 100/100