Re: [PATCH v0 1/3] livepatch: add sample cumulative patch

2018-03-02 Thread Miroslav Benes
On Fri, 2 Mar 2018, Greg Kroah-Hartman wrote:

> On Thu, Mar 01, 2018 at 05:19:28PM -0800, Philippe Ombredanne wrote:
> > Miroslav,
> > 
> > On Tue, Feb 27, 2018 at 3:54 AM, Miroslav Benes  wrote:
> > > On Sat, 24 Feb 2018, Philippe Ombredanne wrote:
> > >
> > >> Joe,
> > >>
> > >> On Fri, Feb 23, 2018 at 1:33 PM, Joe Lawrence  
> > >> wrote:
> > >> > Add a simple atomic replace / cumulative livepatch example.
> > >> >
> > >> > Signed-off-by: Joe Lawrence 
> > >> > ---
> > >> >  samples/livepatch/Makefile   |   1 +
> > >> >  samples/livepatch/livepatch-cumulative.c | 216 
> > >> > +++
> > >> >  2 files changed, 217 insertions(+)
> > >> >  create mode 100644 samples/livepatch/livepatch-cumulative.c
> > >> >
> > >> > diff --git a/samples/livepatch/Makefile b/samples/livepatch/Makefile
> > >> > index 2472ce39a18d..dd0e2a8af1af 100644
> > >> > --- a/samples/livepatch/Makefile
> > >> > +++ b/samples/livepatch/Makefile
> > >> > @@ -5,3 +5,4 @@ obj-$(CONFIG_SAMPLE_LIVEPATCH) += 
> > >> > livepatch-shadow-fix2.o
> > >> >  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-demo.o
> > >> >  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-mod.o
> > >> >  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-busymod.o
> > >> > +obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-cumulative.o
> > >> > diff --git a/samples/livepatch/livepatch-cumulative.c 
> > >> > b/samples/livepatch/livepatch-cumulative.c
> > >> > new file mode 100644
> > >> > index ..ab036439e08c
> > >> > --- /dev/null
> > >> > +++ b/samples/livepatch/livepatch-cumulative.c
> > >> > @@ -0,0 +1,216 @@
> > >> > +/*
> > >> > + * Copyright (C) 2018 Joe Lawrence 
> > >> > + *
> > >> > + * This program is free software; you can redistribute it and/or
> > >> > + * modify it under the terms of the GNU General Public License
> > >> > + * as published by the Free Software Foundation; either version 2
> > >> > + * of the License, or (at your option) any later version.
> > >> > + *
> > >> > + * This program is distributed in the hope that it will be useful,
> > >> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > >> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > >> > + * GNU General Public License for more details.
> > >> > + *
> > >> > + * You should have received a copy of the GNU General Public License
> > >> > + * along with this program; if not, see 
> > >> > .
> > >> > + */
> > >>
> > >> May be you could use the new SPDX tags instead of this fine but long
> > >> legalese? [1]
> > >> This would replace ~12 lines of comment by a single line with the same 
> > >> effect.
> > >> Thanks!
> > >
> > > I don't know about that. How come it is perceived as equivalent? I mean,
> > > we have a well-established way how to say that a particular source
> > > code/file is distributed with GPL license. Well-established means that
> > > it's been tested in court AFAIK many times. Even the license itself (found
> > > in COPYING file) mentions this as way how to attach the license to a file.
> > >
> > > Now you want it to be replaced with a tag. Does it say the same? It might.
> > > It might not. Do we know? Have you got a court ruling which would say that
> > > this is also a way how to attach a license to a file? I doubt it. It may
> > > seem trivially clear, but there are no such things in the legal world.
> > >
> > > Don't make me wrong. I don't like that copyright thingie much. I don't
> > > like that you can find even different versions of the text in the kernel
> > > source code (and not only there).
> > >
> > > However I'd prefer to leave at least a note there that the file is still
> > > distributed under the terms of GPL found in COPYING file. The tag can be
> > > there too, if it makes someone happy.
> > >
> > > Regards,
> > > Miroslav
> > >
> > >> [1]  
> > >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/license-rules.rst
> > >> --
> > >> Philippe
> > >>
> > >
> > 
> > To the best of my knowledge, this has been debated in person and on
> > list among maintainers and agreed to.
> > This has also been reviewed by the LF lawyers. The result of is the
> > documentation in [1]
> > You are welcomed not to agree of course, but this would make your
> > contributions stand out with its legalese boilerplate when we are
> > trying to get of it.
> > 
> > Greg, anything else to add?
> 
> Yes, do not add new "boiler plate" license code in new files, otherwise
> you will just have to rip them out again later on.  If you have
> questions about this, please contact your company's lawyers, as they
> know all about this issue and last I heard, agreed with it.

I certainly will. Thanks.

Miroslav


Re: [PATCH v0 1/3] livepatch: add sample cumulative patch

2018-03-02 Thread Miroslav Benes
On Fri, 2 Mar 2018, Greg Kroah-Hartman wrote:

