[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Mon, 27 Jul 2015 00:54:25 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: agartrell@...com
Cc: ast@...nel.org, daniel@...earbox.net, netdev@...r.kernel.org,
kernel-team@...com
Subject: Re: [PATCH net-next] ebpf: Allow dereferences of PTR_TO_STACK
registers
From: Alex Gartrell <agartrell@...com>
Date: Thu, 23 Jul 2015 14:24:40 -0700
> mov %rsp, %r1 ; r1 = rsp
> add $-8, %r1 ; r1 = rsp - 8
> store_q $123, -8(%rsp) ; *(u64*)r1 = 123 <- valid
> store_q $123, (%r1) ; *(u64*)r1 = 123 <- previously invalid
> mov $0, %r0
> exit ; Always need to exit
>
> And we'd get the following error:
>
> 0: (bf) r1 = r10
> 1: (07) r1 += -8
> 2: (7a) *(u64 *)(r10 -8) = 999
> 3: (7a) *(u64 *)(r1 +0) = 999
> R1 invalid mem access 'fp'
>
> Unable to load program
>
> We already know that a register is a stack address and the appropriate
> offset, so we should be able to validate those references as well.
>
> Signed-off-by: Alex Gartrell <agartrell@...com>
Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists