All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libxl: fix build on rather old systems
@ 2019-01-11 10:09 Jan Beulich
  2019-01-11 11:18 ` Wei Liu
  2019-01-11 12:41 ` Wei Liu
  0 siblings, 2 replies; 10+ messages in thread
From: Jan Beulich @ 2019-01-11 10:09 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, Ian Jackson, Wei Liu

CLONE_NEWIPC has been introduced in Linux 2.6.19 only (and into glibc
at around that time as well). Cope with it being undefined as well as
with the underlying kernel not knowing of it.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
Considering how old "old" here really means, I could understand if
this was rejected, in which case I'd carry a simplified version locally.
I don't run such old kernels together with modern Xen, but I do
occasionally build on such old systems.

--- a/tools/libxl/libxl_linux.c
+++ b/tools/libxl/libxl_linux.c
@@ -334,12 +334,24 @@ int libxl__local_dm_preexec_restrict(lib
     unsigned i;
 
     /* Unshare mount and IPC namespaces.  These are unused by QEMU. */
-    r = unshare(CLONE_NEWNS | CLONE_NEWIPC);
+    r = unshare(CLONE_NEWNS);
     if (r) {
-        LOGE(ERROR, "libxl: Mount and IPC namespace unfailed");
+        LOGE(ERROR, "libxl: Mount namespace unshare failed");
         return ERROR_FAIL;
     }
 
+#ifndef CLONE_NEWIPC /* Available as of Linux 2.6.19 / glibc 2.8 */
+# define CLONE_NEWIPC 0x08000000
+#endif
+    r = unshare(CLONE_NEWIPC);
+    if (r) {
+        if (r && errno != EINVAL) {
+            LOGE(ERROR, "libxl: IPC namespace unshare failed");
+            return ERROR_FAIL;
+        }
+        LOG(WARN, "libxl: IPC namespace unshare unavailable");
+    }
+
     /* Set various "easy" rlimits */
     for (i = 0; rlimits[i].resource != RLIMIT_NLIMITS; i++) {
         struct rlimit rlim;





_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] libxl: fix build on rather old systems
  2019-01-11 10:09 [PATCH] libxl: fix build on rather old systems Jan Beulich
@ 2019-01-11 11:18 ` Wei Liu
  2019-01-11 11:24   ` Jan Beulich
  2019-01-11 12:06   ` George Dunlap
  2019-01-11 12:41 ` Wei Liu
  1 sibling, 2 replies; 10+ messages in thread
From: Wei Liu @ 2019-01-11 11:18 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Juergen Gross, xen-devel, Wei Liu, Ian Jackson, George Dunlap

On Fri, Jan 11, 2019 at 03:09:35AM -0700, Jan Beulich wrote:
> CLONE_NEWIPC has been introduced in Linux 2.6.19 only (and into glibc
> at around that time as well). Cope with it being undefined as well as
> with the underlying kernel not knowing of it.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> ---
> Considering how old "old" here really means, I could understand if
> this was rejected, in which case I'd carry a simplified version locally.
> I don't run such old kernels together with modern Xen, but I do
> occasionally build on such old systems.
> 
> --- a/tools/libxl/libxl_linux.c
> +++ b/tools/libxl/libxl_linux.c
> @@ -334,12 +334,24 @@ int libxl__local_dm_preexec_restrict(lib
>      unsigned i;
>  
>      /* Unshare mount and IPC namespaces.  These are unused by QEMU. */
> -    r = unshare(CLONE_NEWNS | CLONE_NEWIPC);
> +    r = unshare(CLONE_NEWNS);
>      if (r) {
> -        LOGE(ERROR, "libxl: Mount and IPC namespace unfailed");
> +        LOGE(ERROR, "libxl: Mount namespace unshare failed");
>          return ERROR_FAIL;
>      }
>  
> +#ifndef CLONE_NEWIPC /* Available as of Linux 2.6.19 / glibc 2.8 */
> +# define CLONE_NEWIPC 0x08000000

I have no problem making it build with this.

> +#endif
> +    r = unshare(CLONE_NEWIPC);
> +    if (r) {
> +        if (r && errno != EINVAL) {
> +            LOGE(ERROR, "libxl: IPC namespace unshare failed");
> +            return ERROR_FAIL;
> +        }
> +        LOG(WARN, "libxl: IPC namespace unshare unavailable");

But I guess whether it should be allowed to continue or not is another
question. Do we consider this IPC namespace "must-have"?

CC George as well.

Wei.

> +    }
> +
>      /* Set various "easy" rlimits */
>      for (i = 0; rlimits[i].resource != RLIMIT_NLIMITS; i++) {
>          struct rlimit rlim;
> 
> 
> 
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] libxl: fix build on rather old systems
  2019-01-11 11:18 ` Wei Liu
@ 2019-01-11 11:24   ` Jan Beulich
  2019-01-11 12:03     ` Wei Liu
  2019-01-11 12:06   ` George Dunlap
  1 sibling, 1 reply; 10+ messages in thread
From: Jan Beulich @ 2019-01-11 11:24 UTC (permalink / raw)
  To: Wei Liu; +Cc: George Dunlap, xen-devel, Ian Jackson, Juergen Gross

>>> On 11.01.19 at 12:18, <wei.liu2@citrix.com> wrote:
> On Fri, Jan 11, 2019 at 03:09:35AM -0700, Jan Beulich wrote:
>> CLONE_NEWIPC has been introduced in Linux 2.6.19 only (and into glibc
>> at around that time as well). Cope with it being undefined as well as
>> with the underlying kernel not knowing of it.
>> 
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> ---
>> Considering how old "old" here really means, I could understand if
>> this was rejected, in which case I'd carry a simplified version locally.
>> I don't run such old kernels together with modern Xen, but I do
>> occasionally build on such old systems.
>> 
>> --- a/tools/libxl/libxl_linux.c
>> +++ b/tools/libxl/libxl_linux.c
>> @@ -334,12 +334,24 @@ int libxl__local_dm_preexec_restrict(lib
>>      unsigned i;
>>  
>>      /* Unshare mount and IPC namespaces.  These are unused by QEMU. */
>> -    r = unshare(CLONE_NEWNS | CLONE_NEWIPC);
>> +    r = unshare(CLONE_NEWNS);
>>      if (r) {
>> -        LOGE(ERROR, "libxl: Mount and IPC namespace unfailed");
>> +        LOGE(ERROR, "libxl: Mount namespace unshare failed");
>>          return ERROR_FAIL;
>>      }
>>  
>> +#ifndef CLONE_NEWIPC /* Available as of Linux 2.6.19 / glibc 2.8 */
>> +# define CLONE_NEWIPC 0x08000000
> 
> I have no problem making it build with this.
> 
>> +#endif
>> +    r = unshare(CLONE_NEWIPC);
>> +    if (r) {
>> +        if (r && errno != EINVAL) {
>> +            LOGE(ERROR, "libxl: IPC namespace unshare failed");
>> +            return ERROR_FAIL;
>> +        }
>> +        LOG(WARN, "libxl: IPC namespace unshare unavailable");
> 
> But I guess whether it should be allowed to continue or not is another
> question. Do we consider this IPC namespace "must-have"?

Well, there simply can't be different namespaces to switch between
when the kernel doesn't understand the flag.

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] libxl: fix build on rather old systems
  2019-01-11 11:24   ` Jan Beulich
@ 2019-01-11 12:03     ` Wei Liu
  0 siblings, 0 replies; 10+ messages in thread
From: Wei Liu @ 2019-01-11 12:03 UTC (permalink / raw)
  To: Jan Beulich; +Cc: George Dunlap, Ian Jackson, Wei Liu, Juergen Gross, xen-devel

On Fri, Jan 11, 2019 at 04:24:35AM -0700, Jan Beulich wrote:
[...]
> > 
> >> +#endif
> >> +    r = unshare(CLONE_NEWIPC);
> >> +    if (r) {
> >> +        if (r && errno != EINVAL) {
> >> +            LOGE(ERROR, "libxl: IPC namespace unshare failed");
> >> +            return ERROR_FAIL;
> >> +        }
> >> +        LOG(WARN, "libxl: IPC namespace unshare unavailable");
> > 
> > But I guess whether it should be allowed to continue or not is another
> > question. Do we consider this IPC namespace "must-have"?
> 
> Well, there simply can't be different namespaces to switch between
> when the kernel doesn't understand the flag.
> 

... which means the isolation property is weaken by the lack of IPC
namespace.

If we don't want to weaken isolation, not allowing it to continue is the
right thing to do -- that means the hunk to split IPC namespace to
separate call is not necessary. If we would rather lower the isolation
guarantee provided, then this hunk needs to stay.

Wei.

> Jan
> 
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] libxl: fix build on rather old systems
  2019-01-11 11:18 ` Wei Liu
  2019-01-11 11:24   ` Jan Beulich
@ 2019-01-11 12:06   ` George Dunlap
  2019-01-11 12:09     ` Wei Liu
  2019-01-11 13:41     ` Jan Beulich
  1 sibling, 2 replies; 10+ messages in thread
From: George Dunlap @ 2019-01-11 12:06 UTC (permalink / raw)
  To: Wei Liu; +Cc: Juergen Gross, xen-devel, George Dunlap, Jan Beulich, Ian Jackson



> On Jan 11, 2019, at 9:18 PM, Wei Liu <wei.liu2@citrix.com> wrote:
> 
> On Fri, Jan 11, 2019 at 03:09:35AM -0700, Jan Beulich wrote:
>> CLONE_NEWIPC has been introduced in Linux 2.6.19 only (and into glibc
>> at around that time as well). Cope with it being undefined as well as
>> with the underlying kernel not knowing of it.
>> 
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> ---
>> Considering how old "old" here really means, I could understand if
>> this was rejected, in which case I'd carry a simplified version locally.
>> I don't run such old kernels together with modern Xen, but I do
>> occasionally build on such old systems.

But why do you build on it if you don’t run it?

>> 
>> --- a/tools/libxl/libxl_linux.c
>> +++ b/tools/libxl/libxl_linux.c
>> @@ -334,12 +334,24 @@ int libxl__local_dm_preexec_restrict(lib
>>     unsigned i;
>> 
>>     /* Unshare mount and IPC namespaces.  These are unused by QEMU. */
>> -    r = unshare(CLONE_NEWNS | CLONE_NEWIPC);
>> +    r = unshare(CLONE_NEWNS);
>>     if (r) {
>> -        LOGE(ERROR, "libxl: Mount and IPC namespace unfailed");
>> +        LOGE(ERROR, "libxl: Mount namespace unshare failed");
>>         return ERROR_FAIL;
>>     }
>> 
>> +#ifndef CLONE_NEWIPC /* Available as of Linux 2.6.19 / glibc 2.8 */
>> +# define CLONE_NEWIPC 0x08000000
> 
> I have no problem making it build with this.
> 
>> +#endif
>> +    r = unshare(CLONE_NEWIPC);
>> +    if (r) {
>> +        if (r && errno != EINVAL) {
>> +            LOGE(ERROR, "libxl: IPC namespace unshare failed");
>> +            return ERROR_FAIL;
>> +        }
>> +        LOG(WARN, "libxl: IPC namespace unshare unavailable");
> 
> But I guess whether it should be allowed to continue or not is another
> question. Do we consider this IPC namespace "must-have”?

On the contrary, the mount and IPC namespaces are “might-as-well” (or perhaps, “why-not-it-cant-hurt”).

I don’t really see any point making something build on a system that you’re not going to run it on; but I don’t feel strongly enough to do more than say so.  I’ll leave it up to the toolstack maintainers.

 -George
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] libxl: fix build on rather old systems
  2019-01-11 12:06   ` George Dunlap
@ 2019-01-11 12:09     ` Wei Liu
  2019-01-11 13:41     ` Jan Beulich
  1 sibling, 0 replies; 10+ messages in thread
From: Wei Liu @ 2019-01-11 12:09 UTC (permalink / raw)
  To: George Dunlap; +Cc: Juergen Gross, xen-devel, Wei Liu, Jan Beulich, Ian Jackson

On Fri, Jan 11, 2019 at 12:06:59PM +0000, George Dunlap wrote:
> 
> 
> > On Jan 11, 2019, at 9:18 PM, Wei Liu <wei.liu2@citrix.com> wrote:
> > 
> > On Fri, Jan 11, 2019 at 03:09:35AM -0700, Jan Beulich wrote:
> >> CLONE_NEWIPC has been introduced in Linux 2.6.19 only (and into glibc
> >> at around that time as well). Cope with it being undefined as well as
> >> with the underlying kernel not knowing of it.
> >> 
> >> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> >> ---
> >> Considering how old "old" here really means, I could understand if
> >> this was rejected, in which case I'd carry a simplified version locally.
> >> I don't run such old kernels together with modern Xen, but I do
> >> occasionally build on such old systems.
> 
> But why do you build on it if you don’t run it?
> 

It isn't uncommon to have separate build setup. But I guess haven't a
rather old build setup but run the software on a newer setup is
uncommon.

> >> 
> >> --- a/tools/libxl/libxl_linux.c
> >> +++ b/tools/libxl/libxl_linux.c
> >> @@ -334,12 +334,24 @@ int libxl__local_dm_preexec_restrict(lib
> >>     unsigned i;
> >> 
> >>     /* Unshare mount and IPC namespaces.  These are unused by QEMU. */
> >> -    r = unshare(CLONE_NEWNS | CLONE_NEWIPC);
> >> +    r = unshare(CLONE_NEWNS);
> >>     if (r) {
> >> -        LOGE(ERROR, "libxl: Mount and IPC namespace unfailed");
> >> +        LOGE(ERROR, "libxl: Mount namespace unshare failed");
> >>         return ERROR_FAIL;
> >>     }
> >> 
> >> +#ifndef CLONE_NEWIPC /* Available as of Linux 2.6.19 / glibc 2.8 */
> >> +# define CLONE_NEWIPC 0x08000000
> > 
> > I have no problem making it build with this.
> > 
> >> +#endif
> >> +    r = unshare(CLONE_NEWIPC);
> >> +    if (r) {
> >> +        if (r && errno != EINVAL) {
> >> +            LOGE(ERROR, "libxl: IPC namespace unshare failed");
> >> +            return ERROR_FAIL;
> >> +        }
> >> +        LOG(WARN, "libxl: IPC namespace unshare unavailable");
> > 
> > But I guess whether it should be allowed to continue or not is another
> > question. Do we consider this IPC namespace "must-have”?
> 
> On the contrary, the mount and IPC namespaces are “might-as-well” (or perhaps, “why-not-it-cant-hurt”).
> 
> I don’t really see any point making something build on a system that you’re not going to run it on; but I don’t feel strongly enough to do more than say so.  I’ll leave it up to the toolstack maintainers.

Fine then. I interpret this as "IPC namespace is not a must-have".
I think Jan's patch is fine. I will have a closer look in the afternoon.

Wei.

> 
>  -George

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] libxl: fix build on rather old systems
  2019-01-11 10:09 [PATCH] libxl: fix build on rather old systems Jan Beulich
  2019-01-11 11:18 ` Wei Liu
@ 2019-01-11 12:41 ` Wei Liu
  1 sibling, 0 replies; 10+ messages in thread
From: Wei Liu @ 2019-01-11 12:41 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Juergen Gross, xen-devel, Wei Liu, Ian Jackson

On Fri, Jan 11, 2019 at 03:09:35AM -0700, Jan Beulich wrote:
> CLONE_NEWIPC has been introduced in Linux 2.6.19 only (and into glibc
> at around that time as well). Cope with it being undefined as well as
> with the underlying kernel not knowing of it.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] libxl: fix build on rather old systems
  2019-01-11 12:06   ` George Dunlap
  2019-01-11 12:09     ` Wei Liu
@ 2019-01-11 13:41     ` Jan Beulich
  1 sibling, 0 replies; 10+ messages in thread
From: Jan Beulich @ 2019-01-11 13:41 UTC (permalink / raw)
  To: george.dunlap; +Cc: Juergen Gross, Ian Jackson, Wei Liu, xen-devel

>>> On 11.01.19 at 13:06, <George.Dunlap@citrix.com> wrote:
>> On Jan 11, 2019, at 9:18 PM, Wei Liu <wei.liu2@citrix.com> wrote:
>> On Fri, Jan 11, 2019 at 03:09:35AM -0700, Jan Beulich wrote:
>>> CLONE_NEWIPC has been introduced in Linux 2.6.19 only (and into glibc
>>> at around that time as well). Cope with it being undefined as well as
>>> with the underlying kernel not knowing of it.
>>> 
>>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>>> ---
>>> Considering how old "old" here really means, I could understand if
>>> this was rejected, in which case I'd carry a simplified version locally.
>>> I don't run such old kernels together with modern Xen, but I do
>>> occasionally build on such old systems.
> 
> But why do you build on it if you don’t run it?

I also run it there, just not with as old a kernel as the system headers
represent.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] libxl: fix build on rather old systems
  2019-01-11 14:42 ` Juergen Gross
@ 2019-01-11 17:40   ` Ian Jackson
  0 siblings, 0 replies; 10+ messages in thread
From: Ian Jackson @ 2019-01-11 17:40 UTC (permalink / raw)
  To: Juergen Gross; +Cc: xen-devel, Wei Liu, Jan Beulich

Juergen Gross writes ("Re: [PATCH] libxl: fix build on rather old systems"):
> On 11/01/2019 11:09, Jan Beulich wrote:
> > CLONE_NEWIPC has been introduced in Linux 2.6.19 only (and into glibc
> > at around that time as well). Cope with it being undefined as well as
> > with the underlying kernel not knowing of it.
> > 
> > Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Release-acked-by: Juergen Gross <jgross@suse.com>

I know I am too slow with this, but for the record:

Nacked-by: Ian Jackson <ian.jackson@eu.citrix.com>

On two grounds:

 1. This situation should be handled by disabling the dm restrict
    feature, not silently falling back to lower protection.

 2. Style, #ifdeffery.

I don't agree that the unshare of the IPC namespace is a `nice to
have'.  Without it, a rogue qemu might be able to do a number of bad
things.

Background: AIUI in kernels without CLONE_NEWIPC, the IPC namespace is
shared with the network namespace.  But of course what matters is what
the *runtime* kernel supports, not the build-time kernel.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] libxl: fix build on rather old systems
       [not found] <5C386B5F020000780020C96B@suse.com>
@ 2019-01-11 14:42 ` Juergen Gross
  2019-01-11 17:40   ` Ian Jackson
  0 siblings, 1 reply; 10+ messages in thread
From: Juergen Gross @ 2019-01-11 14:42 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: Ian Jackson, Wei Liu

On 11/01/2019 11:09, Jan Beulich wrote:
> CLONE_NEWIPC has been introduced in Linux 2.6.19 only (and into glibc
> at around that time as well). Cope with it being undefined as well as
> with the underlying kernel not knowing of it.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Release-acked-by: Juergen Gross <jgross@suse.com>


Juergen

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-01-11 17:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-11 10:09 [PATCH] libxl: fix build on rather old systems Jan Beulich
2019-01-11 11:18 ` Wei Liu
2019-01-11 11:24   ` Jan Beulich
2019-01-11 12:03     ` Wei Liu
2019-01-11 12:06   ` George Dunlap
2019-01-11 12:09     ` Wei Liu
2019-01-11 13:41     ` Jan Beulich
2019-01-11 12:41 ` Wei Liu
     [not found] <5C386B5F020000780020C96B@suse.com>
2019-01-11 14:42 ` Juergen Gross
2019-01-11 17:40   ` Ian Jackson

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.