> On Thu, Mar 01, 2018 at 05:19:28PM -0800, Philippe Ombredanne wrote:
> > Miroslav,
> > 
> > On Tue, Feb 27, 2018 at 3:54 AM, Miroslav Benes  wrote:
> > > On Sat, 24 Feb 2018, Philippe Ombredanne wrote:
> > >
> > >> Joe,
> > >>
> > >> On Fri, Feb 23, 2018 at 1:33 PM, Joe Lawrence  
> > >> wrote:
> > >> > Add a simple atomic replace / cumulative livepatch example.
> > >> >
> > >> > Signed-off-by: Joe Lawrence 
> > >> > ---
> > >> >  samples/livepatch/Makefile   |   1 +
> > >> >  samples/livepatch/livepatch-cumulative.c | 216 
> > >> > +++
> > >> >  2 files changed, 217 insertions(+)
> > >> >  create mode 100644 samples/livepatch/livepatch-cumulative.c
> > >> >
> > >> > diff --git a/samples/livepatch/Makefile b/samples/livepatch/Makefile
> > >> > index 2472ce39a18d..dd0e2a8af1af 100644
> > >> > --- a/samples/livepatch/Makefile
> > >> > +++ b/samples/livepatch/Makefile
> > >> > @@ -5,3 +5,4 @@ obj-$(CONFIG_SAMPLE_LIVEPATCH) += 
> > >> > livepatch-shadow-fix2.o
> > >> >  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-demo.o
> > >> >  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-mod.o
> > >> >  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-busymod.o
> > >> > +obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-cumulative.o
> > >> > diff --git a/samples/livepatch/livepatch-cumulative.c 
> > >> > b/samples/livepatch/livepatch-cumulative.c
> > >> > new file mode 100644
> > >> > index ..ab036439e08c
> > >> > --- /dev/null
> > >> > +++ b/samples/livepatch/livepatch-cumulative.c
> > >> > @@ -0,0 +1,216 @@
> > >> > +/*
> > >> > + * Copyright (C) 2018 Joe Lawrence 
> > >> > + *
> > >> > + * This program is free software; you can redistribute it and/or
> > >> > + * modify it under the terms of the GNU General Public License
> > >> > + * as published by the Free Software Foundation; either version 2
> > >> > + * of the License, or (at your option) any later version.
> > >> > + *
> > >> > + * This program is distributed in the hope that it will be useful,
> > >> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > >> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > >> > + * GNU General Public License for more details.
> > >> > + *
> > >> > + * You should have received a copy of the GNU General Public License
> > >> > + * along with this program; if not, see 
> > >> > .
> > >> > + */
> > >>
> > >> May be you could use the new SPDX tags instead of this fine but long
> > >> legalese? [1]
> > >> This would replace ~12 lines of comment by a single line with the same 
> > >> effect.
> > >> Thanks!
> > >
> > > I don't know about that. How come it is perceived as equivalent? I mean,
> > > we have a well-established way how to say that a particular source
> > > code/file is distributed with GPL license. Well-established means that
> > > it's been tested in court AFAIK many times. Even the license itself (found
> > > in COPYING file) mentions this as way how to attach the license to a file.
> > >
> > > Now you want it to be replaced with a tag. Does it say the same? It might.
> > > It might not. Do we know? Have you got a court ruling which would say that
> > > this is also a way how to attach a license to a file? I doubt it. It may
> > > seem trivially clear, but there are no such things in the legal world.
> > >
> > > Don't make me wrong. I don't like that copyright thingie much. I don't
> > > like that you can find even different versions of the text in the kernel
> > > source code (and not only there).
> > >
> > > However I'd prefer to leave at least a note there that the file is still
> > > distributed under the terms of GPL found in COPYING file. The tag can be
> > > there too, if it makes someone happy.
> > >
> > > Regards,
> > > Miroslav
> > >
> > >> [1]  
> > >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/license-rules.rst
> > >> --
> > >> Philippe
> > >>
> > >
> > 
> > To the best of my knowledge, this has been debated in person and on
> > list among maintainers and agreed to.
> > This has also been reviewed by the LF lawyers. The result of is the
> > documentation in [1]
> > You are welcomed not to agree of course, but this would make your
> > contributions stand out with its legalese boilerplate when we are
> > trying to get of it.
> > 
> > Greg, anything else to add?
> 
> Yes, do not add new "boiler plate" license code in new files, otherwise
> you will just have to rip them out again later on.  If you have
> questions about this, please contact your company's lawyers, as they
> know all about this issue and last I heard, agreed with it.

I certainly will. Thanks.

Miroslav


Re: [PATCH v0 1/3] livepatch: add sample cumulative patch

2018-03-02 Thread Greg Kroah-Hartman
On Thu, Mar 01, 2018 at 05:19:28PM -0800, Philippe Ombredanne wrote:
> Miroslav,
> 
> On Tue, Feb 27, 2018 at 3:54 AM, Miroslav Benes  wrote:
> > On Sat, 24 Feb 2018, Philippe Ombredanne wrote:
> >
> >> Joe,
> >>
> >> On Fri, Feb 23, 2018 at 1:33 PM, Joe Lawrence  
> >> wrote:
> >> > Add a simple atomic replace / cumulative livepatch example.
> >> >
> >> > Signed-off-by: Joe Lawrence 
> >> > ---
> >> >  samples/livepatch/Makefile   |   1 +
> >> >  samples/livepatch/livepatch-cumulative.c | 216 
> >> > +++
> >> >  2 files changed, 217 insertions(+)
> >> >  create mode 100644 samples/livepatch/livepatch-cumulative.c
> >> >
> >> > diff --git a/samples/livepatch/Makefile b/samples/livepatch/Makefile
> >> > index 2472ce39a18d..dd0e2a8af1af 100644
> >> > --- a/samples/livepatch/Makefile
> >> > +++ b/samples/livepatch/Makefile
> >> > @@ -5,3 +5,4 @@ obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-shadow-fix2.o
> >> >  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-demo.o
> >> >  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-mod.o
> >> >  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-busymod.o
> >> > +obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-cumulative.o
> >> > diff --git a/samples/livepatch/livepatch-cumulative.c 
> >> > b/samples/livepatch/livepatch-cumulative.c
> >> > new file mode 100644
> >> > index ..ab036439e08c
> >> > --- /dev/null
> >> > +++ b/samples/livepatch/livepatch-cumulative.c
> >> > @@ -0,0 +1,216 @@
> >> > +/*
> >> > + * Copyright (C) 2018 Joe Lawrence 
> >> > + *
> >> > + * This program is free software; you can redistribute it and/or
> >> > + * modify it under the terms of the GNU General Public License
> >> > + * as published by the Free Software Foundation; either version 2
> >> > + * of the License, or (at your option) any later version.
> >> > + *
> >> > + * This program is distributed in the hope that it will be useful,
> >> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> >> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> >> > + * GNU General Public License for more details.
> >> > + *
> >> > + * You should have received a copy of the GNU General Public License
> >> > + * along with this program; if not, see .
> >> > + */
> >>
> >> May be you could use the new SPDX tags instead of this fine but long
> >> legalese? [1]
> >> This would replace ~12 lines of comment by a single line with the same 
> >> effect.
> >> Thanks!
> >
> > I don't know about that. How come it is perceived as equivalent? I mean,
> > we have a well-established way how to say that a particular source
> > code/file is distributed with GPL license. Well-established means that
> > it's been tested in court AFAIK many times. Even the license itself (found
> > in COPYING file) mentions this as way how to attach the license to a file.
> >
> > Now you want it to be replaced with a tag. Does it say the same? It might.
> > It might not. Do we know? Have you got a court ruling which would say that
> > this is also a way how to attach a license to a file? I doubt it. It may
> > seem trivially clear, but there are no such things in the legal world.
> >
> > Don't make me wrong. I don't like that copyright thingie much. I don't
> > like that you can find even different versions of the text in the kernel
> > source code (and not only there).
> >
> > However I'd prefer to leave at least a note there that the file is still
> > distributed under the terms of GPL found in COPYING file. The tag can be
> > there too, if it makes someone happy.
> >
> > Regards,
> > Miroslav
> >
> >> [1]  
> >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/license-rules.rst
> >> --
> >> Philippe
> >>
> >
> 
> To the best of my knowledge, this has been debated in person and on
> list among maintainers and agreed to.
> This has also been reviewed by the LF lawyers. The result of is the
> documentation in [1]
> You are welcomed not to agree of course, but this would make your
> contributions stand out with its legalese boilerplate when we are
> trying to get of it.
> 
> Greg, anything else to add?

Yes, do not add new "boiler plate" license code in new files, otherwise
you will just have to rip them out again later on.  If you have
questions about this, please contact your company's lawyers, as they
know all about this issue and last I heard, agreed with it.

thanks,

greg k-h


Re: [PATCH v0 1/3] livepatch: add sample cumulative patch

2018-03-02 Thread Greg Kroah-Hartman
On Thu, Mar 01, 2018 at 05:19:28PM -0800, Philippe Ombredanne wrote:
> Miroslav,
> 
> On Tue, Feb 27, 2018 at 3:54 AM, Miroslav Benes  wrote:
> > On Sat, 24 Feb 2018, Philippe Ombredanne wrote:
> >
> >> Joe,
> >>
> >> On Fri, Feb 23, 2018 at 1:33 PM, Joe Lawrence  
> >> wrote:
> >> > Add a simple atomic replace / cumulative livepatch example.
> >> >
> >> > Signed-off-by: Joe Lawrence 
> >> > ---
> >> >  samples/livepatch/Makefile   |   1 +
> >> >  samples/livepatch/livepatch-cumulative.c | 216 
> >> > +++
> >> >  2 files changed, 217 insertions(+)
> >> >  create mode 100644 samples/livepatch/livepatch-cumulative.c
> >> >
> >> > diff --git a/samples/livepatch/Makefile b/samples/livepatch/Makefile
> >> > index 2472ce39a18d..dd0e2a8af1af 100644
> >> > --- a/samples/livepatch/Makefile
> >> > +++ b/samples/livepatch/Makefile
> >> > @@ -5,3 +5,4 @@ obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-shadow-fix2.o
> >> >  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-demo.o
> >> >  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-mod.o
> >> >  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-busymod.o
> >> > +obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-cumulative.o
> >> > diff --git a/samples/livepatch/livepatch-cumulative.c 
> >> > b/samples/livepatch/livepatch-cumulative.c
> >> > new file mode 100644
> >> > index ..ab036439e08c
> >> > --- /dev/null
> >> > +++ b/samples/livepatch/livepatch-cumulative.c
> >> > @@ -0,0 +1,216 @@
> >> > +/*
> >> > + * Copyright (C) 2018 Joe Lawrence 
> >> > + *
> >> > + * This program is free software; you can redistribute it and/or
> >> > + * modify it under the terms of the GNU General Public License
> >> > + * as published by the Free Software Foundation; either version 2
> >> > + * of the License, or (at your option) any later version.
> >> > + *
> >> > + * This program is distributed in the hope that it will be useful,
> >> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> >> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> >> > + * GNU General Public License for more details.
> >> > + *
> >> > + * You should have received a copy of the GNU General Public License
> >> > + * along with this program; if not, see .
> >> > + */
> >>
> >> May be you could use the new SPDX tags instead of this fine but long
> >> legalese? [1]
> >> This would replace ~12 lines of comment by a single line with the same 
> >> effect.
> >> Thanks!
> >
> > I don't know about that. How come it is perceived as equivalent? I mean,
> > we have a well-established way how to say that a particular source
> > code/file is distributed with GPL license. Well-established means that
> > it's been tested in court AFAIK many times. Even the license itself (found
> > in COPYING file) mentions this as way how to attach the license to a file.
> >
> > Now you want it to be replaced with a tag. Does it say the same? It might.
> > It might not. Do we know? Have you got a court ruling which would say that
> > this is also a way how to attach a license to a file? I doubt it. It may
> > seem trivially clear, but there are no such things in the legal world.
> >
> > Don't make me wrong. I don't like that copyright thingie much. I don't
> > like that you can find even different versions of the text in the kernel
> > source code (and not only there).
> >
> > However I'd prefer to leave at least a note there that the file is still
> > distributed under the terms of GPL found in COPYING file. The tag can be
> > there too, if it makes someone happy.
> >
> > Regards,
> > Miroslav
> >
> >> [1]  
> >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/license-rules.rst
> >> --
> >> Philippe
> >>
> >
> 
> To the best of my knowledge, this has been debated in person and on
> list among maintainers and agreed to.
> This has also been reviewed by the LF lawyers. The result of is the
> documentation in [1]
> You are welcomed not to agree of course, but this would make your
> contributions stand out with its legalese boilerplate when we are
> trying to get of it.
> 
> Greg, anything else to add?

Yes, do not add new "boiler plate" license code in new files, otherwise
you will just have to rip them out again later on.  If you have
questions about this, please contact your company's lawyers, as they
know all about this issue and last I heard, agreed with it.

thanks,

greg k-h


Re: [PATCH v0 1/3] livepatch: add sample cumulative patch

2018-03-01 Thread Philippe Ombredanne
Miroslav,

