lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 14 Mar 2011 15:03:17 -0400
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Jesper Juhl <jj@...osbits.net>
Cc:	x86@...nel.org, linux-kernel@...r.kernel.org,
	Ingo Molnar <mingo@...hat.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH][rfc] Use int as return type of main in
 arch/x86/boot/main.c

On Sun, Mar 13, 2011 at 11:00:09PM +0100, Jesper Juhl wrote:
> I believe the return type of main should always be 'int'.

But this is not userspace, it is called from assmebly in header.S:

 # Jump to C code (should not return)
 calll	main

We don't care what main returns. If it does return anything, then it
dies:

# Setup corrupt somehow...
setup_bad:
        movl    $setup_corrupt, %eax
        calll   puts
        # Fall through...

        .globl  die
        .type   die, @function
die:
        hlt
        jmp     die


-- Steve

> 
> Signed-off-by: Jesper Juhl <jj@...osbits.net>
> ---
>  main.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/boot/main.c b/arch/x86/boot/main.c
> index 40358c8..4b80da8 100644
> --- a/arch/x86/boot/main.c
> +++ b/arch/x86/boot/main.c
> @@ -125,7 +125,7 @@ static void init_heap(void)
>  	}
>  }
>  
> -void main(void)
> +int main(void)
>  {
>  	/* First, copy the boot header into the "zeropage" */
>  	copy_boot_params();
> @@ -175,4 +175,6 @@ void main(void)
>  
>  	/* Do the last things and invoke protected mode */
>  	go_to_protected_mode();
> +
> +	return 0;
>  }
> 
> 
> -- 
> Jesper Juhl <jj@...osbits.net>            http://www.chaosbits.net/
> Plain text mails only, please.
> Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