[DTrace-devel] [PATCH] test: Use copyinstr() and copyin() when using data in user buffers
Eugene Loh
eugene.loh at oracle.com
Mon Feb 27 02:31:12 UTC 2023
On 2/25/23 23:05, Kris Van Hees wrote:
> On Sat, Feb 25, 2023 at 03:19:06PM -0500, eugene.loh--- via DTrace-devel wrote:
>> diff --git a/test/unittest/funcs/strjoin/tst.strjoin_nonDPTR.d b/test/unittest/funcs/strjoin/tst.strjoin_nonDPTR.d
>> @@ -17,7 +17,7 @@ BEGIN
>> syscall::write:entry
>> /ppid == $pid/
>> {
>> - printf("|%s|\n", strjoin((void *)arg1, (void *)arg1));
>> + printf("|%s|\n", strjoin(copyinstr(arg1), copyinstr(arg1)));
> The problem with this change is that you go from pointers that you cannot
> access directly on some platforms to using copyinstr() which copies the
> strings into tstrings before calling strjoin() which (I think) invalidates
> the testing. Sure, tstrings are not marked DPTR but they are in DTrace
> managed memory anyway. In other words, if the strjoin() were to invalidly
> use indirect loads on the pointers it would actually work.
>
> Instead, I think we should use something like:
>
> printf("|%s|\n", strjoin(`linux_banner, `linux_banner));
>
> And I would expect the same applies for the other tests...
>
> And those that use copyin() will end up with the data in ALLOCA memory which
> again allows indirect loads... So that is an issue also.
Hmm. Yes I suppose so. Okay, I'll replace this patch with something
entitled
test: Use kernel pointer for nonDPTR tests
More information about the DTrace-devel
mailing list