On Tue, Feb 27, 2018 at 3:54 AM, Miroslav Benes  wrote:
> On Sat, 24 Feb 2018, Philippe Ombredanne wrote:
>
>> Joe,
>>
>> On Fri, Feb 23, 2018 at 1:33 PM, Joe Lawrence  
>> wrote:
>> > Add a simple atomic replace / cumulative livepatch example.
>> >
>> > Signed-off-by: Joe Lawrence 
>> > ---
>> >  samples/livepatch/Makefile   |   1 +
>> >  samples/livepatch/livepatch-cumulative.c | 216 
>> > +++
>> >  2 files changed, 217 insertions(+)
>> >  create mode 100644 samples/livepatch/livepatch-cumulative.c
>> >
>> > diff --git a/samples/livepatch/Makefile b/samples/livepatch/Makefile
>> > index 2472ce39a18d..dd0e2a8af1af 100644
>> > --- a/samples/livepatch/Makefile
>> > +++ b/samples/livepatch/Makefile
>> > @@ -5,3 +5,4 @@ obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-shadow-fix2.o
>> >  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-demo.o
>> >  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-mod.o
>> >  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-busymod.o
>> > +obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-cumulative.o
>> > diff --git a/samples/livepatch/livepatch-cumulative.c 
>> > b/samples/livepatch/livepatch-cumulative.c
>> > new file mode 100644
>> > index ..ab036439e08c
>> > --- /dev/null
>> > +++ b/samples/livepatch/livepatch-cumulative.c
>> > @@ -0,0 +1,216 @@
>> > +/*
>> > + * Copyright (C) 2018 Joe Lawrence 
>> > + *
>> > + * This program is free software; you can redistribute it and/or
>> > + * modify it under the terms of the GNU General Public License
>> > + * as published by the Free Software Foundation; either version 2
>> > + * of the License, or (at your option) any later version.
>> > + *
>> > + * This program is distributed in the hope that it will be useful,
>> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> > + * GNU General Public License for more details.
>> > + *
>> > + * You should have received a copy of the GNU General Public License
>> > + * along with this program; if not, see .
>> > + */
>>
>> May be you could use the new SPDX tags instead of this fine but long
>> legalese? [1]
>> This would replace ~12 lines of comment by a single line with the same 
>> effect.
>> Thanks!
>
> I don't know about that. How come it is perceived as equivalent? I mean,
> we have a well-established way how to say that a particular source
> code/file is distributed with GPL license. Well-established means that
> it's been tested in court AFAIK many times. Even the license itself (found
> in COPYING file) mentions this as way how to attach the license to a file.
>
> Now you want it to be replaced with a tag. Does it say the same? It might.
> It might not. Do we know? Have you got a court ruling which would say that
> this is also a way how to attach a license to a file? I doubt it. It may
> seem trivially clear, but there are no such things in the legal world.
>
> Don't make me wrong. I don't like that copyright thingie much. I don't
> like that you can find even different versions of the text in the kernel
> source code (and not only there).
>
> However I'd prefer to leave at least a note there that the file is still
> distributed under the terms of GPL found in COPYING file. The tag can be
> there too, if it makes someone happy.
>
> Regards,
> Miroslav
>
>> [1]  
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/license-rules.rst
>> --
>> Philippe
>>
>

To the best of my knowledge, this has been debated in person and on
list among maintainers and agreed to.
This has also been reviewed by the LF lawyers. The result of is the
documentation in [1]
You are welcomed not to agree of course, but this would make your
contributions stand out with its legalese boilerplate when we are
trying to get of it.

Greg, anything else to add?

CC: Greg Kroah-Hartman 
-- 
Cordially
Philippe Ombredanne


Re: [PATCH v0 1/3] livepatch: add sample cumulative patch

2018-03-01 Thread Philippe Ombredanne
Miroslav,

On Tue, Feb 27, 2018 at 3:54 AM, Miroslav Benes  wrote:
> On Sat, 24 Feb 2018, Philippe Ombredanne wrote:
>
>> Joe,
>>
>> On Fri, Feb 23, 2018 at 1:33 PM, Joe Lawrence  
>> wrote:
>> > Add a simple atomic replace / cumulative livepatch example.
>> >
>> > Signed-off-by: Joe Lawrence 
>> > ---
>> >  samples/livepatch/Makefile   |   1 +
>> >  samples/livepatch/livepatch-cumulative.c | 216 
>> > +++
>> >  2 files changed, 217 insertions(+)
>> >  create mode 100644 samples/livepatch/livepatch-cumulative.c
>> >
>> > diff --git a/samples/livepatch/Makefile b/samples/livepatch/Makefile
>> > index 2472ce39a18d..dd0e2a8af1af 100644
>> > --- a/samples/livepatch/Makefile
>> > +++ b/samples/livepatch/Makefile
>> > @@ -5,3 +5,4 @@ obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-shadow-fix2.o
>> >  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-demo.o
>> >  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-mod.o
>> >  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-busymod.o
>> > +obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-cumulative.o
>> > diff --git a/samples/livepatch/livepatch-cumulative.c 
>> > b/samples/livepatch/livepatch-cumulative.c
>> > new file mode 100644
>> > index ..ab036439e08c
>> > --- /dev/null
>> > +++ b/samples/livepatch/livepatch-cumulative.c
>> > @@ -0,0 +1,216 @@
>> > +/*
>> > + * Copyright (C) 2018 Joe Lawrence 
>> > + *
>> > + * This program is free software; you can redistribute it and/or
>> > + * modify it under the terms of the GNU General Public License
>> > + * as published by the Free Software Foundation; either version 2
>> > + * of the License, or (at your option) any later version.
>> > + *
>> > + * This program is distributed in the hope that it will be useful,
>> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> > + * GNU General Public License for more details.
>> > + *
>> > + * You should have received a copy of the GNU General Public License
>> > + * along with this program; if not, see .
>> > + */
>>
>> May be you could use the new SPDX tags instead of this fine but long
>> legalese? [1]
>> This would replace ~12 lines of comment by a single line with the same 
>> effect.
>> Thanks!
>
> I don't know about that. How come it is perceived as equivalent? I mean,
> we have a well-established way how to say that a particular source
> code/file is distributed with GPL license. Well-established means that
> it's been tested in court AFAIK many times. Even the license itself (found
> in COPYING file) mentions this as way how to attach the license to a file.
>
> Now you want it to be replaced with a tag. Does it say the same? It might.
> It might not. Do we know? Have you got a court ruling which would say that
> this is also a way how to attach a license to a file? I doubt it. It may
> seem trivially clear, but there are no such things in the legal world.
>
> Don't make me wrong. I don't like that copyright thingie much. I don't
> like that you can find even different versions of the text in the kernel
> source code (and not only there).
>
> However I'd prefer to leave at least a note there that the file is still
> distributed under the terms of GPL found in COPYING file. The tag can be
> there too, if it makes someone happy.
>
> Regards,
> Miroslav
>
>> [1]  
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/license-rules.rst
>> --
>> Philippe
>>
>

