2012-11-06 08:17:58

by Jarkko Sakkinen

[permalink] [raw]
Subject: [PATCH] smack: SMACK_MAGIC to include/uapi/linux/magic.h

SMACK_MAGIC moved to a proper place for easy user space access
(i.e. libsmack).

Signed-off-by: Jarkko Sakkinen <[email protected]>
---
include/uapi/linux/magic.h | 1 +
security/smack/smack.h | 5 -----
2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h
index e15192c..12735ad 100644
--- a/include/uapi/linux/magic.h
+++ b/include/uapi/linux/magic.h
@@ -11,6 +11,7 @@
#define DEBUGFS_MAGIC 0x64626720
#define SECURITYFS_MAGIC 0x73636673
#define SELINUX_MAGIC 0xf97cff8c
+#define SMACK_MAGIC 0x43415d53 /* "SMAC" */
#define RAMFS_MAGIC 0x858458f6 /* some random number */
#define TMPFS_MAGIC 0x01021994
#define HUGETLBFS_MAGIC 0x958458f6 /* some random number */
diff --git a/security/smack/smack.h b/security/smack/smack.h
index 99b3612..8ad3095 100644
--- a/security/smack/smack.h
+++ b/security/smack/smack.h
@@ -149,11 +149,6 @@ struct smack_known {
#define SMACK_CIPSO_SOCKET 1

/*
- * smackfs magic number
- */
-#define SMACK_MAGIC 0x43415d53 /* "SMAC" */
-
-/*
* CIPSO defaults.
*/
#define SMACK_CIPSO_DOI_DEFAULT 3 /* Historical */
--
1.7.10.4


2012-11-06 22:05:58

by Casey Schaufler

[permalink] [raw]
Subject: Re: [PATCH] smack: SMACK_MAGIC to include/uapi/linux/magic.h

On 11/6/2012 12:17 AM, Jarkko Sakkinen wrote:
> SMACK_MAGIC moved to a proper place for easy user space access
> (i.e. libsmack).
>
> Signed-off-by: Jarkko Sakkinen <[email protected]>
> ---
> include/uapi/linux/magic.h | 1 +
> security/smack/smack.h | 5 -----
> 2 files changed, 1 insertion(+), 5 deletions(-)

Will security/smack/smack_lsm.c and security/smack/smackfs.c
compile after this change?

>
> diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h
> index e15192c..12735ad 100644
> --- a/include/uapi/linux/magic.h
> +++ b/include/uapi/linux/magic.h
> @@ -11,6 +11,7 @@
> #define DEBUGFS_MAGIC 0x64626720
> #define SECURITYFS_MAGIC 0x73636673
> #define SELINUX_MAGIC 0xf97cff8c
> +#define SMACK_MAGIC 0x43415d53 /* "SMAC" */
> #define RAMFS_MAGIC 0x858458f6 /* some random number */
> #define TMPFS_MAGIC 0x01021994
> #define HUGETLBFS_MAGIC 0x958458f6 /* some random number */
> diff --git a/security/smack/smack.h b/security/smack/smack.h
> index 99b3612..8ad3095 100644
> --- a/security/smack/smack.h
> +++ b/security/smack/smack.h
> @@ -149,11 +149,6 @@ struct smack_known {
> #define SMACK_CIPSO_SOCKET 1
>
> /*
> - * smackfs magic number
> - */
> -#define SMACK_MAGIC 0x43415d53 /* "SMAC" */
> -
> -/*
> * CIPSO defaults.
> */
> #define SMACK_CIPSO_DOI_DEFAULT 3 /* Historical */

2012-11-06 22:23:12

by Eric Paris

[permalink] [raw]
Subject: Re: [PATCH] smack: SMACK_MAGIC to include/uapi/linux/magic.h

It looks like smack_lsm.c includes linux/magic.h, but smackfs.c
doesn't... Seems like they should have included linux/magic.h in the
same header they removed the definition from....

On Tue, Nov 6, 2012 at 4:59 PM, Casey Schaufler <[email protected]> wrote:
> On 11/6/2012 12:17 AM, Jarkko Sakkinen wrote:
>> SMACK_MAGIC moved to a proper place for easy user space access
>> (i.e. libsmack).
>>
>> Signed-off-by: Jarkko Sakkinen <[email protected]>
>> ---
>> include/uapi/linux/magic.h | 1 +
>> security/smack/smack.h | 5 -----
>> 2 files changed, 1 insertion(+), 5 deletions(-)
>
> Will security/smack/smack_lsm.c and security/smack/smackfs.c
> compile after this change?
>
>>
>> diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h
>> index e15192c..12735ad 100644
>> --- a/include/uapi/linux/magic.h
>> +++ b/include/uapi/linux/magic.h
>> @@ -11,6 +11,7 @@
>> #define DEBUGFS_MAGIC 0x64626720
>> #define SECURITYFS_MAGIC 0x73636673
>> #define SELINUX_MAGIC 0xf97cff8c
>> +#define SMACK_MAGIC 0x43415d53 /* "SMAC" */
>> #define RAMFS_MAGIC 0x858458f6 /* some random number */
>> #define TMPFS_MAGIC 0x01021994
>> #define HUGETLBFS_MAGIC 0x958458f6 /* some random number */
>> diff --git a/security/smack/smack.h b/security/smack/smack.h
>> index 99b3612..8ad3095 100644
>> --- a/security/smack/smack.h
>> +++ b/security/smack/smack.h
>> @@ -149,11 +149,6 @@ struct smack_known {
>> #define SMACK_CIPSO_SOCKET 1
>>
>> /*
>> - * smackfs magic number
>> - */
>> -#define SMACK_MAGIC 0x43415d53 /* "SMAC" */
>> -
>> -/*
>> * CIPSO defaults.
>> */
>> #define SMACK_CIPSO_DOI_DEFAULT 3 /* Historical */
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2012-11-08 10:43:10

by Jarkko Sakkinen

[permalink] [raw]
Subject: Re: [PATCH] smack: SMACK_MAGIC to include/uapi/linux/magic.h

On Tue, Nov 6, 2012 at 11:59 PM, Casey Schaufler <[email protected]> wrote:
>
> On 11/6/2012 12:17 AM, Jarkko Sakkinen wrote:
> > SMACK_MAGIC moved to a proper place for easy user space access
> > (i.e. libsmack).
> >
> > Signed-off-by: Jarkko Sakkinen <[email protected]>
> > ---
> > include/uapi/linux/magic.h | 1 +
> > security/smack/smack.h | 5 -----
> > 2 files changed, 1 insertion(+), 5 deletions(-)
>
> Will security/smack/smack_lsm.c and security/smack/smackfs.c
> compile after this change?

Sorry I haven't replied earlier. Anyway, I made a sanity check.

I retried build from clean. Works. I also checked that vmlinux contains
SMACK symbols. It does.

>
> >
> > diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h
> > index e15192c..12735ad 100644
> > --- a/include/uapi/linux/magic.h
> > +++ b/include/uapi/linux/magic.h
> > @@ -11,6 +11,7 @@
> > #define DEBUGFS_MAGIC 0x64626720
> > #define SECURITYFS_MAGIC 0x73636673
> > #define SELINUX_MAGIC 0xf97cff8c
> > +#define SMACK_MAGIC 0x43415d53 /* "SMAC" */
> > #define RAMFS_MAGIC 0x858458f6 /* some random number */
> > #define TMPFS_MAGIC 0x01021994
> > #define HUGETLBFS_MAGIC 0x958458f6 /* some random number */
> > diff --git a/security/smack/smack.h b/security/smack/smack.h
> > index 99b3612..8ad3095 100644
> > --- a/security/smack/smack.h
> > +++ b/security/smack/smack.h
> > @@ -149,11 +149,6 @@ struct smack_known {
> > #define SMACK_CIPSO_SOCKET 1
> >
> > /*
> > - * smackfs magic number
> > - */
> > -#define SMACK_MAGIC 0x43415d53 /* "SMAC" */
> > -
> > -/*
> > * CIPSO defaults.
> > */
> > #define SMACK_CIPSO_DOI_DEFAULT 3 /* Historical */
>

/Jarkko

2012-11-08 15:04:14

by Eric Paris

[permalink] [raw]
Subject: Re: [PATCH] smack: SMACK_MAGIC to include/uapi/linux/magic.h

Then it only works by accident that magic.h is included by some random
path in smackfs.c. You really should be including it in smack.h (or
each .c file individually, up to casey)

On Thu, Nov 8, 2012 at 5:43 AM, Jarkko Sakkinen <[email protected]> wrote:
> On Tue, Nov 6, 2012 at 11:59 PM, Casey Schaufler <[email protected]> wrote:
>>
>> On 11/6/2012 12:17 AM, Jarkko Sakkinen wrote:
>> > SMACK_MAGIC moved to a proper place for easy user space access
>> > (i.e. libsmack).
>> >
>> > Signed-off-by: Jarkko Sakkinen <[email protected]>
>> > ---
>> > include/uapi/linux/magic.h | 1 +
>> > security/smack/smack.h | 5 -----
>> > 2 files changed, 1 insertion(+), 5 deletions(-)
>>
>> Will security/smack/smack_lsm.c and security/smack/smackfs.c
>> compile after this change?
>
> Sorry I haven't replied earlier. Anyway, I made a sanity check.
>
> I retried build from clean. Works. I also checked that vmlinux contains
> SMACK symbols. It does.
>
>>
>> >
>> > diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h
>> > index e15192c..12735ad 100644
>> > --- a/include/uapi/linux/magic.h
>> > +++ b/include/uapi/linux/magic.h
>> > @@ -11,6 +11,7 @@
>> > #define DEBUGFS_MAGIC 0x64626720
>> > #define SECURITYFS_MAGIC 0x73636673
>> > #define SELINUX_MAGIC 0xf97cff8c
>> > +#define SMACK_MAGIC 0x43415d53 /* "SMAC" */
>> > #define RAMFS_MAGIC 0x858458f6 /* some random number */
>> > #define TMPFS_MAGIC 0x01021994
>> > #define HUGETLBFS_MAGIC 0x958458f6 /* some random number */
>> > diff --git a/security/smack/smack.h b/security/smack/smack.h
>> > index 99b3612..8ad3095 100644
>> > --- a/security/smack/smack.h
>> > +++ b/security/smack/smack.h
>> > @@ -149,11 +149,6 @@ struct smack_known {
>> > #define SMACK_CIPSO_SOCKET 1
>> >
>> > /*
>> > - * smackfs magic number
>> > - */
>> > -#define SMACK_MAGIC 0x43415d53 /* "SMAC" */
>> > -
>> > -/*
>> > * CIPSO defaults.
>> > */
>> > #define SMACK_CIPSO_DOI_DEFAULT 3 /* Historical */
>>
>
> /Jarkko
> --
> To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2012-11-08 17:42:34

by Jarkko Sakkinen

[permalink] [raw]
Subject: Re: [PATCH] smack: SMACK_MAGIC to include/uapi/linux/magic.h

On Thu, Nov 8, 2012 at 5:04 PM, Eric Paris <[email protected]> wrote:
> Then it only works by accident that magic.h is included by some random
> path in smackfs.c. You really should be including it in smack.h (or
> each .c file individually, up to casey)

Fully agree. Just answered to the query :)

>
> On Thu, Nov 8, 2012 at 5:43 AM, Jarkko Sakkinen <[email protected]> wrote:
>> On Tue, Nov 6, 2012 at 11:59 PM, Casey Schaufler <[email protected]> wrote:
>>>
>>> On 11/6/2012 12:17 AM, Jarkko Sakkinen wrote:
>>> > SMACK_MAGIC moved to a proper place for easy user space access
>>> > (i.e. libsmack).
>>> >
>>> > Signed-off-by: Jarkko Sakkinen <[email protected]>
>>> > ---
>>> > include/uapi/linux/magic.h | 1 +
>>> > security/smack/smack.h | 5 -----
>>> > 2 files changed, 1 insertion(+), 5 deletions(-)
>>>
>>> Will security/smack/smack_lsm.c and security/smack/smackfs.c
>>> compile after this change?
>>
>> Sorry I haven't replied earlier. Anyway, I made a sanity check.
>>
>> I retried build from clean. Works. I also checked that vmlinux contains
>> SMACK symbols. It does.
>>
>>>
>>> >
>>> > diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h
>>> > index e15192c..12735ad 100644
>>> > --- a/include/uapi/linux/magic.h
>>> > +++ b/include/uapi/linux/magic.h
>>> > @@ -11,6 +11,7 @@
>>> > #define DEBUGFS_MAGIC 0x64626720
>>> > #define SECURITYFS_MAGIC 0x73636673
>>> > #define SELINUX_MAGIC 0xf97cff8c
>>> > +#define SMACK_MAGIC 0x43415d53 /* "SMAC" */
>>> > #define RAMFS_MAGIC 0x858458f6 /* some random number */
>>> > #define TMPFS_MAGIC 0x01021994
>>> > #define HUGETLBFS_MAGIC 0x958458f6 /* some random number */
>>> > diff --git a/security/smack/smack.h b/security/smack/smack.h
>>> > index 99b3612..8ad3095 100644
>>> > --- a/security/smack/smack.h
>>> > +++ b/security/smack/smack.h
>>> > @@ -149,11 +149,6 @@ struct smack_known {
>>> > #define SMACK_CIPSO_SOCKET 1
>>> >
>>> > /*
>>> > - * smackfs magic number
>>> > - */
>>> > -#define SMACK_MAGIC 0x43415d53 /* "SMAC" */
>>> > -
>>> > -/*
>>> > * CIPSO defaults.
>>> > */
>>> > #define SMACK_CIPSO_DOI_DEFAULT 3 /* Historical */
>>>
>>
>> /Jarkko
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
>> the body of a message to [email protected]
>> More majordomo info at http://vger.kernel.org/majordomo-info.html

/Jarkko

2012-11-08 17:44:06

by Jarkko Sakkinen

[permalink] [raw]
Subject: Re: [PATCH] smack: SMACK_MAGIC to include/uapi/linux/magic.h

On Thu, Nov 8, 2012 at 7:40 PM, Casey Schaufler <[email protected]> wrote:
> On 11/8/2012 7:04 AM, Eric Paris wrote:
>> Then it only works by accident that magic.h is included by some random
>> path in smackfs.c. You really should be including it in smack.h (or
>> each .c file individually, up to casey)
>
> I should think it should go in smack.h

Yeah, that's probably best place for it. I'll add the include there.

>
>> On Thu, Nov 8, 2012 at 5:43 AM, Jarkko Sakkinen <[email protected]> wrote:
>>> On Tue, Nov 6, 2012 at 11:59 PM, Casey Schaufler <[email protected]> wrote:
>>>> On 11/6/2012 12:17 AM, Jarkko Sakkinen wrote:
>>>>> SMACK_MAGIC moved to a proper place for easy user space access
>>>>> (i.e. libsmack).
>>>>>
>>>>> Signed-off-by: Jarkko Sakkinen <[email protected]>
>>>>> ---
>>>>> include/uapi/linux/magic.h | 1 +
>>>>> security/smack/smack.h | 5 -----
>>>>> 2 files changed, 1 insertion(+), 5 deletions(-)
>>>> Will security/smack/smack_lsm.c and security/smack/smackfs.c
>>>> compile after this change?
>>> Sorry I haven't replied earlier. Anyway, I made a sanity check.
>>>
>>> I retried build from clean. Works. I also checked that vmlinux contains
>>> SMACK symbols. It does.
>>>
>>>>> diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h
>>>>> index e15192c..12735ad 100644
>>>>> --- a/include/uapi/linux/magic.h
>>>>> +++ b/include/uapi/linux/magic.h
>>>>> @@ -11,6 +11,7 @@
>>>>> #define DEBUGFS_MAGIC 0x64626720
>>>>> #define SECURITYFS_MAGIC 0x73636673
>>>>> #define SELINUX_MAGIC 0xf97cff8c
>>>>> +#define SMACK_MAGIC 0x43415d53 /* "SMAC" */
>>>>> #define RAMFS_MAGIC 0x858458f6 /* some random number */
>>>>> #define TMPFS_MAGIC 0x01021994
>>>>> #define HUGETLBFS_MAGIC 0x958458f6 /* some random number */
>>>>> diff --git a/security/smack/smack.h b/security/smack/smack.h
>>>>> index 99b3612..8ad3095 100644
>>>>> --- a/security/smack/smack.h
>>>>> +++ b/security/smack/smack.h
>>>>> @@ -149,11 +149,6 @@ struct smack_known {
>>>>> #define SMACK_CIPSO_SOCKET 1
>>>>>
>>>>> /*
>>>>> - * smackfs magic number
>>>>> - */
>>>>> -#define SMACK_MAGIC 0x43415d53 /* "SMAC" */
>>>>> -
>>>>> -/*
>>>>> * CIPSO defaults.
>>>>> */
>>>>> #define SMACK_CIPSO_DOI_DEFAULT 3 /* Historical */
>>> /Jarkko
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
>>> the body of a message to [email protected]
>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

/Jarkko

2012-11-08 17:46:48

by Casey Schaufler

[permalink] [raw]
Subject: Re: [PATCH] smack: SMACK_MAGIC to include/uapi/linux/magic.h

On 11/8/2012 7:04 AM, Eric Paris wrote:
> Then it only works by accident that magic.h is included by some random
> path in smackfs.c. You really should be including it in smack.h (or
> each .c file individually, up to casey)

I should think it should go in smack.h

> On Thu, Nov 8, 2012 at 5:43 AM, Jarkko Sakkinen <[email protected]> wrote:
>> On Tue, Nov 6, 2012 at 11:59 PM, Casey Schaufler <[email protected]> wrote:
>>> On 11/6/2012 12:17 AM, Jarkko Sakkinen wrote:
>>>> SMACK_MAGIC moved to a proper place for easy user space access
>>>> (i.e. libsmack).
>>>>
>>>> Signed-off-by: Jarkko Sakkinen <[email protected]>
>>>> ---
>>>> include/uapi/linux/magic.h | 1 +
>>>> security/smack/smack.h | 5 -----
>>>> 2 files changed, 1 insertion(+), 5 deletions(-)
>>> Will security/smack/smack_lsm.c and security/smack/smackfs.c
>>> compile after this change?
>> Sorry I haven't replied earlier. Anyway, I made a sanity check.
>>
>> I retried build from clean. Works. I also checked that vmlinux contains
>> SMACK symbols. It does.
>>
>>>> diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h
>>>> index e15192c..12735ad 100644
>>>> --- a/include/uapi/linux/magic.h
>>>> +++ b/include/uapi/linux/magic.h
>>>> @@ -11,6 +11,7 @@
>>>> #define DEBUGFS_MAGIC 0x64626720
>>>> #define SECURITYFS_MAGIC 0x73636673
>>>> #define SELINUX_MAGIC 0xf97cff8c
>>>> +#define SMACK_MAGIC 0x43415d53 /* "SMAC" */
>>>> #define RAMFS_MAGIC 0x858458f6 /* some random number */
>>>> #define TMPFS_MAGIC 0x01021994
>>>> #define HUGETLBFS_MAGIC 0x958458f6 /* some random number */
>>>> diff --git a/security/smack/smack.h b/security/smack/smack.h
>>>> index 99b3612..8ad3095 100644
>>>> --- a/security/smack/smack.h
>>>> +++ b/security/smack/smack.h
>>>> @@ -149,11 +149,6 @@ struct smack_known {
>>>> #define SMACK_CIPSO_SOCKET 1
>>>>
>>>> /*
>>>> - * smackfs magic number
>>>> - */
>>>> -#define SMACK_MAGIC 0x43415d53 /* "SMAC" */
>>>> -
>>>> -/*
>>>> * CIPSO defaults.
>>>> */
>>>> #define SMACK_CIPSO_DOI_DEFAULT 3 /* Historical */
>> /Jarkko
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
>> the body of a message to [email protected]
>> More majordomo info at http://vger.kernel.org/majordomo-info.html