* Re: [PATCH v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()
@ 2020-07-21 9:30 ` Markus Elfring
0 siblings, 0 replies; 20+ messages in thread
From: Markus Elfring @ 2020-07-21 9:30 UTC (permalink / raw)
To: Denis Efremov, Coccinelle, Gilles Muller, Julia Lawall,
Masahiro Yamada, Michal Marek, Nicolas Palix
Cc: linux-kernel, kernel-janitors
…
> +++ b/scripts/coccinelle/api/memdup_user.cocci
> @@ -39,6 +39,28 @@ …
…
> +@depends on patch@
> +expression from,to,size;
> +identifier l1,l2;
> +@@
> +
> +- to = \(kvmalloc\|kvzalloc\)(size,\(GFP_KERNEL\|GFP_USER\));
> ++ to = vmemdup_user(from,size);
I propose to combine the desired adjustment with the previous SmPL rule
by using another disjunction.
> +@rv depends on !patch@
> +expression from,to,size;
> +position p;
> +statement S1,S2;
> +@@
> +
> +* to = \(kvmalloc@p\|kvzalloc@p\)(size,\(GFP_KERNEL\|GFP_USER\));
> + if (to==NULL || ...) S1
> + if (copy_from_user(to, from, size) != 0)
> + S2
* Can it be helpful to omit the SmPL asterisk functionality from
the operation modes “org” and “report”?
* Should the operation mode “context” work without an extra position metavariable?
Regards,
Markus
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()
@ 2020-07-21 9:30 ` Markus Elfring
0 siblings, 0 replies; 20+ messages in thread
From: Markus Elfring @ 2020-07-21 9:30 UTC (permalink / raw)
To: Denis Efremov, Coccinelle, Gilles Muller, Julia Lawall,
Masahiro Yamada, Michal Marek, Nicolas Palix
Cc: linux-kernel, kernel-janitors
…
> +++ b/scripts/coccinelle/api/memdup_user.cocci
> @@ -39,6 +39,28 @@ …
…
> +@depends on patch@
> +expression from,to,size;
> +identifier l1,l2;
> +@@
> +
> +- to = \(kvmalloc\|kvzalloc\)(size,\(GFP_KERNEL\|GFP_USER\));
> ++ to = vmemdup_user(from,size);
I propose to combine the desired adjustment with the previous SmPL rule
by using another disjunction.
> +@rv depends on !patch@
> +expression from,to,size;
> +position p;
> +statement S1,S2;
> +@@
> +
> +* to = \(kvmalloc@p\|kvzalloc@p\)(size,\(GFP_KERNEL\|GFP_USER\));
> + if (to==NULL || ...) S1
> + if (copy_from_user(to, from, size) != 0)
> + S2
* Can it be helpful to omit the SmPL asterisk functionality from
the operation modes “org” and “report”?
* Should the operation mode “context” work without an extra position metavariable?
Regards,
Markus
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()
2020-07-21 9:30 ` Markus Elfring
(?)
@ 2020-07-21 9:58 ` Julia Lawall
-1 siblings, 0 replies; 20+ messages in thread
From: Julia Lawall @ 2020-07-21 9:58 UTC (permalink / raw)
To: Markus Elfring
Cc: Denis Efremov, Coccinelle, Gilles Muller, Masahiro Yamada,
Michal Marek, Nicolas Palix, linux-kernel, kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 980 bytes --]
On Tue, 21 Jul 2020, Markus Elfring wrote:
> …
> > +++ b/scripts/coccinelle/api/memdup_user.cocci
> > @@ -39,6 +39,28 @@ …
> …
> > +@depends on patch@
> > +expression from,to,size;
> > +identifier l1,l2;
> > +@@
> > +
> > +- to = \(kvmalloc\|kvzalloc\)(size,\(GFP_KERNEL\|GFP_USER\));
> > ++ to = vmemdup_user(from,size);
>
> I propose to combine the desired adjustment with the previous SmPL rule
> by using another disjunction.
>
>
> > +@rv depends on !patch@
> > +expression from,to,size;
> > +position p;
> > +statement S1,S2;
> > +@@
> > +
> > +* to = \(kvmalloc@p\|kvzalloc@p\)(size,\(GFP_KERNEL\|GFP_USER\));
> > + if (to==NULL || ...) S1
> > + if (copy_from_user(to, from, size) != 0)
> > + S2
>
> * Can it be helpful to omit the SmPL asterisk functionality from
> the operation modes “org” and “report”?
>
> * Should the operation mode “context” work without an extra position metavariable?
This is fine as is in all three aspects.
julia
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Cocci] [PATCH v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()
@ 2020-07-21 9:58 ` Julia Lawall
0 siblings, 0 replies; 20+ messages in thread
From: Julia Lawall @ 2020-07-21 9:58 UTC (permalink / raw)
To: Markus Elfring
Cc: Michal Marek, Gilles Muller, kernel-janitors, Nicolas Palix,
linux-kernel, Coccinelle
[-- Attachment #1: Type: text/plain, Size: 980 bytes --]
On Tue, 21 Jul 2020, Markus Elfring wrote:
> …
> > +++ b/scripts/coccinelle/api/memdup_user.cocci
> > @@ -39,6 +39,28 @@ …
> …
> > +@depends on patch@
> > +expression from,to,size;
> > +identifier l1,l2;
> > +@@
> > +
> > +- to = \(kvmalloc\|kvzalloc\)(size,\(GFP_KERNEL\|GFP_USER\));
> > ++ to = vmemdup_user(from,size);
>
> I propose to combine the desired adjustment with the previous SmPL rule
> by using another disjunction.
>
>
> > +@rv depends on !patch@
> > +expression from,to,size;
> > +position p;
> > +statement S1,S2;
> > +@@
> > +
> > +* to = \(kvmalloc@p\|kvzalloc@p\)(size,\(GFP_KERNEL\|GFP_USER\));
> > + if (to==NULL || ...) S1
> > + if (copy_from_user(to, from, size) != 0)
> > + S2
>
> * Can it be helpful to omit the SmPL asterisk functionality from
> the operation modes “org” and “report”?
>
> * Should the operation mode “context” work without an extra position metavariable?
This is fine as is in all three aspects.
julia
[-- Attachment #2: Type: text/plain, Size: 136 bytes --]
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()
@ 2020-07-21 9:58 ` Julia Lawall
0 siblings, 0 replies; 20+ messages in thread
From: Julia Lawall @ 2020-07-21 9:58 UTC (permalink / raw)
To: Markus Elfring
Cc: Michal Marek, Gilles Muller, kernel-janitors, Nicolas Palix,
linux-kernel, Coccinelle
[-- Attachment #1: Type: text/plain, Size: 980 bytes --]
On Tue, 21 Jul 2020, Markus Elfring wrote:
> …
> > +++ b/scripts/coccinelle/api/memdup_user.cocci
> > @@ -39,6 +39,28 @@ …
> …
> > +@depends on patch@
> > +expression from,to,size;
> > +identifier l1,l2;
> > +@@
> > +
> > +- to = \(kvmalloc\|kvzalloc\)(size,\(GFP_KERNEL\|GFP_USER\));
> > ++ to = vmemdup_user(from,size);
>
> I propose to combine the desired adjustment with the previous SmPL rule
> by using another disjunction.
>
>
> > +@rv depends on !patch@
> > +expression from,to,size;
> > +position p;
> > +statement S1,S2;
> > +@@
> > +
> > +* to = \(kvmalloc@p\|kvzalloc@p\)(size,\(GFP_KERNEL\|GFP_USER\));
> > + if (to==NULL || ...) S1
> > + if (copy_from_user(to, from, size) != 0)
> > + S2
>
> * Can it be helpful to omit the SmPL asterisk functionality from
> the operation modes “org” and “report”?
>
> * Should the operation mode “context” work without an extra position metavariable?
This is fine as is in all three aspects.
julia
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()
2020-07-21 9:58 ` Julia Lawall
@ 2020-07-21 11:01 ` Markus Elfring
-1 siblings, 0 replies; 20+ messages in thread
From: Markus Elfring @ 2020-07-21 11:01 UTC (permalink / raw)
To: Julia Lawall, Denis Efremov, Coccinelle
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
linux-kernel, kernel-janitors
> This is fine as is in all three aspects.
I have tried again to point specific data processing consequences out
for operation modes of scripts in the semantic patch language.
Regards,
Markus
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()
@ 2020-07-21 11:01 ` Markus Elfring
0 siblings, 0 replies; 20+ messages in thread
From: Markus Elfring @ 2020-07-21 11:01 UTC (permalink / raw)
To: Julia Lawall, Denis Efremov, Coccinelle
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
linux-kernel, kernel-janitors
> This is fine as is in all three aspects.
I have tried again to point specific data processing consequences out
for operation modes of scripts in the semantic patch language.
Regards,
Markus
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()
2020-07-21 9:58 ` Julia Lawall
@ 2020-07-22 5:50 ` Markus Elfring
-1 siblings, 0 replies; 20+ messages in thread
From: Markus Elfring @ 2020-07-22 5:50 UTC (permalink / raw)
To: Julia Lawall, Denis Efremov, Coccinelle
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
linux-kernel, kernel-janitors
>>> +@depends on patch@
>>> +expression from,to,size;
>>> +identifier l1,l2;
>>> +@@
>>> +
>>> +- to = \(kvmalloc\|kvzalloc\)(size,\(GFP_KERNEL\|GFP_USER\));
>>> ++ to = vmemdup_user(from,size);
>>
>> I propose to combine the desired adjustment with the previous SmPL rule
>> by using another disjunction.
How do you think about to check run time characteristics for
the following SmPL script sketches?
A)
@R1@
@@
// Change something
@R2@
@@
// Change another thing
B)
@Replacement_with_disjunction@
@@
(
// R1: Change something
|
// R2: Change another thing
)
>>> +@rv depends on !patch@
>>> +expression from,to,size;
>>> +position p;
>>> +statement S1,S2;
>>> +@@
>>> +
>>> +* to = \(kvmalloc@p\|kvzalloc@p\)(size,\(GFP_KERNEL\|GFP_USER\));
>>> + if (to==NULL || ...) S1
>>> + if (copy_from_user(to, from, size) != 0)
>>> + S2
>>
>> * Can it be helpful to omit the SmPL asterisk functionality from
>> the operation modes “org” and “report”?
>>
>> * Should the operation mode “context” work without an extra position metavariable?
>
> This is fine as is in all three aspects.
Is every technique from the Coccinelle software required for
each operation mode in such data processing approaches?
Regards,
Markus
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()
@ 2020-07-22 5:50 ` Markus Elfring
0 siblings, 0 replies; 20+ messages in thread
From: Markus Elfring @ 2020-07-22 5:50 UTC (permalink / raw)
To: Julia Lawall, Denis Efremov, Coccinelle
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
linux-kernel, kernel-janitors
>>> +@depends on patch@
>>> +expression from,to,size;
>>> +identifier l1,l2;
>>> +@@
>>> +
>>> +- to = \(kvmalloc\|kvzalloc\)(size,\(GFP_KERNEL\|GFP_USER\));
>>> ++ to = vmemdup_user(from,size);
>>
>> I propose to combine the desired adjustment with the previous SmPL rule
>> by using another disjunction.
How do you think about to check run time characteristics for
the following SmPL script sketches?
A)
@R1@
@@
// Change something
@R2@
@@
// Change another thing
B)
@Replacement_with_disjunction@
@@
(
// R1: Change something
|
// R2: Change another thing
)
>>> +@rv depends on !patch@
>>> +expression from,to,size;
>>> +position p;
>>> +statement S1,S2;
>>> +@@
>>> +
>>> +* to = \(kvmalloc@p\|kvzalloc@p\)(size,\(GFP_KERNEL\|GFP_USER\));
>>> + if (to==NULL || ...) S1
>>> + if (copy_from_user(to, from, size) != 0)
>>> + S2
>>
>> * Can it be helpful to omit the SmPL asterisk functionality from
>> the operation modes “org” and “report”?
>>
>> * Should the operation mode “context” work without an extra position metavariable?
>
> This is fine as is in all three aspects.
Is every technique from the Coccinelle software required for
each operation mode in such data processing approaches?
Regards,
Markus
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()
2020-07-22 5:50 ` Markus Elfring
(?)
@ 2020-07-22 6:02 ` Julia Lawall
-1 siblings, 0 replies; 20+ messages in thread
From: Julia Lawall @ 2020-07-22 6:02 UTC (permalink / raw)
To: Markus Elfring
Cc: Denis Efremov, Coccinelle, Gilles Muller, Masahiro Yamada,
Michal Marek, Nicolas Palix, linux-kernel, kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 1496 bytes --]
On Wed, 22 Jul 2020, Markus Elfring wrote:
> >>> +@depends on patch@
> >>> +expression from,to,size;
> >>> +identifier l1,l2;
> >>> +@@
> >>> +
> >>> +- to = \(kvmalloc\|kvzalloc\)(size,\(GFP_KERNEL\|GFP_USER\));
> >>> ++ to = vmemdup_user(from,size);
> >>
> >> I propose to combine the desired adjustment with the previous SmPL rule
> >> by using another disjunction.
>
> How do you think about to check run time characteristics for
> the following SmPL script sketches?
>
> A)
> @R1@
> @@
> // Change something
>
> @R2@
> @@
> // Change another thing
>
>
> B)
> @Replacement_with_disjunction@
> @@
> (
> // R1: Change something
> |
> // R2: Change another thing
> )
Markus, you are welcome to try this since you are concerned about it.
But it doesn't matter.
julia
>
>
> >>> +@rv depends on !patch@
> >>> +expression from,to,size;
> >>> +position p;
> >>> +statement S1,S2;
> >>> +@@
> >>> +
> >>> +* to = \(kvmalloc@p\|kvzalloc@p\)(size,\(GFP_KERNEL\|GFP_USER\));
> >>> + if (to==NULL || ...) S1
> >>> + if (copy_from_user(to, from, size) != 0)
> >>> + S2
> >>
> >> * Can it be helpful to omit the SmPL asterisk functionality from
> >> the operation modes “org” and “report”?
> >>
> >> * Should the operation mode “context” work without an extra position metavariable?
> >
> > This is fine as is in all three aspects.
>
> Is every technique from the Coccinelle software required for
> each operation mode in such data processing approaches?
>
> Regards,
> Markus
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Cocci] [PATCH v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()
@ 2020-07-22 6:02 ` Julia Lawall
0 siblings, 0 replies; 20+ messages in thread
From: Julia Lawall @ 2020-07-22 6:02 UTC (permalink / raw)
To: Markus Elfring
Cc: Michal Marek, Gilles Muller, kernel-janitors, Nicolas Palix,
linux-kernel, Coccinelle
[-- Attachment #1: Type: text/plain, Size: 1496 bytes --]
On Wed, 22 Jul 2020, Markus Elfring wrote:
> >>> +@depends on patch@
> >>> +expression from,to,size;
> >>> +identifier l1,l2;
> >>> +@@
> >>> +
> >>> +- to = \(kvmalloc\|kvzalloc\)(size,\(GFP_KERNEL\|GFP_USER\));
> >>> ++ to = vmemdup_user(from,size);
> >>
> >> I propose to combine the desired adjustment with the previous SmPL rule
> >> by using another disjunction.
>
> How do you think about to check run time characteristics for
> the following SmPL script sketches?
>
> A)
> @R1@
> @@
> // Change something
>
> @R2@
> @@
> // Change another thing
>
>
> B)
> @Replacement_with_disjunction@
> @@
> (
> // R1: Change something
> |
> // R2: Change another thing
> )
Markus, you are welcome to try this since you are concerned about it.
But it doesn't matter.
julia
>
>
> >>> +@rv depends on !patch@
> >>> +expression from,to,size;
> >>> +position p;
> >>> +statement S1,S2;
> >>> +@@
> >>> +
> >>> +* to = \(kvmalloc@p\|kvzalloc@p\)(size,\(GFP_KERNEL\|GFP_USER\));
> >>> + if (to==NULL || ...) S1
> >>> + if (copy_from_user(to, from, size) != 0)
> >>> + S2
> >>
> >> * Can it be helpful to omit the SmPL asterisk functionality from
> >> the operation modes “org” and “report”?
> >>
> >> * Should the operation mode “context” work without an extra position metavariable?
> >
> > This is fine as is in all three aspects.
>
> Is every technique from the Coccinelle software required for
> each operation mode in such data processing approaches?
>
> Regards,
> Markus
>
[-- Attachment #2: Type: text/plain, Size: 136 bytes --]
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()
@ 2020-07-22 6:02 ` Julia Lawall
0 siblings, 0 replies; 20+ messages in thread
From: Julia Lawall @ 2020-07-22 6:02 UTC (permalink / raw)
To: Markus Elfring
Cc: Michal Marek, Gilles Muller, kernel-janitors, Nicolas Palix,
linux-kernel, Coccinelle
[-- Attachment #1: Type: text/plain, Size: 1496 bytes --]
On Wed, 22 Jul 2020, Markus Elfring wrote:
> >>> +@depends on patch@
> >>> +expression from,to,size;
> >>> +identifier l1,l2;
> >>> +@@
> >>> +
> >>> +- to = \(kvmalloc\|kvzalloc\)(size,\(GFP_KERNEL\|GFP_USER\));
> >>> ++ to = vmemdup_user(from,size);
> >>
> >> I propose to combine the desired adjustment with the previous SmPL rule
> >> by using another disjunction.
>
> How do you think about to check run time characteristics for
> the following SmPL script sketches?
>
> A)
> @R1@
> @@
> // Change something
>
> @R2@
> @@
> // Change another thing
>
>
> B)
> @Replacement_with_disjunction@
> @@
> (
> // R1: Change something
> |
> // R2: Change another thing
> )
Markus, you are welcome to try this since you are concerned about it.
But it doesn't matter.
julia
>
>
> >>> +@rv depends on !patch@
> >>> +expression from,to,size;
> >>> +position p;
> >>> +statement S1,S2;
> >>> +@@
> >>> +
> >>> +* to = \(kvmalloc@p\|kvzalloc@p\)(size,\(GFP_KERNEL\|GFP_USER\));
> >>> + if (to==NULL || ...) S1
> >>> + if (copy_from_user(to, from, size) != 0)
> >>> + S2
> >>
> >> * Can it be helpful to omit the SmPL asterisk functionality from
> >> the operation modes “org” and “report”?
> >>
> >> * Should the operation mode “context” work without an extra position metavariable?
> >
> > This is fine as is in all three aspects.
>
> Is every technique from the Coccinelle software required for
> each operation mode in such data processing approaches?
>
> Regards,
> Markus
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()
2020-07-22 6:02 ` Julia Lawall
@ 2020-07-22 6:09 ` Markus Elfring
-1 siblings, 0 replies; 20+ messages in thread
From: Markus Elfring @ 2020-07-22 6:09 UTC (permalink / raw)
To: Julia Lawall, Denis Efremov, Coccinelle
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
linux-kernel, kernel-janitors
> Markus, you are welcome to try this since you are concerned about it.
I dare to point software design variations for some reasons.
> But it doesn't matter.
Under which circumstances would you begin to care more for involved differences
in corresponding run time characteristics?
Regards,
Markus
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()
@ 2020-07-22 6:09 ` Markus Elfring
0 siblings, 0 replies; 20+ messages in thread
From: Markus Elfring @ 2020-07-22 6:09 UTC (permalink / raw)
To: Julia Lawall, Denis Efremov, Coccinelle
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
linux-kernel, kernel-janitors
> Markus, you are welcome to try this since you are concerned about it.
I dare to point software design variations for some reasons.
> But it doesn't matter.
Under which circumstances would you begin to care more for involved differences
in corresponding run time characteristics?
Regards,
Markus
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()
2020-07-22 6:09 ` Markus Elfring
(?)
@ 2020-07-22 6:24 ` Julia Lawall
-1 siblings, 0 replies; 20+ messages in thread
From: Julia Lawall @ 2020-07-22 6:24 UTC (permalink / raw)
To: Markus Elfring
Cc: Denis Efremov, Coccinelle, Gilles Muller, Masahiro Yamada,
Michal Marek, Nicolas Palix, linux-kernel, kernel-janitors
On Wed, 22 Jul 2020, Markus Elfring wrote:
> > Markus, you are welcome to try this since you are concerned about it.
>
> I dare to point software design variations for some reasons.
>
>
> > But it doesn't matter.
>
> Under which circumstances would you begin to care more for involved differences
> in corresponding run time characteristics?
When the difference is hours vs seconds. In this case, there are
tradeoffs between the two options, andI don't know which would be faster,
but I think it is extremely unlikely that the difference is noticible.
But if you are concerned about it, you are welcome to try.
julia
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Cocci] [v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()
@ 2020-07-22 6:24 ` Julia Lawall
0 siblings, 0 replies; 20+ messages in thread
From: Julia Lawall @ 2020-07-22 6:24 UTC (permalink / raw)
To: Markus Elfring
Cc: Michal Marek, Gilles Muller, kernel-janitors, Nicolas Palix,
linux-kernel, Coccinelle
On Wed, 22 Jul 2020, Markus Elfring wrote:
> > Markus, you are welcome to try this since you are concerned about it.
>
> I dare to point software design variations for some reasons.
>
>
> > But it doesn't matter.
>
> Under which circumstances would you begin to care more for involved differences
> in corresponding run time characteristics?
When the difference is hours vs seconds. In this case, there are
tradeoffs between the two options, andI don't know which would be faster,
but I think it is extremely unlikely that the difference is noticible.
But if you are concerned about it, you are welcome to try.
julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()
@ 2020-07-22 6:24 ` Julia Lawall
0 siblings, 0 replies; 20+ messages in thread
From: Julia Lawall @ 2020-07-22 6:24 UTC (permalink / raw)
To: Markus Elfring
Cc: Michal Marek, Gilles Muller, kernel-janitors, Nicolas Palix,
linux-kernel, Coccinelle
On Wed, 22 Jul 2020, Markus Elfring wrote:
> > Markus, you are welcome to try this since you are concerned about it.
>
> I dare to point software design variations for some reasons.
>
>
> > But it doesn't matter.
>
> Under which circumstances would you begin to care more for involved differences
> in corresponding run time characteristics?
When the difference is hours vs seconds. In this case, there are
tradeoffs between the two options, andI don't know which would be faster,
but I think it is extremely unlikely that the difference is noticible.
But if you are concerned about it, you are welcome to try.
julia
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()
2020-07-22 6:24 ` Julia Lawall
@ 2020-07-22 6:44 ` Markus Elfring
-1 siblings, 0 replies; 20+ messages in thread
From: Markus Elfring @ 2020-07-22 6:44 UTC (permalink / raw)
To: Julia Lawall, Denis Efremov, Coccinelle
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
linux-kernel, kernel-janitors
>> Under which circumstances would you begin to care more for involved differences
>> in corresponding run time characteristics?
>
> When the difference is hours vs seconds.
Such a view can be influenced by execution environments in considerable ways.
> In this case, there are tradeoffs between the two options,
I am trying to improve the awareness for possible software design variations.
> andI don't know which would be faster,
I am curious if more contributors would get into the mood to compare
data processing approaches a bit more.
> but I think it is extremely unlikely that the difference is noticible.
But the following effects may be known for the evaluation of a SmPL rule
which was combined for two code parts.
* The SmPL dependencies are checked only once.
* Can the source code search efforts be reduced a bit?
> But if you are concerned about it, you are welcome to try.
Will anybody become interested to measure the software behaviour exactly?
Regards,
Markus
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()
@ 2020-07-22 6:44 ` Markus Elfring
0 siblings, 0 replies; 20+ messages in thread
From: Markus Elfring @ 2020-07-22 6:44 UTC (permalink / raw)
To: Julia Lawall, Denis Efremov, Coccinelle
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
linux-kernel, kernel-janitors
>> Under which circumstances would you begin to care more for involved differences
>> in corresponding run time characteristics?
>
> When the difference is hours vs seconds.
Such a view can be influenced by execution environments in considerable ways.
> In this case, there are tradeoffs between the two options,
I am trying to improve the awareness for possible software design variations.
> andI don't know which would be faster,
I am curious if more contributors would get into the mood to compare
data processing approaches a bit more.
> but I think it is extremely unlikely that the difference is noticible.
But the following effects may be known for the evaluation of a SmPL rule
which was combined for two code parts.
* The SmPL dependencies are checked only once.
* Can the source code search efforts be reduced a bit?
> But if you are concerned about it, you are welcome to try.
Will anybody become interested to measure the software behaviour exactly?
Regards,
Markus
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v3 0/3] Update memdup_user.cocci
@ 2020-07-20 16:22 Denis Efremov
2020-07-20 16:22 ` [PATCH v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user() Denis Efremov
0 siblings, 1 reply; 20+ messages in thread
From: Denis Efremov @ 2020-07-20 16:22 UTC (permalink / raw)
To: Julia Lawall; +Cc: Denis Efremov, cocci, linux-kernel
Add GFP_USER to the allocation flags and handle vmemdup_user().
Changes in v2:
- memdup_user/vmemdup_user matching suppressed
- PoC for selfcheck virtual rule
Changes in v3:
- add missing '-' for patch rule in kmalloc/kzalloc call args
- selfcheck rule dropped from patchset
Denis Efremov (3):
coccinelle: api: extend memdup_user transformation with GFP_USER
coccinelle: api: extend memdup_user rule with vmemdup_user()
coccinelle: api: filter out memdup_user definitions
scripts/coccinelle/api/memdup_user.cocci | 64 ++++++++++++++++++++++--
1 file changed, 61 insertions(+), 3 deletions(-)
--
2.26.2
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()
2020-07-20 16:22 [PATCH v3 0/3] Update memdup_user.cocci Denis Efremov
@ 2020-07-20 16:22 ` Denis Efremov
0 siblings, 0 replies; 20+ messages in thread
From: Denis Efremov @ 2020-07-20 16:22 UTC (permalink / raw)
To: Julia Lawall; +Cc: Denis Efremov, cocci, linux-kernel
Add vmemdup_user() transformations to the memdup_user.cocci rule.
Commit 50fd2f298bef ("new primitive: vmemdup_user()") introduced
vmemdup_user(). The function uses kvmalloc with GPF_USER flag.
Signed-off-by: Denis Efremov <efremov@linux.com>
---
scripts/coccinelle/api/memdup_user.cocci | 45 ++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/scripts/coccinelle/api/memdup_user.cocci b/scripts/coccinelle/api/memdup_user.cocci
index 0e29d41ecab8..60027e21c5e6 100644
--- a/scripts/coccinelle/api/memdup_user.cocci
+++ b/scripts/coccinelle/api/memdup_user.cocci
@@ -39,6 +39,28 @@ identifier l1,l2;
- ...+>
- }
+@depends on patch@
+expression from,to,size;
+identifier l1,l2;
+@@
+
+- to = \(kvmalloc\|kvzalloc\)(size,\(GFP_KERNEL\|GFP_USER\));
++ to = vmemdup_user(from,size);
+ if (
+- to==NULL
++ IS_ERR(to)
+ || ...) {
+ <+... when != goto l1;
+- -ENOMEM
++ PTR_ERR(to)
+ ...+>
+ }
+- if (copy_from_user(to, from, size) != 0) {
+- <+... when != goto l2;
+- -EFAULT
+- ...+>
+- }
+
@r depends on !patch@
expression from,to,size;
position p;
@@ -52,6 +74,17 @@ statement S1,S2;
if (copy_from_user(to, from, size) != 0)
S2
+@rv depends on !patch@
+expression from,to,size;
+position p;
+statement S1,S2;
+@@
+
+* to = \(kvmalloc@p\|kvzalloc@p\)(size,\(GFP_KERNEL\|GFP_USER\));
+ if (to==NULL || ...) S1
+ if (copy_from_user(to, from, size) != 0)
+ S2
+
@script:python depends on org@
p << r.p;
@@
@@ -63,3 +96,15 @@ p << r.p;
@@
coccilib.report.print_report(p[0], "WARNING opportunity for memdup_user")
+
+@script:python depends on org@
+p << rv.p;
+@@
+
+coccilib.org.print_todo(p[0], "WARNING opportunity for vmemdup_user")
+
+@script:python depends on report@
+p << rv.p;
+@@
+
+coccilib.report.print_report(p[0], "WARNING opportunity for vmemdup_user")
--
2.26.2
^ permalink raw reply related [flat|nested] 20+ messages in thread
end of thread, other threads:[~2020-07-22 6:44 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-21 9:30 [PATCH v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user() Markus Elfring
2020-07-21 9:30 ` Markus Elfring
2020-07-21 9:58 ` Julia Lawall
2020-07-21 9:58 ` [Cocci] " Julia Lawall
2020-07-21 9:58 ` Julia Lawall
2020-07-21 11:01 ` [v3 " Markus Elfring
2020-07-21 11:01 ` Markus Elfring
2020-07-22 5:50 ` [PATCH v3 " Markus Elfring
2020-07-22 5:50 ` Markus Elfring
2020-07-22 6:02 ` Julia Lawall
2020-07-22 6:02 ` [Cocci] " Julia Lawall
2020-07-22 6:02 ` Julia Lawall
2020-07-22 6:09 ` [v3 " Markus Elfring
2020-07-22 6:09 ` Markus Elfring
2020-07-22 6:24 ` Julia Lawall
2020-07-22 6:24 ` [Cocci] " Julia Lawall
2020-07-22 6:24 ` Julia Lawall
2020-07-22 6:44 ` Markus Elfring
2020-07-22 6:44 ` Markus Elfring
-- strict thread matches above, loose matches on Subject: below --
2020-07-20 16:22 [PATCH v3 0/3] Update memdup_user.cocci Denis Efremov
2020-07-20 16:22 ` [PATCH v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user() Denis Efremov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.