To the best of my knowledge, this has been debated in person and on
list among maintainers and agreed to.
This has also been reviewed by the LF lawyers. The result of is the
documentation in [1]
You are welcomed not to agree of course, but this would make your
contributions stand out with its legalese boilerplate when we are
trying to get of it.

Greg, anything else to add?

CC: Greg Kroah-Hartman 
-- 
Cordially
Philippe Ombredanne


Re: [PATCH v0 1/3] livepatch: add sample cumulative patch

2018-02-27 Thread Miroslav Benes
On Sat, 24 Feb 2018, Philippe Ombredanne wrote:

> Joe,
> 
> On Fri, Feb 23, 2018 at 1:33 PM, Joe Lawrence  wrote:
> > Add a simple atomic replace / cumulative livepatch example.
> >
> > Signed-off-by: Joe Lawrence 
> > ---
> >  samples/livepatch/Makefile   |   1 +
> >  samples/livepatch/livepatch-cumulative.c | 216 
> > +++
> >  2 files changed, 217 insertions(+)
> >  create mode 100644 samples/livepatch/livepatch-cumulative.c
> >
> > diff --git a/samples/livepatch/Makefile b/samples/livepatch/Makefile
> > index 2472ce39a18d..dd0e2a8af1af 100644
> > --- a/samples/livepatch/Makefile
> > +++ b/samples/livepatch/Makefile
> > @@ -5,3 +5,4 @@ obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-shadow-fix2.o
> >  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-demo.o
> >  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-mod.o
> >  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-busymod.o
> > +obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-cumulative.o
> > diff --git a/samples/livepatch/livepatch-cumulative.c 
> > b/samples/livepatch/livepatch-cumulative.c
> > new file mode 100644
> > index ..ab036439e08c
> > --- /dev/null
> > +++ b/samples/livepatch/livepatch-cumulative.c
> > @@ -0,0 +1,216 @@
> > +/*
> > + * Copyright (C) 2018 Joe Lawrence 
> > + *
> > + * This program is free software; you can redistribute it and/or
> > + * modify it under the terms of the GNU General Public License
> > + * as published by the Free Software Foundation; either version 2
> > + * of the License, or (at your option) any later version.
> > + *
> > + * This program is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > + * GNU General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU General Public License
> > + * along with this program; if not, see .
> > + */
> 
> May be you could use the new SPDX tags instead of this fine but long
> legalese? [1]
> This would replace ~12 lines of comment by a single line with the same effect.
> Thanks!

I don't know about that. How come it is perceived as equivalent? I mean, 
we have a well-established way how to say that a particular source 
code/file is distributed with GPL license. Well-established means that 
it's been tested in court AFAIK many times. Even the license itself (found 
in COPYING file) mentions this as way how to attach the license to a file.

Now you want it to be replaced with a tag. Does it say the same? It might. 
It might not. Do we know? Have you got a court ruling which would say that 
this is also a way how to attach a license to a file? I doubt it. It may 
seem trivially clear, but there are no such things in the legal world.

Don't make me wrong. I don't like that copyright thingie much. I don't 
like that you can find even different versions of the text in the kernel 
source code (and not only there).

However I'd prefer to leave at least a note there that the file is still 
distributed under the terms of GPL found in COPYING file. The tag can be 
there too, if it makes someone happy.

Regards,
Miroslav

> [1]  
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/license-rules.rst
> --
> Philippe
> 



Re: [PATCH v0 1/3] livepatch: add sample cumulative patch

2018-02-27 Thread Miroslav Benes
On Sat, 24 Feb 2018, Philippe Ombredanne wrote:

> Joe,
> 
> On Fri, Feb 23, 2018 at 1:33 PM, Joe Lawrence  wrote:
> > Add a simple atomic replace / cumulative livepatch example.
> >
> > Signed-off-by: Joe Lawrence 
> > ---
> >  samples/livepatch/Makefile   |   1 +
> >  samples/livepatch/livepatch-cumulative.c | 216 
> > +++
> >  2 files changed, 217 insertions(+)
> >  create mode 100644 samples/livepatch/livepatch-cumulative.c
> >
> > diff --git a/samples/livepatch/Makefile b/samples/livepatch/Makefile
> > index 2472ce39a18d..dd0e2a8af1af 100644
> > --- a/samples/livepatch/Makefile
> > +++ b/samples/livepatch/Makefile
> > @@ -5,3 +5,4 @@ obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-shadow-fix2.o
> >  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-demo.o
> >  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-mod.o
> >  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-busymod.o
> > +obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-cumulative.o
> > diff --git a/samples/livepatch/livepatch-cumulative.c 
> > b/samples/livepatch/livepatch-cumulative.c
> > new file mode 100644
> > index ..ab036439e08c
> > --- /dev/null
> > +++ b/samples/livepatch/livepatch-cumulative.c
> > @@ -0,0 +1,216 @@
> > +/*
> > + * Copyright (C) 2018 Joe Lawrence 
> > + *
> > + * This program is free software; you can redistribute it and/or
> > + * modify it under the terms of the GNU General Public License
> > + * as published by the Free Software Foundation; either version 2
> > + * of the License, or (at your option) any later version.
> > + *
> > + * This program is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > + * GNU General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU General Public License
> > + * along with this program; if not, see .
> > + */
> 
> May be you could use the new SPDX tags instead of this fine but long
> legalese? [1]
> This would replace ~12 lines of comment by a single line with the same effect.
> Thanks!

I don't know about that. How come it is perceived as equivalent? I mean, 
we have a well-established way how to say that a particular source 
code/file is distributed with GPL license. Well-established means that 
it's been tested in court AFAIK many times. Even the license itself (found 
in COPYING file) mentions this as way how to attach the license to a file.

Now you want it to be replaced with a tag. Does it say the same? It might. 
It might not. Do we know? Have you got a court ruling which would say that 
this is also a way how to attach a license to a file? I doubt it. It may 
seem trivially clear, but there are no such things in the legal world.

Don't make me wrong. I don't like that copyright thingie much. I don't 
like that you can find even different versions of the text in the kernel 
source code (and not only there).

