* [PATCH] apparmor: Simply obtain the newest label on a cred
@ 2022-09-22 3:00 Gaosheng Cui
2022-09-22 14:56 ` Serge E. Hallyn
0 siblings, 1 reply; 4+ messages in thread
From: Gaosheng Cui @ 2022-09-22 3:00 UTC (permalink / raw)
To: john.johansen, paul, jmorris, serge, cuigaosheng1
Cc: apparmor, linux-security-module
aa_get_newest_cred_label(__task_cred(task)) can do the same things as
aa_get_newest_label(__aa_task_raw_label(task)), so we can replace it
and remove __aa_task_raw_label() to simply code.
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
---
security/apparmor/include/cred.h | 13 -------------
security/apparmor/task.c | 2 +-
2 files changed, 1 insertion(+), 14 deletions(-)
diff --git a/security/apparmor/include/cred.h b/security/apparmor/include/cred.h
index 0b9ae4804ef7..58fdc72af664 100644
--- a/security/apparmor/include/cred.h
+++ b/security/apparmor/include/cred.h
@@ -63,19 +63,6 @@ static inline struct aa_label *aa_get_newest_cred_label(const struct cred *cred)
return aa_get_newest_label(aa_cred_raw_label(cred));
}
-/**
- * __aa_task_raw_label - retrieve another task's label
- * @task: task to query (NOT NULL)
- *
- * Returns: @task's label without incrementing its ref count
- *
- * If @task != current needs to be called in RCU safe critical section
- */
-static inline struct aa_label *__aa_task_raw_label(struct task_struct *task)
-{
- return aa_cred_raw_label(__task_cred(task));
-}
-
/**
* aa_current_raw_label - find the current tasks confining label
*
diff --git a/security/apparmor/task.c b/security/apparmor/task.c
index 503dc0877fb1..0a8f9fa7ca0a 100644
--- a/security/apparmor/task.c
+++ b/security/apparmor/task.c
@@ -31,7 +31,7 @@ struct aa_label *aa_get_task_label(struct task_struct *task)
struct aa_label *p;
rcu_read_lock();
- p = aa_get_newest_label(__aa_task_raw_label(task));
+ p = aa_get_newest_cred_label(__task_cred(task));
rcu_read_unlock();
return p;
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] apparmor: Simply obtain the newest label on a cred
2022-09-22 3:00 [PATCH] apparmor: Simply obtain the newest label on a cred Gaosheng Cui
@ 2022-09-22 14:56 ` Serge E. Hallyn
2022-09-23 9:29 ` cuigaosheng
0 siblings, 1 reply; 4+ messages in thread
From: Serge E. Hallyn @ 2022-09-22 14:56 UTC (permalink / raw)
To: Gaosheng Cui
Cc: john.johansen, paul, jmorris, serge, apparmor,
linux-security-module
On Thu, Sep 22, 2022 at 11:00:24AM +0800, Gaosheng Cui wrote:
> aa_get_newest_cred_label(__task_cred(task)) can do the same things as
> aa_get_newest_label(__aa_task_raw_label(task)), so we can replace it
> and remove __aa_task_raw_label() to simply code.
nitpick -
"to simplify the code".
>
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> ---
> security/apparmor/include/cred.h | 13 -------------
> security/apparmor/task.c | 2 +-
> 2 files changed, 1 insertion(+), 14 deletions(-)
>
> diff --git a/security/apparmor/include/cred.h b/security/apparmor/include/cred.h
> index 0b9ae4804ef7..58fdc72af664 100644
> --- a/security/apparmor/include/cred.h
> +++ b/security/apparmor/include/cred.h
> @@ -63,19 +63,6 @@ static inline struct aa_label *aa_get_newest_cred_label(const struct cred *cred)
> return aa_get_newest_label(aa_cred_raw_label(cred));
> }
>
> -/**
> - * __aa_task_raw_label - retrieve another task's label
> - * @task: task to query (NOT NULL)
> - *
> - * Returns: @task's label without incrementing its ref count
> - *
> - * If @task != current needs to be called in RCU safe critical section
> - */
> -static inline struct aa_label *__aa_task_raw_label(struct task_struct *task)
> -{
> - return aa_cred_raw_label(__task_cred(task));
> -}
> -
> /**
> * aa_current_raw_label - find the current tasks confining label
> *
> diff --git a/security/apparmor/task.c b/security/apparmor/task.c
> index 503dc0877fb1..0a8f9fa7ca0a 100644
> --- a/security/apparmor/task.c
> +++ b/security/apparmor/task.c
> @@ -31,7 +31,7 @@ struct aa_label *aa_get_task_label(struct task_struct *task)
> struct aa_label *p;
>
> rcu_read_lock();
> - p = aa_get_newest_label(__aa_task_raw_label(task));
> + p = aa_get_newest_cred_label(__task_cred(task));
> rcu_read_unlock();
>
> return p;
> --
> 2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] apparmor: Simply obtain the newest label on a cred
2022-09-22 14:56 ` Serge E. Hallyn
@ 2022-09-23 9:29 ` cuigaosheng
2022-09-24 9:13 ` John Johansen
0 siblings, 1 reply; 4+ messages in thread
From: cuigaosheng @ 2022-09-23 9:29 UTC (permalink / raw)
To: Serge E. Hallyn
Cc: john.johansen, paul, jmorris, apparmor, linux-security-module
> On Thu, Sep 22, 2022 at 11:00:24AM +0800, Gaosheng Cui wrote:
>> aa_get_newest_cred_label(__task_cred(task)) can do the same things as
>> aa_get_newest_label(__aa_task_raw_label(task)), so we can replace it
>> and remove __aa_task_raw_label() to simply code.
> nitpick -
>
> "to simplify the code".
>
Thanks for taking the time to review this patch, I have made a patch v2 and submitted it.
link: https://patchwork.kernel.org/project/linux-security-module/list/?series=679790
On 2022/9/22 22:56, Serge E. Hallyn wrote:
> On Thu, Sep 22, 2022 at 11:00:24AM +0800, Gaosheng Cui wrote:
>> aa_get_newest_cred_label(__task_cred(task)) can do the same things as
>> aa_get_newest_label(__aa_task_raw_label(task)), so we can replace it
>> and remove __aa_task_raw_label() to simply code.
> nitpick -
>
> "to simplify the code".
>
>> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
>> ---
>> security/apparmor/include/cred.h | 13 -------------
>> security/apparmor/task.c | 2 +-
>> 2 files changed, 1 insertion(+), 14 deletions(-)
>>
>> diff --git a/security/apparmor/include/cred.h b/security/apparmor/include/cred.h
>> index 0b9ae4804ef7..58fdc72af664 100644
>> --- a/security/apparmor/include/cred.h
>> +++ b/security/apparmor/include/cred.h
>> @@ -63,19 +63,6 @@ static inline struct aa_label *aa_get_newest_cred_label(const struct cred *cred)
>> return aa_get_newest_label(aa_cred_raw_label(cred));
>> }
>>
>> -/**
>> - * __aa_task_raw_label - retrieve another task's label
>> - * @task: task to query (NOT NULL)
>> - *
>> - * Returns: @task's label without incrementing its ref count
>> - *
>> - * If @task != current needs to be called in RCU safe critical section
>> - */
>> -static inline struct aa_label *__aa_task_raw_label(struct task_struct *task)
>> -{
>> - return aa_cred_raw_label(__task_cred(task));
>> -}
>> -
>> /**
>> * aa_current_raw_label - find the current tasks confining label
>> *
>> diff --git a/security/apparmor/task.c b/security/apparmor/task.c
>> index 503dc0877fb1..0a8f9fa7ca0a 100644
>> --- a/security/apparmor/task.c
>> +++ b/security/apparmor/task.c
>> @@ -31,7 +31,7 @@ struct aa_label *aa_get_task_label(struct task_struct *task)
>> struct aa_label *p;
>>
>> rcu_read_lock();
>> - p = aa_get_newest_label(__aa_task_raw_label(task));
>> + p = aa_get_newest_cred_label(__task_cred(task));
>> rcu_read_unlock();
>>
>> return p;
>> --
>> 2.25.1
> .
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] apparmor: Simply obtain the newest label on a cred
2022-09-23 9:29 ` cuigaosheng
@ 2022-09-24 9:13 ` John Johansen
0 siblings, 0 replies; 4+ messages in thread
From: John Johansen @ 2022-09-24 9:13 UTC (permalink / raw)
To: cuigaosheng, Serge E. Hallyn
Cc: paul, jmorris, apparmor, linux-security-module
On 9/23/22 02:29, cuigaosheng wrote:
>> On Thu, Sep 22, 2022 at 11:00:24AM +0800, Gaosheng Cui wrote:
>>> aa_get_newest_cred_label(__task_cred(task)) can do the same things as
>>> aa_get_newest_label(__aa_task_raw_label(task)), so we can replace it
>>> and remove __aa_task_raw_label() to simply code.
>> nitpick -
>>
>> "to simplify the code".
>>
> Thanks for taking the time to review this patch, I have made a patch v2 and submitted it.
>
> link: https://patchwork.kernel.org/project/linux-security-module/list/?series=679790
>
thanks
Acked-by: John Johansen <john.johansen@canonical.com>
I have pulled this into my tree
> On 2022/9/22 22:56, Serge E. Hallyn wrote:
>> On Thu, Sep 22, 2022 at 11:00:24AM +0800, Gaosheng Cui wrote:
>>> aa_get_newest_cred_label(__task_cred(task)) can do the same things as
>>> aa_get_newest_label(__aa_task_raw_label(task)), so we can replace it
>>> and remove __aa_task_raw_label() to simply code.
>> nitpick -
>>
>> "to simplify the code".
>>
>>> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
>>> ---
>>> security/apparmor/include/cred.h | 13 -------------
>>> security/apparmor/task.c | 2 +-
>>> 2 files changed, 1 insertion(+), 14 deletions(-)
>>>
>>> diff --git a/security/apparmor/include/cred.h b/security/apparmor/include/cred.h
>>> index 0b9ae4804ef7..58fdc72af664 100644
>>> --- a/security/apparmor/include/cred.h
>>> +++ b/security/apparmor/include/cred.h
>>> @@ -63,19 +63,6 @@ static inline struct aa_label *aa_get_newest_cred_label(const struct cred *cred)
>>> return aa_get_newest_label(aa_cred_raw_label(cred));
>>> }
>>> -/**
>>> - * __aa_task_raw_label - retrieve another task's label
>>> - * @task: task to query (NOT NULL)
>>> - *
>>> - * Returns: @task's label without incrementing its ref count
>>> - *
>>> - * If @task != current needs to be called in RCU safe critical section
>>> - */
>>> -static inline struct aa_label *__aa_task_raw_label(struct task_struct *task)
>>> -{
>>> - return aa_cred_raw_label(__task_cred(task));
>>> -}
>>> -
>>> /**
>>> * aa_current_raw_label - find the current tasks confining label
>>> *
>>> diff --git a/security/apparmor/task.c b/security/apparmor/task.c
>>> index 503dc0877fb1..0a8f9fa7ca0a 100644
>>> --- a/security/apparmor/task.c
>>> +++ b/security/apparmor/task.c
>>> @@ -31,7 +31,7 @@ struct aa_label *aa_get_task_label(struct task_struct *task)
>>> struct aa_label *p;
>>> rcu_read_lock();
>>> - p = aa_get_newest_label(__aa_task_raw_label(task));
>>> + p = aa_get_newest_cred_label(__task_cred(task));
>>> rcu_read_unlock();
>>> return p;
>>> --
>>> 2.25.1
>> .
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-09-24 9:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-22 3:00 [PATCH] apparmor: Simply obtain the newest label on a cred Gaosheng Cui
2022-09-22 14:56 ` Serge E. Hallyn
2022-09-23 9:29 ` cuigaosheng
2022-09-24 9:13 ` John Johansen
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).