From: tushar.behera@linaro.org (Tushar Behera)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: S3C2410: Remove section mismatch warning
Date: Mon, 03 Oct 2011 17:04:57 +0530 [thread overview]
Message-ID: <4E899DE1.6020608@linaro.org> (raw)
In-Reply-To: <20111003095933.GC11710@n2100.arm.linux.org.uk>
Hi Russell,
On Monday 03 October 2011 03:29 PM, Russell King - ARM Linux wrote:
> On Mon, Oct 03, 2011 at 03:10:41PM +0530, Tushar Behera wrote:
>> Some of the functions and structures did not have _init or __initdata
>> attributes, even though they were referenced from functions / structures
>> with those attribute, resulting in section mismatches.
>
> Firstly - it's a good idea to include the warnings which you're fixing
> in the commit log text, so that people know exactly what is being fixed.
>
Thanks for your review.
Sure, I will add it in next revision.
[ snip ]
>> diff --git a/arch/arm/mach-s3c2416/irq.c b/arch/arm/mach-s3c2416/irq.c
>> index 28ad20d..153cb2f 100644
>> --- a/arch/arm/mach-s3c2416/irq.c
>> +++ b/arch/arm/mach-s3c2416/irq.c
>> @@ -234,7 +234,7 @@ static int __init s3c2416_irq_add(struct sys_device *sysdev)
>> return 0;
>> }
>>
>> -static struct sysdev_driver s3c2416_irq_driver = {
>> +static struct sysdev_driver s3c2416_irq_driver __initdata = {
>> .add = s3c2416_irq_add,
>> };
>>
>
> I remain entirely unconvinced that this is correct. As a result of
> the "sysdev_driver_register(&s3c2416_sysclass,&s3c2416_irq_driver);"
> call, this structure is placed on a list.
>
> If this structure is marked __initdata, then the memory behind the
> structure will be freed and overwritten - however, it's still on a
> list which might be walked. Such a walk would cause a kernel oops
> or might even be an exploitable security hole if that page ends up
> in userspace - especially as said structure contains function calls
> which would be called in privileged mode.
>
The function s3c2416_irq_add() is defined with __init attribute. Also a
cascade of functions called from s3c2416_irq_add() are also defined with
__init attribute.
Would it be a good idea to remove __init attribute of all these
functions (there are 2 of them) called from s3c2416_irq_add() instead?
> The same comment applies to the other sysdev driver structures you're
> marking __initdata too.
--
Tushar Behera
prev parent reply other threads:[~2011-10-03 11:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-03 9:40 [PATCH] ARM: S3C2410: Remove section mismatch warning Tushar Behera
2011-10-03 9:59 ` Russell King - ARM Linux
2011-10-03 11:34 ` Tushar Behera [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E899DE1.6020608@linaro.org \
--to=tushar.behera@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).