However I'd prefer to leave at least a note there that the file is still 
distributed under the terms of GPL found in COPYING file. The tag can be 
there too, if it makes someone happy.

Regards,
Miroslav

> [1]  
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/license-rules.rst
> --
> Philippe
> 



Re: [PATCH v0 1/3] livepatch: add sample cumulative patch

2018-02-27 Thread Miroslav Benes
Hi,

On Fri, 23 Feb 2018, Joe Lawrence wrote:

> Add a simple atomic replace / cumulative livepatch example.

It's not a cumulative patch, so I'd stick with an atomic replace example. 
The same applies to the subject, module name and also the comments.
 
> Signed-off-by: Joe Lawrence 
> ---
>  samples/livepatch/Makefile   |   1 +
>  samples/livepatch/livepatch-cumulative.c | 216 
> +++
>  2 files changed, 217 insertions(+)
>  create mode 100644 samples/livepatch/livepatch-cumulative.c
> 
> diff --git a/samples/livepatch/Makefile b/samples/livepatch/Makefile
> index 2472ce39a18d..dd0e2a8af1af 100644
> --- a/samples/livepatch/Makefile
> +++ b/samples/livepatch/Makefile
> @@ -5,3 +5,4 @@ obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-shadow-fix2.o
>  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-demo.o
>  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-mod.o
>  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-busymod.o
> +obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-cumulative.o
> diff --git a/samples/livepatch/livepatch-cumulative.c 
> b/samples/livepatch/livepatch-cumulative.c
> new file mode 100644
> index ..ab036439e08c
> --- /dev/null
> +++ b/samples/livepatch/livepatch-cumulative.c
> @@ -0,0 +1,216 @@
> +/*
> + * Copyright (C) 2018 Joe Lawrence 
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, see .
> + */
> +
> +/*
> + * livepatch-callbacks-cumulative.c - atomic replace / cumulative livepatch 
> demo
> + *
> + *
> + * Purpose
> + * ---
> + *
> + * Demonstration of atomic replace / cumulative livepatching.
> + *
> + *
> + * Usage
> + * -
> + *
> + * Step 1 - Load the sample livepatch demo
> + *
> + *   insmod samples/livepatch/livepatch-sample.ko
> + *
> + * Notice that /proc/cmdline was modified by the patch.  For the moment,
> + * /proc/meminfo remains unmodified.
> + *
> + *   head /proc/cmdline /proc/meminfo
> + *   ==> /proc/cmdline <==
> + *   this has been live patched

Could you add the module names to the messages in livepatch-sample.c and 
here in the new sample module? It'd be clear what came from where then.

Otherwise it looks good.

Regards,
Miroslav


Re: [PATCH v0 1/3] livepatch: add sample cumulative patch

2018-02-27 Thread Miroslav Benes
Hi,

On Fri, 23 Feb 2018, Joe Lawrence wrote:

> Add a simple atomic replace / cumulative livepatch example.

It's not a cumulative patch, so I'd stick with an atomic replace example. 
The same applies to the subject, module name and also the comments.
 
> Signed-off-by: Joe Lawrence 
> ---
>  samples/livepatch/Makefile   |   1 +
>  samples/livepatch/livepatch-cumulative.c | 216 
> +++
>  2 files changed, 217 insertions(+)
>  create mode 100644 samples/livepatch/livepatch-cumulative.c
> 
> diff --git a/samples/livepatch/Makefile b/samples/livepatch/Makefile
> index 2472ce39a18d..dd0e2a8af1af 100644
> --- a/samples/livepatch/Makefile
> +++ b/samples/livepatch/Makefile
> @@ -5,3 +5,4 @@ obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-shadow-fix2.o
>  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-demo.o
>  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-mod.o
>  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-busymod.o
> +obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-cumulative.o
> diff --git a/samples/livepatch/livepatch-cumulative.c 
> b/samples/livepatch/livepatch-cumulative.c
> new file mode 100644
> index ..ab036439e08c
> --- /dev/null
> +++ b/samples/livepatch/livepatch-cumulative.c
> @@ -0,0 +1,216 @@
> +/*
> + * Copyright (C) 2018 Joe Lawrence 
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, see .
> + */
> +
> +/*
> + * livepatch-callbacks-cumulative.c - atomic replace / cumulative livepatch 
> demo
> + *
> + *
> + * Purpose
> + * ---
> + *
> + * Demonstration of atomic replace / cumulative livepatching.
> + *
> + *
> + * Usage
> + * -
> + *
> + * Step 1 - Load the sample livepatch demo
> + *
> + *   insmod samples/livepatch/livepatch-sample.ko
> + *
> + * Notice that /proc/cmdline was modified by the patch.  For the moment,
> + * /proc/meminfo remains unmodified.
> + *
> + *   head /proc/cmdline /proc/meminfo
> + *   ==> /proc/cmdline <==
> + *   this has been live patched

Could you add the module names to the messages in livepatch-sample.c and 
here in the new sample module? It'd be clear what came from where then.

Otherwise it looks good.

Regards,
Miroslav


Re: [PATCH v0 1/3] livepatch: add sample cumulative patch

2018-02-24 Thread Philippe Ombredanne
Joe,

On Fri, Feb 23, 2018 at 1:33 PM, Joe Lawrence  wrote:
> Add a simple atomic replace / cumulative livepatch example.
>
> Signed-off-by: Joe Lawrence 
> ---
>  samples/livepatch/Makefile   |   1 +
>  samples/livepatch/livepatch-cumulative.c | 216 
> +++
>  2 files changed, 217 insertions(+)
>  create mode 100644 samples/livepatch/livepatch-cumulative.c
>
> diff --git a/samples/livepatch/Makefile b/samples/livepatch/Makefile
> index 2472ce39a18d..dd0e2a8af1af 100644
> --- a/samples/livepatch/Makefile
> +++ b/samples/livepatch/Makefile
> @@ -5,3 +5,4 @@ obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-shadow-fix2.o
>  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-demo.o
>  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-mod.o
>  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-busymod.o
> +obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-cumulative.o
> diff --git a/samples/livepatch/livepatch-cumulative.c 
> b/samples/livepatch/livepatch-cumulative.c
> new file mode 100644
> index ..ab036439e08c
> --- /dev/null
> +++ b/samples/livepatch/livepatch-cumulative.c
> @@ -0,0 +1,216 @@
> +/*
> + * Copyright (C) 2018 Joe Lawrence 
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, see .
> + */

