* [PATCH] libselinux: Do not inline compile_regex()
@ 2025-06-11 18:28 James Carter
2025-06-11 18:31 ` Stephen Smalley
0 siblings, 1 reply; 5+ messages in thread
From: James Carter @ 2025-06-11 18:28 UTC (permalink / raw)
To: selinux; +Cc: James Carter
Since commit bdcbbf89b9548afd452449835e58e84105a71a9a (libselinux:
limit fcontext regex path length), an error would be given if
libselinux was compiled directly. (Though, building the whole SELinux
userspace still worked.) This is because the flag "-Winline" is used
when building libselinux directly, but not when building the whole
userspace.
Remove "inline" from the function compile_regex() in label_file.h
to allow libselinux to be built directly.
There are four functions defined in label_file.h that are not inlined:
regex_has_meta_chars(), regex_simplify(), compile_regex(), and
insert_spec(). The first three functions are called by insert_spec()
which is called by the inlined function process_line(). This last
function is called by utils/sefcontext_compile.c which prevents
relocating the non-inlined functions to label_file.c.
Signed-off-by: James Carter <jwcart2@gmail.com>
---
libselinux/src/label_file.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libselinux/src/label_file.h b/libselinux/src/label_file.h
index d1a0713a..8fcf74e3 100644
--- a/libselinux/src/label_file.h
+++ b/libselinux/src/label_file.h
@@ -390,7 +390,7 @@ static inline void sort_specs(struct saved_data *data)
sort_spec_node(data->root, NULL);
}
-static inline int compile_regex(struct regex_spec *spec, char *errbuf, size_t errbuf_size)
+static int compile_regex(struct regex_spec *spec, char *errbuf, size_t errbuf_size)
{
const char *reg_buf;
char *anchored_regex, *cp;
--
2.49.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] libselinux: Do not inline compile_regex()
2025-06-11 18:28 [PATCH] libselinux: Do not inline compile_regex() James Carter
@ 2025-06-11 18:31 ` Stephen Smalley
2025-06-11 19:10 ` Petr Lautrbach
0 siblings, 1 reply; 5+ messages in thread
From: Stephen Smalley @ 2025-06-11 18:31 UTC (permalink / raw)
To: James Carter; +Cc: selinux
On Wed, Jun 11, 2025 at 2:29 PM James Carter <jwcart2@gmail.com> wrote:
>
> Since commit bdcbbf89b9548afd452449835e58e84105a71a9a (libselinux:
> limit fcontext regex path length), an error would be given if
> libselinux was compiled directly. (Though, building the whole SELinux
> userspace still worked.) This is because the flag "-Winline" is used
> when building libselinux directly, but not when building the whole
> userspace.
>
> Remove "inline" from the function compile_regex() in label_file.h
> to allow libselinux to be built directly.
>
> There are four functions defined in label_file.h that are not inlined:
> regex_has_meta_chars(), regex_simplify(), compile_regex(), and
> insert_spec(). The first three functions are called by insert_spec()
> which is called by the inlined function process_line(). This last
> function is called by utils/sefcontext_compile.c which prevents
> relocating the non-inlined functions to label_file.c.
>
> Signed-off-by: James Carter <jwcart2@gmail.com>
Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
> ---
> libselinux/src/label_file.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libselinux/src/label_file.h b/libselinux/src/label_file.h
> index d1a0713a..8fcf74e3 100644
> --- a/libselinux/src/label_file.h
> +++ b/libselinux/src/label_file.h
> @@ -390,7 +390,7 @@ static inline void sort_specs(struct saved_data *data)
> sort_spec_node(data->root, NULL);
> }
>
> -static inline int compile_regex(struct regex_spec *spec, char *errbuf, size_t errbuf_size)
> +static int compile_regex(struct regex_spec *spec, char *errbuf, size_t errbuf_size)
> {
> const char *reg_buf;
> char *anchored_regex, *cp;
> --
> 2.49.0
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] libselinux: Do not inline compile_regex()
2025-06-11 18:31 ` Stephen Smalley
@ 2025-06-11 19:10 ` Petr Lautrbach
2025-06-11 19:13 ` Stephen Smalley
0 siblings, 1 reply; 5+ messages in thread
From: Petr Lautrbach @ 2025-06-11 19:10 UTC (permalink / raw)
To: Stephen Smalley, James Carter; +Cc: selinux
Stephen Smalley <stephen.smalley.work@gmail.com> writes:
> On Wed, Jun 11, 2025 at 2:29 PM James Carter <jwcart2@gmail.com> wrote:
>>
>> Since commit bdcbbf89b9548afd452449835e58e84105a71a9a (libselinux:
>> limit fcontext regex path length), an error would be given if
>> libselinux was compiled directly. (Though, building the whole SELinux
>> userspace still worked.) This is because the flag "-Winline" is used
>> when building libselinux directly, but not when building the whole
>> userspace.
>>
>> Remove "inline" from the function compile_regex() in label_file.h
>> to allow libselinux to be built directly.
>>
>> There are four functions defined in label_file.h that are not inlined:
>> regex_has_meta_chars(), regex_simplify(), compile_regex(), and
>> insert_spec(). The first three functions are called by insert_spec()
>> which is called by the inlined function process_line(). This last
>> function is called by utils/sefcontext_compile.c which prevents
>> relocating the non-inlined functions to label_file.c.
>>
>> Signed-off-by: James Carter <jwcart2@gmail.com>
>
> Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
>
I'm going to postpone 3.9-rc1 to tomorrow so this change can land there.
Ok?
>> ---
>> libselinux/src/label_file.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libselinux/src/label_file.h b/libselinux/src/label_file.h
>> index d1a0713a..8fcf74e3 100644
>> --- a/libselinux/src/label_file.h
>> +++ b/libselinux/src/label_file.h
>> @@ -390,7 +390,7 @@ static inline void sort_specs(struct saved_data *data)
>> sort_spec_node(data->root, NULL);
>> }
>>
>> -static inline int compile_regex(struct regex_spec *spec, char *errbuf, size_t errbuf_size)
>> +static int compile_regex(struct regex_spec *spec, char *errbuf, size_t errbuf_size)
>> {
>> const char *reg_buf;
>> char *anchored_regex, *cp;
>> --
>> 2.49.0
>>
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] libselinux: Do not inline compile_regex()
2025-06-11 19:10 ` Petr Lautrbach
@ 2025-06-11 19:13 ` Stephen Smalley
2025-06-11 19:17 ` Petr Lautrbach
0 siblings, 1 reply; 5+ messages in thread
From: Stephen Smalley @ 2025-06-11 19:13 UTC (permalink / raw)
To: Petr Lautrbach; +Cc: James Carter, selinux
On Wed, Jun 11, 2025 at 3:10 PM Petr Lautrbach <lautrbach@redhat.com> wrote:
>
> Stephen Smalley <stephen.smalley.work@gmail.com> writes:
>
> > On Wed, Jun 11, 2025 at 2:29 PM James Carter <jwcart2@gmail.com> wrote:
> >>
> >> Since commit bdcbbf89b9548afd452449835e58e84105a71a9a (libselinux:
> >> limit fcontext regex path length), an error would be given if
> >> libselinux was compiled directly. (Though, building the whole SELinux
> >> userspace still worked.) This is because the flag "-Winline" is used
> >> when building libselinux directly, but not when building the whole
> >> userspace.
> >>
> >> Remove "inline" from the function compile_regex() in label_file.h
> >> to allow libselinux to be built directly.
> >>
> >> There are four functions defined in label_file.h that are not inlined:
> >> regex_has_meta_chars(), regex_simplify(), compile_regex(), and
> >> insert_spec(). The first three functions are called by insert_spec()
> >> which is called by the inlined function process_line(). This last
> >> function is called by utils/sefcontext_compile.c which prevents
> >> relocating the non-inlined functions to label_file.c.
> >>
> >> Signed-off-by: James Carter <jwcart2@gmail.com>
> >
> > Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
> >
>
> I'm going to postpone 3.9-rc1 to tomorrow so this change can land there.
>
> Ok?
Or feel free to merge it now (or I can) and you can do it today,
whichever is easiest.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] libselinux: Do not inline compile_regex()
2025-06-11 19:13 ` Stephen Smalley
@ 2025-06-11 19:17 ` Petr Lautrbach
0 siblings, 0 replies; 5+ messages in thread
From: Petr Lautrbach @ 2025-06-11 19:17 UTC (permalink / raw)
To: Stephen Smalley; +Cc: James Carter, selinux
Stephen Smalley <stephen.smalley.work@gmail.com> writes:
> On Wed, Jun 11, 2025 at 3:10 PM Petr Lautrbach <lautrbach@redhat.com> wrote:
>>
>> Stephen Smalley <stephen.smalley.work@gmail.com> writes:
>>
>> > On Wed, Jun 11, 2025 at 2:29 PM James Carter <jwcart2@gmail.com> wrote:
>> >>
>> >> Since commit bdcbbf89b9548afd452449835e58e84105a71a9a (libselinux:
>> >> limit fcontext regex path length), an error would be given if
>> >> libselinux was compiled directly. (Though, building the whole SELinux
>> >> userspace still worked.) This is because the flag "-Winline" is used
>> >> when building libselinux directly, but not when building the whole
>> >> userspace.
>> >>
>> >> Remove "inline" from the function compile_regex() in label_file.h
>> >> to allow libselinux to be built directly.
>> >>
>> >> There are four functions defined in label_file.h that are not inlined:
>> >> regex_has_meta_chars(), regex_simplify(), compile_regex(), and
>> >> insert_spec(). The first three functions are called by insert_spec()
>> >> which is called by the inlined function process_line(). This last
>> >> function is called by utils/sefcontext_compile.c which prevents
>> >> relocating the non-inlined functions to label_file.c.
>> >>
>> >> Signed-off-by: James Carter <jwcart2@gmail.com>
>> >
>> > Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
>> >
>>
>> I'm going to postpone 3.9-rc1 to tomorrow so this change can land there.
>>
>> Ok?
>
> Or feel free to merge it now (or I can) and you can do it today,
> whichever is easiest.
I've merged it just now.
expect 3.9-rc1 in next 30 minutes
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-06-11 19:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-11 18:28 [PATCH] libselinux: Do not inline compile_regex() James Carter
2025-06-11 18:31 ` Stephen Smalley
2025-06-11 19:10 ` Petr Lautrbach
2025-06-11 19:13 ` Stephen Smalley
2025-06-11 19:17 ` Petr Lautrbach
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).