Another ok for this

Although I am kind of wondering outloud is pledge disklabel is needed as such
or could be refined.. should we simply always read the disklabel outside of
pledge, and only need this to write one?

On Sat, May 28, 2016 at 07:33:25PM +0200, Theo Buehler wrote:
> Another low hanging fruit of the same sort:
> 
> $ ktrace fsck_msdofs /dev/tty
> Abort trap (core dumped)
> $ kdump | tail
>   4663 fsck_msdos RET   read 612/0x264
>   4663 fsck_msdos CALL  read(3,0x304fdfe4000,0x4000)
>   4663 fsck_msdos RET   read 0
>   4663 fsck_msdos CALL  open(0x3029c121880,0x2<O_RDWR>)
>   4663 fsck_msdos NAMI  "/dev/tty"
>   4663 fsck_msdos RET   open 4
>   4663 fsck_msdos CALL  ioctl(4,DIOCGPDINFO,0x7f7ffffee340)
>   4663 fsck_msdos PLDG  ioctl, "ioctl", errno 1 Operation not permitted
>   4663 fsck_msdos PSIG  SIGABRT SIG_DFL code <1870144632>
>   4663 fsck_msdos NAMI  "fsck_msdos.core"
> 
> Right after DIOCGPDINFO comes a pledge stdio.
> 
> Index: main.c
> ===================================================================
> RCS file: /var/cvs/src/sbin/fsck_msdos/main.c,v
> retrieving revision 1.22
> diff -u -p -r1.22 main.c
> --- main.c    23 Nov 2015 19:19:30 -0000      1.22
> +++ main.c    28 May 2016 17:24:18 -0000
> @@ -57,9 +57,6 @@ main(int argc, char *argv[])
>  {
>       int ch;
>  
> -     if (pledge("stdio rpath wpath disklabel", NULL) == -1)
> -             err(1, "pledge");
> -
>       while ((ch = getopt(argc, argv, "pynf")) != -1) {
>               switch (ch) {
>               case 'f':
> 

Reply via email to