May be you could use the new SPDX tags instead of this fine but long
legalese? [1]
This would replace ~12 lines of comment by a single line with the same effect.
Thanks!

[1]  
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/license-rules.rst
--
Philippe


Re: [PATCH v0 1/3] livepatch: add sample cumulative patch

2018-02-24 Thread Philippe Ombredanne
Joe,

On Fri, Feb 23, 2018 at 1:33 PM, Joe Lawrence  wrote:
> Add a simple atomic replace / cumulative livepatch example.
>
> Signed-off-by: Joe Lawrence 
> ---
>  samples/livepatch/Makefile   |   1 +
>  samples/livepatch/livepatch-cumulative.c | 216 
> +++
>  2 files changed, 217 insertions(+)
>  create mode 100644 samples/livepatch/livepatch-cumulative.c
>
> diff --git a/samples/livepatch/Makefile b/samples/livepatch/Makefile
> index 2472ce39a18d..dd0e2a8af1af 100644
> --- a/samples/livepatch/Makefile
> +++ b/samples/livepatch/Makefile
> @@ -5,3 +5,4 @@ obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-shadow-fix2.o
>  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-demo.o
>  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-mod.o
>  obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-busymod.o
> +obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-cumulative.o
> diff --git a/samples/livepatch/livepatch-cumulative.c 
> b/samples/livepatch/livepatch-cumulative.c
> new file mode 100644
> index ..ab036439e08c
> --- /dev/null
> +++ b/samples/livepatch/livepatch-cumulative.c
> @@ -0,0 +1,216 @@
> +/*
> + * Copyright (C) 2018 Joe Lawrence 
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, see .
> + */

May be you could use the new SPDX tags instead of this fine but long
legalese? [1]
This would replace ~12 lines of comment by a single line with the same effect.
Thanks!

[1]  
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/license-rules.rst
--
Philippe


[PATCH v0 1/3] livepatch: add sample cumulative patch

2018-02-23 Thread Joe Lawrence
Add a simple atomic replace / cumulative livepatch example.

Signed-off-by: Joe Lawrence 
---
 samples/livepatch/Makefile   |   1 +
 samples/livepatch/livepatch-cumulative.c | 216 +++
 2 files changed, 217 insertions(+)
 create mode 100644 samples/livepatch/livepatch-cumulative.c

diff --git a/samples/livepatch/Makefile b/samples/livepatch/Makefile
index 2472ce39a18d..dd0e2a8af1af 100644
--- a/samples/livepatch/Makefile
+++ b/samples/livepatch/Makefile
@@ -5,3 +5,4 @@ obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-shadow-fix2.o
 obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-demo.o
 obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-mod.o
 obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-busymod.o
+obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-cumulative.o
diff --git a/samples/livepatch/livepatch-cumulative.c 
b/samples/livepatch/livepatch-cumulative.c
new file mode 100644
index ..ab036439e08c
--- /dev/null
+++ b/samples/livepatch/livepatch-cumulative.c
@@ -0,0 +1,216 @@
+/*
+ * Copyright (C) 2018 Joe Lawrence 
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see .
+ */
+
+/*
+ * livepatch-callbacks-cumulative.c - atomic replace / cumulative livepatch 
demo
+ *
+ *
+ * Purpose
+ * ---
+ *
+ * Demonstration of atomic replace / cumulative livepatching.
+ *
+ *
+ * Usage
+ * -
+ *
+ * Step 1 - Load the sample livepatch demo
+ *
+ *   insmod samples/livepatch/livepatch-sample.ko
+ *
+ * Notice that /proc/cmdline was modified by the patch.  For the moment,
+ * /proc/meminfo remains unmodified.
+ *
+ *   head /proc/cmdline /proc/meminfo
+ *   ==> /proc/cmdline <==
+ *   this has been live patched
+ *
+ *   ==> /proc/meminfo <==
+ *   MemTotal:4041368 kB
+ *   MemFree: 3323504 kB
+ *   MemAvailable:3619968 kB
+ *   Buffers:2108 kB
+ *   Cached:   484696 kB
+ *   SwapCached:0 kB
+ *   Active:   297960 kB
+ *   Inactive: 262964 kB
+ *   Active(anon):  74296 kB
+ *   Inactive(anon): 8300 kB
+ *
+ *
+ * Step 2 - Load a second patch (on top of sample)
+ *
+ *   insmod samples/livepatch/livepatch-cumulative.ko replace=0
+ *
+ * The second livepatch adds a modification to meminfo_proc_show(),
+ * changing the output of /proc/meminfo.  In this case, the second
+ * livepatch *supplements* the features of the first:
+ *
+ *   head /proc/cmdline /proc/meminfo
+ *   ==> /proc/cmdline <==
+ *   this has been live patched
+ *
+ *   ==> /proc/meminfo <==
+ *   this has been live patched
+ *
+ * and module references and livepatch enable counts reflect both
+ * livepatches accordingly:
+ *
+ *   lsmod | grep livepatch
+ *   livepatch_cumulative16384  1
+ *   livepatch_sample   16384  1
+ *
+ *   head /sys/kernel/livepatch/livepatch_{cumulative,sample}/enabled
+ *   ==> /sys/kernel/livepatch/livepatch_cumulative/enabled <==
+ *   1
+ *
+ *   ==> /sys/kernel/livepatch/livepatch_sample/enabled <==
+ *   1
+ *
+ *
+ * Step 3 - Remove the second patch
+ *
+ *   echo 0 > /sys/kernel/livepatch/livepatch_cumulative/enabled
+ *   rmmod livepatch-cumulative
+ *
+ *
+ * Step 4 - Load a second patch in atomic replace mode
+ *
+ *   insmod samples/livepatch/livepatch-cumulative.ko replace=1
+ *
+ * This time, notice that the second patch has *replaced* the features of
+ * the first place:
+ *
+ *   head /proc/cmdline /proc/meminfo
+ *   ==> /proc/cmdline <==
+ *   BOOT_IMAGE=/vmlinuz-4.16.0-rc2+ root=/dev/mapper/centos-root ro 
console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH crashkernel=auto 
rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet LANG=en_US.UTF-8
+ *
+ *   ==> /proc/meminfo <==
+ *   this has been live patched
+ *
+ * The first patch is automatically disabled:
+ *
+ *   lsmod | grep livepatch
+ *   livepatch_cumulative16384  1
+ *   livepatch_sample   16384  0
+ *
+ *   head /sys/kernel/livepatch/livepatch_{cumulative,sample}/enabled
+ *   ==> /sys/kernel/livepatch/livepatch_cumulative/enabled <==
+ *   1
+ *
+ *   ==> /sys/kernel/livepatch/livepatch_sample/enabled <==
+ *   0
+ *
+ *
+ * Step 5 - Clean up
+ *
+ * Since the first patch was replaced, it is already disabled and its
+ * module may be removed:
+ *
+ *   rmmod livepatch_sample
+ *   echo 0 > /sys/kernel/livepatch/livepatch_cumulative/enabled
+ *   rmmod 

[PATCH v0 1/3] livepatch: add sample cumulative patch

2018-02-23 Thread Joe Lawrence
Add a simple atomic replace / cumulative livepatch example.

Signed-off-by: Joe Lawrence 
---
 samples/livepatch/Makefile   |   1 +
 samples/livepatch/livepatch-cumulative.c | 216 +++
 2 files changed, 217 insertions(+)
 create mode 100644 samples/livepatch/livepatch-cumulative.c

diff --git a/samples/livepatch/Makefile b/samples/livepatch/Makefile
index 2472ce39a18d..dd0e2a8af1af 100644
--- a/samples/livepatch/Makefile
+++ b/samples/livepatch/Makefile
@@ -5,3 +5,4 @@ obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-shadow-fix2.o
 obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-demo.o
 obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-mod.o
 obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-callbacks-busymod.o
+obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-cumulative.o
diff --git a/samples/livepatch/livepatch-cumulative.c 
b/samples/livepatch/livepatch-cumulative.c
new file mode 100644
index ..ab036439e08c
--- /dev/null
+++ b/samples/livepatch/livepatch-cumulative.c
@@ -0,0 +1,216 @@
+/*
+ * Copyright (C) 2018 Joe Lawrence 
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see .
+ */
+
+/*
+ * livepatch-callbacks-cumulative.c - atomic replace / cumulative livepatch 
demo
+ *
+ *
+ * Purpose
+ * ---
+ *
+ * Demonstration of atomic replace / cumulative livepatching.
+ *
+ *
+ * Usage
+ * -
+ *
+ * Step 1 - Load the sample livepatch demo
+ *
+ *   insmod samples/livepatch/livepatch-sample.ko
+ *
+ * Notice that /proc/cmdline was modified by the patch.  For the moment,
+ * /proc/meminfo remains unmodified.
+ *
+ *   head /proc/cmdline /proc/meminfo
+ *   ==> /proc/cmdline <==
+ *   this has been live patched
+ *
+ *   ==> /proc/meminfo <==
+ *   MemTotal:4041368 kB
+ *   MemFree: 3323504 kB
+ *   MemAvailable:3619968 kB
+ *   Buffers:2108 kB
+ *   Cached:   484696 kB
+ *   SwapCached:0 kB
+ *   Active:   297960 kB
+ *   Inactive: 262964 kB
+ *   Active(anon):  74296 kB
+ *   Inactive(anon): 8300 kB
+ *
+ *
+ * Step 2 - Load a second patch (on top of sample)
+ *
+ *   insmod samples/livepatch/livepatch-cumulative.ko replace=0
+ *
+ * The second livepatch adds a modification to meminfo_proc_show(),
+ * changing the output of /proc/meminfo.  In this case, the second
+ * livepatch *supplements* the features of the first:
+ *
+ *   head /proc/cmdline /proc/meminfo
+ *   ==> /proc/cmdline <==
+ *   this has been live patched
+ *
+ *   ==> /proc/meminfo <==
+ *   this has been live patched
+ *
+ * and module references and livepatch enable counts reflect both
+ * livepatches accordingly:
+ *
+ *   lsmod | grep livepatch
+ *   livepatch_cumulative16384  1
+ *   livepatch_sample   16384  1
+ *
+ *   head /sys/kernel/livepatch/livepatch_{cumulative,sample}/enabled
+ *   ==> /sys/kernel/livepatch/livepatch_cumulative/enabled <==
+ *   1
+ *
+ *   ==> /sys/kernel/livepatch/livepatch_sample/enabled <==
+ *   1
+ *
+ *
+ * Step 3 - Remove the second patch
+ *
+ *   echo 0 > /sys/kernel/livepatch/livepatch_cumulative/enabled
+ *   rmmod livepatch-cumulative
+ *
+ *
+ * Step 4 - Load a second patch in atomic replace mode
+ *
+ *   insmod samples/livepatch/livepatch-cumulative.ko replace=1
+ *
+ * This time, notice that the second patch has *replaced* the features of
+ * the first place:
+ *
+ *   head /proc/cmdline /proc/meminfo
+ *   ==> /proc/cmdline <==
+ *   BOOT_IMAGE=/vmlinuz-4.16.0-rc2+ root=/dev/mapper/centos-root ro 
console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH crashkernel=auto 
rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet LANG=en_US.UTF-8
+ *
+ *   ==> /proc/meminfo <==
+ *   this has been live patched
+ *
+ * The first patch is automatically disabled:
+ *
+ *   lsmod | grep livepatch
+ *   livepatch_cumulative16384  1
+ *   livepatch_sample   16384  0
+ *
+ *   head /sys/kernel/livepatch/livepatch_{cumulative,sample}/enabled
+ *   ==> /sys/kernel/livepatch/livepatch_cumulative/enabled <==
+ *   1
+ *
+ *   ==> /sys/kernel/livepatch/livepatch_sample/enabled <==
+ *   0
+ *
+ *
+ * Step 5 - Clean up
+ *
+ * Since the first patch was replaced, it is already disabled and its
+ * module may be removed:
+ *
+ *   rmmod livepatch_sample
+ *   echo 0 > /sys/kernel/livepatch/livepatch_cumulative/enabled
+ *   rmmod livepatch-cumulative
+ */
+
+
+#define pr_fmt(fmt)